void ping_arduino(char* key) { // Declare a buffer to be used size_t buff_size; uint8_t *buffer; // Begin the write request, getting the buffer and its length smartstrap_attribute_begin_write(attribute, &buffer, &buff_size); // Store the data to be written to this attribute snprintf((char*)buffer, buff_size, key); // End the write request, and send the data, expecting a response SmartstrapResult r = smartstrap_attribute_end_write(attribute, strlen((char*)buffer), false); if(r != SmartstrapResultOk) { APP_LOG(APP_LOG_LEVEL_ERROR, "---Smartstrap error: %s", smartstrap_result_to_string(r)); } }
static void prv_set_led_attribute(bool on) { SmartstrapResult result; uint8_t *buffer; size_t length; result = smartstrap_attribute_begin_write(led_attribute, &buffer, &length); if (result != SmartstrapResultOk) { APP_LOG(APP_LOG_LEVEL_ERROR, "Begin write failed with error %d", result); return; } buffer[0] = on; result = smartstrap_attribute_end_write(led_attribute, 1, false); if (result != SmartstrapResultOk) { APP_LOG(APP_LOG_LEVEL_ERROR, "End write failed with error %d", result); return; } }