Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
8 years, 4 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
8 years, 4 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.