7 years, 8 months ago.

How do I modify the advertising for the BLE uart service?

I am trying to make a function that initiates the BLE service, and I need the argument of this function to be a string, which will be the advertising name, so that the function call would look like this:

inicoms("advertising_name");

the prototype for this function is:

inicoms(char);

and the implementation (with the part of the original code i changed) is:

inicoms(char *name) {ble.accumulateAdvertisingPayload(GapAdvertisingData::SHORTENED_LOCAL_NAME, (const uint8_t *)name, strlen(name));}

but the compiler throws an error like this:

argument of type "const char*" incompatible with parameter of type "char" "inicoms("advertising_name");"

Any help would be greate!

1 Answer

7 years, 8 months ago.

Their is an error in your code, the type of a string literal in C++ is const char[] while in C it is char[].

Replace your prototype by inicoms(const char* name) and it should work for you.