How the OR logic works


#1

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

/* 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


#2

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

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

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

void ATCmdCustomer_Handler (adl_atCmdPreParser_t * Params)

will depend on what command you send.


#3

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]

thanks


#9