Search code examples
cuartat-command

How get string size


I am trying to send AT commands from my microcontroller and I am writing a my own implementation to check the responses from the remote module

At this point I want to send Strings with the command to the module in the following way:

    //File.h

    //where char const *message is my string from my file.c, LEN the lenght for my message and reply message from the remote module.

uint8_t CommandSenderCheckResponse(char const *message, uint16_t LEN, char const *reply);

    ---------------
    //File.c
    #include "File.h"
    #define Reply "OK"



    uint8_t CommandSenderCheckResponse(char const *message, uint16_t LEN, char const *reply);
    {       
    //something...
    }


    int main(void)
    {
    while(1)
    {
        CommandSenderCheckResponse("AT#TurnSomething=1", LEN, Reply);
    }
    }

how can I get the size for "AT#TurnSomething=1" ? for sure I am reinventing the wheel, what lib can you recommend to me to send generic AT commands a parse the responses from the module?

Regards


Solution

  • You do not need to use a library (more than the standard one) to get the length of a string.

    int length = strlen(message);