nrf9160dk How to add custom at command

I want to add a custom at command in the SLM example . I follow the https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.6.1/nrf/libraries/modem/at_cmd_custom.html, enable  CONFIG_AT_CMD_CUSTOM in prj.conf, add at_cmd_custom.h to the main.c, and the following code was added

AT_CMD_CUSTOM(my_command_filter, "AT+MYCOMMAND", my_command_callback);

int my_command_callback(char *buf, size_t len, char *at_cmd);
{
    printf("Callback for %s", at_cmd);
    return at_cmd_custom_respond(buf, len, "OK\r\n");
}


I found slm_at_cmdulist in slm_at_commends.c, And try to change my_command_filter to slm_at_cmdulist,It also has no effect
Apart from the at command supported by the SLM example itself, the MYCOMMEND command I added did not take effect. Did I make a mistake in which step? Or which step was missed?

gratitude
Parents
  • Now it has been implemented to add custom commands in the SLM example, but I used the same method to add custom commands to a hello world project. Custom commands only return OK when sent the first time, and error when sent the second time or after, The built-in commands in the modem, such as+cfun or+cereg, do not have this issue

Reply
  • Now it has been implemented to add custom commands in the SLM example, but I used the same method to add custom commands to a hello world project. Custom commands only return OK when sent the first time, and error when sent the second time or after, The built-in commands in the modem, such as+cfun or+cereg, do not have this issue

Children
No Data
Related