nrf52840 zigbee Installation code delete

hi,

I am selectively deleting the added installation code entries and have found the following issues,

I have successfully added the device with IEEE address “f4ce362ddd850b0a” to the installation code list in the Zigbee coordinator, but I am unable to utilize<zb_secur_ic_remove_req>Delete the specified device, only<zb_secur_ic_remove_all_req>Clear All.After testing, it was found that IEEE addresses f4ce362ddd850b0a, f4ce362ddd850b0b, f4ce362ddd850b0c, and f4ce362ddd850b0d cannot be used<zb_secur_ic_remove_req>Delete. However, IEEE addresses f4ce362ddd850b09,f4ce362ddd850b0e and f4ce362ddd850b0f can use<zb_secur_ic_remove_req>Delete.I cannot understand this and hope to receive an answer.

SDK:nRF Connect SDK -- v2.5.0

Delete the code at the specified location:

Looking forward to your answer, thank you

Parents
  • Hello,

    Maria Gilje said:
    Are the devices you can't remove the install codes from on the network?

    Let me rephrase this question:

    Are the devices with IEEE addresses f4ce362ddd850b0a, f4ce362ddd850b0b, f4ce362ddd850b0c, and f4ce362ddd850b0d joined to the same ZigBee network as the ZigBee Coordinator?

    koal said:
    Use the <zb_secur_ic_str_add> provided by the stack for configuration

    Try to switch out zb_secur_ic_str_add() with zb_secur_ic_add() like in the implementation for the ZigBee shell library. The source code for NCS v2.5.0 is here.

    koal said:
    UART input :AT+IC_DEL_ZC=f4ce362ddd855b0a ,Remove 'AT+IC_DEL_ZC' for parsing

    Where is the AT command from?

    About the REMOV_addr population: The contents of p[] is also not seen from the code you have shared. Please share how p[] is filled as well. Other than that, the method looks good.

    Best regards,

    Maria

  • Are the devices with IEEE addresses f4ce362ddd850b0a, f4ce362ddd850b0b, f4ce362ddd850b0c, and f4ce362ddd850b0d joined to the same ZigBee network as the ZigBee Coordinator?

    Firstly, I did not enable the Zigbee network, but only configured the installation code after enabling the protocol stack. When I tried to delete the f4ce362ddd850b0a installation code, I found the above problem. Therefore, I believe that the key to the problem is not whether to enable the network or not.It can be simply understood as having only one coordinator device and encountering this issue before configuring the network to start.

    Try to switch out zb_secur_ic_str_add() with zb_secur_ic_add() like in the implementation for the ZigBee shell library. The source code for NCS v2.5.0 is here.

    After testing, No matter which one is used, it is the same.

    Where is the AT command from?

    The AT command comes from UART RX_BUF

    AT command processing

    I hope you can conduct a test.I make sure to fill in zb_secur_ic_add() and zb_secur_ic_remove_req() The parameters of are all correct, but the above issues did occur

  • Hello,

    I am back in office and writing to let you know that I have not been able to set up a test yet. Thank you for your patience.

    Best regards,

    Maria

  • Hello again,

    I have set up a test and I am seeing the same issue where some IEEE addresses can successfully be removed while others stay. The report is the same in both cases: a successful remove command.

    One of my colleagues were able to successfully remove the install codes for all of the IEEE addresses, so I am not quite sure what the issue with mine and your setup. Said colleague is away today, so I will continue with this after the weekend.

    Thank you again for your patience.

    For completeness, this is what I did to test.

    1. Enabled the ZigBee shell in the Zigbee: Network Coordinator sample.

    2. Added this code to ncs\nrf\subsys\zigbee\lib\zigbee_shell\src\zigbee_shell_cmd_bdb.c

    #define IC_REMOVE_HELP \
    	("Remove install code for the device.\n" \
    	"Usage: remove <h:eui64>")
    	
    // [...]
    
    static struct ic_cmd_ctx ic_remove_ctx = {0};
    
    // [...]
    
    void zb_secur_ic_remove_cb(zb_uint8_t status) 
    {
    	ARG_UNUSED(status);
    }
    /**@brief Function removing install code, to be executed in Zigbee thread context. 
     * 
     * @param[in] param Unused param.
    */
    void zb_install_code_remove(zb_uint8_t param) 
    {
    	ARG_UNUSED(param);
    
    	if (zb_get_network_role() != ZB_NWK_DEVICE_TYPE_COORDINATOR) {
    		zb_shell_print_error(
    			ic_remove_ctx.shell,
    			"Failed to remove IC. Device must be a coordinator)",
    			ZB_FALSE);
    		return;
    	}
    
    	zb_bufid_t bufid = zb_buf_get_out(); 
    	
    	if (bufid) {
    		zb_secur_ic_remove_req_t *req = ZB_BUF_GET_PARAM(bufid, zb_secur_ic_remove_req_t);
    		req->response_cb = zb_secur_ic_remove_cb;
    		memcpy(req->device_address, ic_remove_ctx.addr, sizeof(zb_ieee_addr_t));
    
    		zb_secur_ic_remove_req(bufid);
    
    		zb_secur_ic_remove_resp_t *resp = ZB_BUF_GET_PARAM(bufid, zb_secur_ic_remove_resp_t);
    
    		if(resp->status != RET_OK) {
    			zb_shell_print_error(ic_remove_ctx.shell, "Failed to remove IC", ZB_FALSE);
    		} else {
    			zb_shell_print_done(ic_remove_ctx.shell, ZB_FALSE);
    		}
    	
    		ic_remove_ctx.taken = false;
    
    	} else {
    		zb_shell_print_error(
    			ic_remove_ctx.shell, 
    			"Failed to remove IC. No bufid",
    			ZB_FALSE);
    	}
    }
    
    // [...]
    
    /* The following was modified: added the remove command */
    SHELL_STATIC_SUBCMD_SET_CREATE(sub_ic,
    #ifndef ZB_ED_ROLE
    	SHELL_CMD_ARG(add, NULL, IC_ADD_HELP, cmd_zb_install_code, 3, 0),
    	SHELL_CMD_ARG(list, NULL, IC_LIST_HELP, cmd_zb_install_code, 1, 0),
    	SHELL_CMD_ARG(policy, NULL, IC_POLICY_HELP, cmd_zb_install_code, 2, 0),
    	SHELL_CMD_ARG(remove, NULL, IC_REMOVE_HELP, cmd_zb_install_code, 2, 0), // Added CMD
    #endif
    	SHELL_CMD_ARG(set, NULL, IC_SET_HELP, cmd_zb_install_code, 2, 0),
    	SHELL_SUBCMD_SET_END);

    I'll return next week after I have discussed with my colleague.

    Best regards,

    Maria

Reply
  • Hello again,

    I have set up a test and I am seeing the same issue where some IEEE addresses can successfully be removed while others stay. The report is the same in both cases: a successful remove command.

    One of my colleagues were able to successfully remove the install codes for all of the IEEE addresses, so I am not quite sure what the issue with mine and your setup. Said colleague is away today, so I will continue with this after the weekend.

    Thank you again for your patience.

    For completeness, this is what I did to test.

    1. Enabled the ZigBee shell in the Zigbee: Network Coordinator sample.

    2. Added this code to ncs\nrf\subsys\zigbee\lib\zigbee_shell\src\zigbee_shell_cmd_bdb.c

    #define IC_REMOVE_HELP \
    	("Remove install code for the device.\n" \
    	"Usage: remove <h:eui64>")
    	
    // [...]
    
    static struct ic_cmd_ctx ic_remove_ctx = {0};
    
    // [...]
    
    void zb_secur_ic_remove_cb(zb_uint8_t status) 
    {
    	ARG_UNUSED(status);
    }
    /**@brief Function removing install code, to be executed in Zigbee thread context. 
     * 
     * @param[in] param Unused param.
    */
    void zb_install_code_remove(zb_uint8_t param) 
    {
    	ARG_UNUSED(param);
    
    	if (zb_get_network_role() != ZB_NWK_DEVICE_TYPE_COORDINATOR) {
    		zb_shell_print_error(
    			ic_remove_ctx.shell,
    			"Failed to remove IC. Device must be a coordinator)",
    			ZB_FALSE);
    		return;
    	}
    
    	zb_bufid_t bufid = zb_buf_get_out(); 
    	
    	if (bufid) {
    		zb_secur_ic_remove_req_t *req = ZB_BUF_GET_PARAM(bufid, zb_secur_ic_remove_req_t);
    		req->response_cb = zb_secur_ic_remove_cb;
    		memcpy(req->device_address, ic_remove_ctx.addr, sizeof(zb_ieee_addr_t));
    
    		zb_secur_ic_remove_req(bufid);
    
    		zb_secur_ic_remove_resp_t *resp = ZB_BUF_GET_PARAM(bufid, zb_secur_ic_remove_resp_t);
    
    		if(resp->status != RET_OK) {
    			zb_shell_print_error(ic_remove_ctx.shell, "Failed to remove IC", ZB_FALSE);
    		} else {
    			zb_shell_print_done(ic_remove_ctx.shell, ZB_FALSE);
    		}
    	
    		ic_remove_ctx.taken = false;
    
    	} else {
    		zb_shell_print_error(
    			ic_remove_ctx.shell, 
    			"Failed to remove IC. No bufid",
    			ZB_FALSE);
    	}
    }
    
    // [...]
    
    /* The following was modified: added the remove command */
    SHELL_STATIC_SUBCMD_SET_CREATE(sub_ic,
    #ifndef ZB_ED_ROLE
    	SHELL_CMD_ARG(add, NULL, IC_ADD_HELP, cmd_zb_install_code, 3, 0),
    	SHELL_CMD_ARG(list, NULL, IC_LIST_HELP, cmd_zb_install_code, 1, 0),
    	SHELL_CMD_ARG(policy, NULL, IC_POLICY_HELP, cmd_zb_install_code, 2, 0),
    	SHELL_CMD_ARG(remove, NULL, IC_REMOVE_HELP, cmd_zb_install_code, 2, 0), // Added CMD
    #endif
    	SHELL_CMD_ARG(set, NULL, IC_SET_HELP, cmd_zb_install_code, 2, 0),
    	SHELL_SUBCMD_SET_END);

    I'll return next week after I have discussed with my colleague.

    Best regards,

    Maria

Children
Related