Unsubscribe Method

Unsubscribes from value updates for one or more characteristics.

Syntax

ANSI (Cross Platform)
int Unsubscribe(const char* lpszServiceId, const char* lpszCharacteristicId);

Unicode (Windows)
INT Unsubscribe(LPCWSTR lpszServiceId, LPCWSTR lpszCharacteristicId);
#define MID_BLECLIENT_UNSUBSCRIBE 16

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

Remarks

This method will unsubscribe from value updates for the characteristic represented by CharacteristicId (which is owned by the service specified by ServiceId). The Unsubscribed event will fire each time you unsubscribe from a characteristic.

Passing empty string for CharacteristicId will cause the class to unsubscribe from any characteristic it is subscribed to in the specified service. Passing empty string for both parameters does the same, but for all services. (Unsubscribing en masse may take time since every subscribe/unsubscribe operation requires a write request and response behind the scenes.)

An error will be thrown if either of the given Ids are invalid (when both are passed), if only CharacteristicId is passed, if the characteristic does not support subscribing for updates, or if there is an issue while trying to unsubscribe.

Refer to the Subscribe method for more information.

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]