PostValue Method

Write the value of a characteristic without expecting a response.

Syntax

ANSI (Cross Platform)
int PostValue(const char* lpszServiceId, const char* lpszCharacteristicId, const char* lpValue, int lenValue);

Unicode (Windows)
INT PostValue(LPCWSTR lpszServiceId, LPCWSTR lpszCharacteristicId, LPCSTR lpValue, INT lenValue);
#define MID_BLECLIENT_POSTVALUE 10

IPWORKSBLE_EXTERNAL int IPWORKSBLE_CALL IPWorksBLE_BLEClient_Do(void *lpObj, int methid, int cparam, void *param[], int cbparam[], int64 *lpllVal);

Remarks

This method is used to write the value of a characteristic, but unlike WriteValue it instructs the server not to send a response, even if the write request fails. This method will return immediately after the request is sent, regardless of the current Timeout value.

If your use-case doesn't require confirmation of characteristic value writes, this method is preferred; it allows both devices (but especially the server) to save power by keeping the BLE radio hardware turned off.

If you do require confirmation of characteristic value writes, or need to write a descriptor's value, use the WriteValue method.

Posting Values

// The CC2650STK TI SensorTag doesn't have any characteristics which support
// write without response, so this is just an example.
bleclient1.PostValue("00AA00000000", "00AA00BB0000", new byte[] { 0x1, 0x2, 0x3 });

Error Handling (C++)

This method returns a result code; 0 indicates success, while a non-zero error code indicates that this method encountered an error during its execution. If an error occurs, the GetLastError() method can be called to retrieve the associated error message. (Note: This method's result code can also be obtained by calling the GetLastErrorCode() method after it returns.)

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks BLE 2020 C++ Edition - Version 20.0 [Build 8158]