Forums - Switch to remove association

2 posts / 0 new
Last post
Switch to remove association
kian
Join Date: 8 Jun 16
Posts: 43
Posted: Sat, 2016-08-27 06:10

Hi all,

The CSRMesh 1.3 Light example application has a feature to remove association by pressing on the SW2 switch on the development board. I have tested this and it works fine.

My question now is, how do I go about implementing this feature to remove association on the CSRMesh 1.3 Switch example application? I tried to use the same method, but it just doesnt want to unassociate. The only way to remove association is to delete the device from the app so that it can be discovered again.

If say the switch device is associated to my android phone app and I lose my phone. There is no way I can unassociate the switch device anymore. That is why I need to implement a manual way to unassociate the switch device by pressing on a button on the device.

These are the codes I used:

if(buttonpressed)

{

    /* Move device to dissociated state */

    g_switchapp_data.assoc_state = app_state_not_associated;

 

    /* Clear the assigned groups and save it to NVM */

    /* Light model */

    MemSet(dst_id_list, 0x0000, sizeof(dst_id_list));

    Nvm_Write((uint16 *)dst_id_list, sizeof(dst_id_list),

    NVM_OFFSET_DST_ID_LIST);

 

    #ifdef ENABLE_WATCHDOG_MODEL

    /* Reset Watchdog Model data. */

    AppWatchdogResetState();

    #endif /* ENABLE_WATCHDOG_MODEL */

 

    /* Enable promiscuous mode on un-associated devices so that they

    * relay all the messages. This helps propagate messages(MCP) based

    * on the newly assigned network key as they will be relayed also by

    * the devices not yet associated.

    */

    g_switchapp_data.bearer_data.bearerPromiscuous =

           (BLE_BEARER_MASK | BLE_GATT_SERVER_BEARER_MASK);

    CsrMeshEnablePromiscuousMode(

            g_switchapp_data.bearer_data.bearerPromiscuous);

 

    /* Update Bearer Model Data to NVM */

    Nvm_Write((uint16 *)&g_switchapp_data.bearer_data,

    sizeof(BEARER_MODEL_STATE_DATA_T), NVM_BEARER_DATA_OFFSET);

 

    /* Start Mesh association again */

    initiateAssociation();

}

 

 

When I press the button, the above is executed and the initiateAssociation function is called. The led blinks to indicate that it is unassociated. However, I cannot discover the device on my phone app. Also, if I remove power from the device and power it up again, the led does not blink anymore.

 

Can anyone help on this?

 

 

Regards,

Kian

    

  • Up0
  • Down0
Loris
Join Date: 27 Jul 16
Posts: 35
Posted: Sun, 2016-08-28 20:22

call this api CSRmeshResult CSRmeshRemoveNetwork(CsrUint8 netId) to remove network information and then do a warm reset

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.