Skip to content

Jira 867, BLE setValue(), add support for strings, git #210 #461

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 3, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions libraries/CurieBLE/src/BLECharacteristic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,11 @@ bool BLECharacteristic::setValue(const unsigned char value[], unsigned short len
return writeValue(value, (int)length);
}

bool BLECharacteristic::setValue(const char* value)
{
return this->setValue((const unsigned char *)value, strlen(value));
}

bool BLECharacteristic::writeValue(const byte value[], int length)
{
return writeValue(value, length, 0);
Expand Down
9 changes: 9 additions & 0 deletions libraries/CurieBLE/src/BLECharacteristic.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,15 @@ class BLECharacteristic: public BLEAttributeWithValue
*/
bool setValue(const unsigned char value[], unsigned short length);

/**
* Set the current value of the Characteristic with a String
*
* @param value New string value to set, strings exceeding maxLength will be truncated
*
* @return bool true set value success, false on error
*/
bool setValue(const char* value);

/**
* @brief Write the value of the characteristic
*
Expand Down