# How the OR logic works

**URL:** <https://forum.sierrawireless.com/t/how-the-or-logic-works/6338>\
**Category:** Open AT\
**Created:** [May 28, 2013, 9:11am UTC](https://forum.sierrawireless.com/t/how-the-or-logic-works/6338 "2013-05-28T09:11:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![prakash12345](https://avatars.discourse-cdn.com/v4/letter/p/e36b37/32.png) [@prakash12345](https://forum.sierrawireless.com/u/prakash12345)\
**Post date:** [May 28, 2013, 9:11am UTC](https://forum.sierrawireless.com/t/how-the-or-logic-works/6338/1 "2013-05-28T09:11:53Z")

</div>

hi,

can anyone explain how the OR logic works in the function

if the OR operation happens means the output is

0x0400|0x0200|0x0100|0x0011 = 0x711  
so which type is called while run? READ or TEST or PARA

```auto
/* Subscribe to the 'AT+CUSTOMER' command. */
    s16 s16Return = adl_atCmdSubscribe( "AT+CUSTOMER",
                                        ( adl_atCmdHandler_t )ATCmdCustomer_Handler,
                                        ADL_CMD_TYPE_READ | ADL_CMD_TYPE_TEST |
                                        ADL_CMD_TYPE_PARA | 0x11 );
```

thanks

---

<div class="post-metadata">

**Author:** ![tomridl](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/tomridl/32/2704_2.png) [@tomridl](https://forum.sierrawireless.com/u/tomridl)\
**Post date:** [May 28, 2013, 11:04am UTC](https://forum.sierrawireless.com/t/how-the-or-logic-works/6338/2 "2013-05-28T11:04:26Z")

</div>

This OR operation determines which type of AT command is subscribed to. So for example, if you have:

```auto
adl_atCmdSubscribe( "AT+CUSTOMER", ATCmdCustomer_Handler, ADL_CMD_TYPE_READ );
```

the callback function will only be called if you send the read command (AT+CUSTOMER?), and the Params-\>Type variable will be set to ADL\_CMD\_TYPE\_READ. If you send anything else, you will receive an error.

Another example, if you have

```auto
adl_atCmdSubscribe( "AT+CUSTOMER", ATCmdCustomer_Handler, ADL_CMD_TYPE_READ | ADL_CMD_TYPE_PARA | 0x11 );
```

the callback function will be called on a read command (AT+CUSTOMER?) and a parameter command with at least one parameter and at most one parameter (AT+CUSTOMER=1). Any other type will return error (for example, AT+CUSTOMER=? or AT+CUSTOMER=1,2).

So in your example, the callback function will be called on a read command, a test command and a parameter command. The command type provided in the callback function (Params-\>Type), for example

```auto
void ATCmdCustomer_Handler (adl_atCmdPreParser_t * Params)
```

will depend on what command you send.

---

<div class="post-metadata">

**Author:** ![prakash12345](https://avatars.discourse-cdn.com/v4/letter/p/e36b37/32.png) [@prakash12345](https://forum.sierrawireless.com/u/prakash12345)\
**Post date:** [May 28, 2013, 11:29am UTC](https://forum.sierrawireless.com/t/how-the-or-logic-works/6338/3 "2013-05-28T11:29:23Z")

</div>

Thanks tomridl,

also could you kindly look in to the following query also

[url][https://forum.sierrawireless.com/t/customeratcmdsend-give-error-response/6323/1](https://forum.sierrawireless.com/t/customeratcmdsend-give-error-response/6323/1)]

thanks

---

<div class="post-metadata">

**Author:** ![thibs](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/thibs/32/953_2.png) [@thibs](https://forum.sierrawireless.com/u/thibs)\
**Post date:** [September 23, 2018, 2:35pm UTC](https://forum.sierrawireless.com/t/how-the-or-logic-works/6338/9 "2018-09-23T14:35:57Z")

</div>


