address comment for objective c wdm
diff --git a/src/device-manager/cocoa/NLGenericTraitUpdatableDataSink.h b/src/device-manager/cocoa/NLGenericTraitUpdatableDataSink.h
index 8bf23d2..3b2bfd5 100644
--- a/src/device-manager/cocoa/NLGenericTraitUpdatableDataSink.h
+++ b/src/device-manager/cocoa/NLGenericTraitUpdatableDataSink.h
@@ -18,7 +18,8 @@
/**
* @file
- * This file defines NLGenericUpdatableDataSink interface
+ * This file defines NLGenericUpdatableDataSink interface.
+ * This is WEAVE_CONFIG_DATA_MANAGEMENT_EXPERIMENTAL feature.
*
*/
@@ -39,7 +40,7 @@
- (instancetype)init NS_UNAVAILABLE;
/**
- * convert weave error to string
+ * convert Weave error to string
*/
- (NSString *)toErrorString:(WEAVE_ERROR)err;
@@ -52,7 +53,8 @@
* Begins a sync of the trait data. The result of this operation can be observed through the CompletionHandler
* and failureHandler
*/
-- (void)refreshData:(GenericTraitUpdatableDataSinkCompletionBlock)completionHandler failure:(GenericTraitUpdatableDataSinkFailureBlock)failureHandler;
+- (void)refreshData:(GenericTraitUpdatableDataSinkCompletionBlock)completionHandler
+ failure:(GenericTraitUpdatableDataSinkFailureBlock)failureHandler;
/**
* Assigns the provided value to the given path as a signed integer value.
@@ -63,9 +65,7 @@
* version of the trait has modified this property and does not equal to required version from update,
* this update will be dropped; otherwise, this value will overwrite the newer change
*/
-- (WEAVE_ERROR)setSigned:(int64_t)val
- path:(NSString *)path
- conditional:(BOOL) isConditional;
+- (WEAVE_ERROR)setSigned:(int64_t)val path:(NSString *)path conditional:(BOOL)isConditional;
/**
* Assigns the provided value to the given path as an unsigned integer value.
@@ -76,9 +76,7 @@
* version of the trait has modified this property and does not equal to required version from update,
* this update will be dropped; otherwise, this value will overwrite the newer change
*/
-- (WEAVE_ERROR)setUnsigned:(uint64_t)val
- path:(NSString *)path
- conditional:(BOOL) isConditional;
+- (WEAVE_ERROR)setUnsigned:(uint64_t)val path:(NSString *)path conditional:(BOOL)isConditional;
/**
* Assigns the provided value to the given path.
@@ -89,9 +87,7 @@
* version of the trait has modified this property and does not equal to required version from update,
* this update will be dropped; otherwise, this value will overwrite the newer change
*/
-- (WEAVE_ERROR)setDouble:(double)val
- path:(NSString *)path
- conditional:(BOOL) isConditional;
+- (WEAVE_ERROR)setDouble:(double)val path:(NSString *)path conditional:(BOOL)isConditional;
/**
* Assigns the provided value to the given path.
@@ -102,9 +98,7 @@
* version of the trait has modified this property and does not equal to required version from update,
* this update will be dropped; otherwise, this value will overwrite the newer change
*/
-- (WEAVE_ERROR)setBoolean:(BOOL) val
- path:(NSString *)path
- conditional:(BOOL) isConditional;
+- (WEAVE_ERROR)setBoolean:(BOOL)val path:(NSString *)path conditional:(BOOL)isConditional;
/**
* Assigns the provided value to the given path.
@@ -115,9 +109,7 @@
* version of the trait has modified this property and does not equal to required version from update,
* this update will be dropped; otherwise, this value will overwrite the newer change
*/
-- (WEAVE_ERROR)setString:(NSString *) val
- path:(NSString *) path
- conditional:(BOOL) isConditional;
+- (WEAVE_ERROR)setString:(NSString *)val path:(NSString *)path conditional:(BOOL)isConditional;
/**
* Assigns Null to the given path.
@@ -127,8 +119,7 @@
* version of the trait has modified this property and does not equal to required version from update,
* this update will be dropped; otherwise, this value will overwrite the newer change
*/
-- (WEAVE_ERROR)setNull:(NSString *)path
- conditional:(BOOL) isConditional;
+- (WEAVE_ERROR)setNull:(NSString *)path conditional:(BOOL)isConditional;
/**
* Assigns the provided value to the given path.
@@ -139,9 +130,7 @@
* version of the trait has modified this property and does not equal to required version from update,
* this update will be dropped; otherwise, this value will overwrite the newer change
*/
-- (WEAVE_ERROR)setBytes:(NSData *) val
- path:(NSString *) path
- conditional:(BOOL) isConditional;
+- (WEAVE_ERROR)setBytes:(NSData *)val path:(NSString *)path conditional:(BOOL)isConditional;
/**
* Assigns the provided value to the given path.
@@ -152,9 +141,7 @@
* version of the trait has modified this property and does not equal to required version from update,
* this update will be dropped; otherwise, this value will overwrite the newer change
*/
-- (WEAVE_ERROR)setStringArray:(NSArray*)stringArray
- path:(NSString *) path
- conditional:(BOOL) isConditional;
+- (WEAVE_ERROR)setStringArray:(NSArray *)stringArray path:(NSString *)path conditional:(BOOL)isConditional;
/**
* Assigns the provided value to the given path as a signed integer value with unconditional capability
@@ -162,8 +149,7 @@
* @param path the proto path to the property to modify
* @param val the int64_t value to assign to the property
*/
-- (WEAVE_ERROR)setSigned:(int64_t)val
- path:(NSString *)path;
+- (WEAVE_ERROR)setSigned:(int64_t)val path:(NSString *)path;
/**
* Assigns the provided value to the given path as a signed integer value with unconditional capability
@@ -171,8 +157,7 @@
* @param path the proto path to the property to modify
* @param val the uint64_t value to assign to the property
*/
-- (WEAVE_ERROR)setUnsigned:(uint64_t)val
- path:(NSString *)path;
+- (WEAVE_ERROR)setUnsigned:(uint64_t)val path:(NSString *)path;
/**
* Assigns the provided value to the given path as a signed integer value with unconditional capability
@@ -180,8 +165,7 @@
* @param path the proto path to the property to modify
* @param val the double value to assign to the property
*/
-- (WEAVE_ERROR)setDouble:(double)val
- path:(NSString *)path;
+- (WEAVE_ERROR)setDouble:(double)val path:(NSString *)path;
/**
* Assigns the provided value to the given path as a signed integer value with unconditional capability
@@ -189,8 +173,7 @@
* @param path the proto path to the property to modify
* @param val the boolean value to assign to the property
*/
-- (WEAVE_ERROR)setBoolean:(BOOL) val
- path:(NSString *)path;
+- (WEAVE_ERROR)setBoolean:(BOOL)val path:(NSString *)path;
/**
* Assigns the provided value to the given path as a signed integer value with unconditional capability
@@ -198,8 +181,7 @@
* @param path the proto path to the property to modify
* @param val the String value to assign to the property
*/
-- (WEAVE_ERROR)setString:(NSString *) val
- path:(NSString *) path;
+- (WEAVE_ERROR)setString:(NSString *)val path:(NSString *)path;
/**
* Assigns Null to the given path with unconditional capability
@@ -214,8 +196,7 @@
* @param path the proto path to the property to modify
* @param val the bytes value to assign to the property
*/
-- (WEAVE_ERROR)setBytes:(NSData *) val
- path:(NSString *) path;
+- (WEAVE_ERROR)setBytes:(NSData *)val path:(NSString *)path;
/**
* Assigns the provided value to the given path with unconditional capability
@@ -223,32 +204,27 @@
* @param path the proto path to the property to modify
* @param val the string array to assign to the property
*/
-- (WEAVE_ERROR)setStringArray:(NSArray*)stringArray
- path:(NSString *) path;
+- (WEAVE_ERROR)setStringArray:(NSArray *)stringArray path:(NSString *)path;
/**
* Get the int64_t value assigned to the property at the given path within this trait.
*/
-- (WEAVE_ERROR)getSigned:(int64_t *)val
- path:(NSString *)path;
+- (WEAVE_ERROR)getSigned:(int64_t *)val path:(NSString *)path;
/**
* Get the uint64_t value assigned to the property at the given path within this trait.
*/
-- (WEAVE_ERROR)getUnsigned:(uint64_t *)val
- path:(NSString *)path;
+- (WEAVE_ERROR)getUnsigned:(uint64_t *)val path:(NSString *)path;
/**
* Get the double value assigned to the property at the given path within this trait.
*/
-- (WEAVE_ERROR)getDouble:(double *)val
- path:(NSString *)path;
+- (WEAVE_ERROR)getDouble:(double *)val path:(NSString *)path;
/**
* Get the boolean value assigned to the property at the given path within this trait.
*/
-- (WEAVE_ERROR)getBoolean:(BOOL *)val
- path:(NSString *)path;
+- (WEAVE_ERROR)getBoolean:(BOOL *)val path:(NSString *)path;
/**
* Get the string value assigned to the property at the given path within this trait.
@@ -263,8 +239,7 @@
/**
* Check if null property at the given path within this trait.
*/
-- (WEAVE_ERROR)isNull:(BOOL *)val
- path:(NSString *)path;
+- (WEAVE_ERROR)isNull:(BOOL *)val path:(NSString *)path;
/**
* Get the string array value assigned to the property at the given path within this trait.
diff --git a/src/device-manager/cocoa/NLGenericTraitUpdatableDataSink.mm b/src/device-manager/cocoa/NLGenericTraitUpdatableDataSink.mm
index d6e9333..836affc 100644
--- a/src/device-manager/cocoa/NLGenericTraitUpdatableDataSink.mm
+++ b/src/device-manager/cocoa/NLGenericTraitUpdatableDataSink.mm
@@ -18,7 +18,8 @@
/**
* @file
- * This file implements NLGenericTraitUpdatableDataSink interface
+ * This file implements NLGenericTraitUpdatableDataSink interface.
+ * This is WEAVE_CONFIG_DATA_MANAGEMENT_EXPERIMENTAL feature.
*
*/
@@ -91,10 +92,10 @@
}
- (instancetype)init:(NSString *)name
- weaveWorkQueue:(dispatch_queue_t)weaveWorkQueue
- appCallbackQueue:(dispatch_queue_t)appCallbackQueue
- genericTraitUpdatableDataSinkPtr: (nl::Weave::DeviceManager::GenericTraitUpdatableDataSink *)dataSinkPtr
- nlWdmClient:(NLWdmClient *)nlWdmClient
+ weaveWorkQueue:(dispatch_queue_t)weaveWorkQueue
+ appCallbackQueue:(dispatch_queue_t)appCallbackQueue
+ genericTraitUpdatableDataSinkPtr:(nl::Weave::DeviceManager::GenericTraitUpdatableDataSink *)dataSinkPtr
+ nlWdmClient:(NLWdmClient *)nlWdmClient
{
WEAVE_ERROR err = WEAVE_NO_ERROR;
@@ -135,8 +136,8 @@
[sink DispatchAsyncCompletionBlock:nil];
}
-static void handleGenericUpdatableDataSinkError(void * dataSink, void * appReqState, WEAVE_ERROR code,
- nl::Weave::DeviceManager::DeviceStatus * devStatus)
+static void handleGenericUpdatableDataSinkError(
+ void * dataSink, void * appReqState, WEAVE_ERROR code, nl::Weave::DeviceManager::DeviceStatus * devStatus)
{
WDM_LOG_DEBUG(@"handleGenericUpdatableDataSinkError");
@@ -144,7 +145,7 @@
NSDictionary * userInfo = nil;
NLGenericTraitUpdatableDataSink * nlDataSink = (__bridge NLGenericTraitUpdatableDataSink *) appReqState;
- // ignore the pointer to C++ device manager
+ // ignore the pointer to C++ GenericTraitUpdatableDataSink
(void) dataSink;
WDM_LOG_DEBUG(@"%@: Received error response to request %@, wdmClientErr = %d, devStatus = %p\n", nlDataSink.name,
@@ -158,14 +159,14 @@
errorCode:devStatus->SystemErrorCode
statusReport:[nlDataSink statusReportToString:devStatus->StatusProfileId statusCode:devStatus->StatusCode]];
requestError = NLWeaveRequestError_ProfileStatusError;
- userInfo = @{ @"WeaveRequestErrorType" : @(requestError), @"errorInfo" : statusError };
+ userInfo = @{@"WeaveRequestErrorType" : @(requestError), @"errorInfo" : statusError};
WDM_LOG_DEBUG(@"%@: status error: %@", nlDataSink.name, userInfo);
} else {
NLWeaveError * weaveError = [[NLWeaveError alloc] initWithWeaveError:code
report:[NSString stringWithUTF8String:nl::ErrorStr(code)]];
requestError = NLWeaveRequestError_WeaveError;
- userInfo = @{ @"WeaveRequestErrorType" : @(requestError), @"errorInfo" : weaveError };
+ userInfo = @{@"WeaveRequestErrorType" : @(requestError), @"errorInfo" : weaveError};
}
error = [NSError errorWithDomain:@"com.nest.error" code:code userInfo:userInfo];
@@ -185,7 +186,9 @@
return _mRequestName;
}
-- (void)DispatchAsyncFailureBlock:(WEAVE_ERROR)code taskName:(NSString *)taskName handler:(GenericTraitUpdatableDataSinkFailureBlock)handler
+- (void)DispatchAsyncFailureBlock:(WEAVE_ERROR)code
+ taskName:(NSString *)taskName
+ handler:(GenericTraitUpdatableDataSinkFailureBlock)handler
{
NSError * error =
[NSError errorWithDomain:@"com.nest.error"
@@ -195,7 +198,9 @@
[self DispatchAsyncFailureBlockWithError:error taskName:taskName handler:handler];
}
-- (void)DispatchAsyncFailureBlockWithError:(NSError *)error taskName:(NSString *)taskName handler:(GenericTraitUpdatableDataSinkFailureBlock)handler
+- (void)DispatchAsyncFailureBlockWithError:(NSError *)error
+ taskName:(NSString *)taskName
+ handler:(GenericTraitUpdatableDataSinkFailureBlock)handler
{
if (NULL != handler) {
// we use async because we don't need to wait for completion of this final completion report
@@ -279,14 +284,12 @@
{
WDM_LOG_METHOD_SIG();
- if (_mNLWdmClient != nil)
- {
- [_mNLWdmClient removeDataSinkRef:(long long)_mWeaveCppGenericTraitUpdatableDataSink ];
+ if (_mNLWdmClient != nil) {
+ [_mNLWdmClient removeDataSinkRef:(long long) _mWeaveCppGenericTraitUpdatableDataSink];
_mNLWdmClient = nil;
}
- if (_mWeaveCppGenericTraitUpdatableDataSink != nil)
- {
+ if (_mWeaveCppGenericTraitUpdatableDataSink != nil) {
_mWeaveCppGenericTraitUpdatableDataSink->Clear();
}
}
@@ -301,11 +304,11 @@
- (void)clear
{
__block WEAVE_ERROR err = WEAVE_NO_ERROR;
-
+
WDM_LOG_METHOD_SIG();
-
- VerifyOrExit(NULL !=_mWeaveCppGenericTraitUpdatableDataSink, err = WEAVE_ERROR_INCORRECT_STATE);
-
+
+ VerifyOrExit(NULL != _mWeaveCppGenericTraitUpdatableDataSink, err = WEAVE_ERROR_INCORRECT_STATE);
+
// need this bracket to use Verify macros
{
// we use sync so the result is immediately available to the caller upon return
@@ -317,7 +320,8 @@
return;
}
-- (void)refreshData:(GenericTraitUpdatableDataSinkCompletionBlock)completionHandler failure:(GenericTraitUpdatableDataSinkFailureBlock)failureHandler
+- (void)refreshData:(GenericTraitUpdatableDataSinkCompletionBlock)completionHandler
+ failure:(GenericTraitUpdatableDataSinkFailureBlock)failureHandler
{
WDM_LOG_METHOD_SIG();
@@ -330,7 +334,8 @@
_mCompletionHandler = [completionHandler copy];
_mFailureHandler = [failureHandler copy];
- WEAVE_ERROR err = _mWeaveCppGenericTraitUpdatableDataSink->RefreshData((__bridge void *) self, handleGenericUpdatableDataSinkComplete, handleGenericUpdatableDataSinkError);
+ WEAVE_ERROR err = _mWeaveCppGenericTraitUpdatableDataSink->RefreshData(
+ (__bridge void *) self, handleGenericUpdatableDataSinkComplete, handleGenericUpdatableDataSinkError);
if (WEAVE_NO_ERROR != err) {
[self DispatchAsyncDefaultFailureBlockWithCode:err];
@@ -344,16 +349,14 @@
});
}
-- (WEAVE_ERROR)setSigned:(int64_t)val
- path:(NSString *)path
- conditional:(BOOL) isConditional
+- (WEAVE_ERROR)setSigned:(int64_t)val path:(NSString *)path conditional:(BOOL)isConditional
{
__block WEAVE_ERROR err = WEAVE_NO_ERROR;
__block bool isConditionalBool = isConditional;
WDM_LOG_METHOD_SIG();
- VerifyOrExit(NULL !=_mWeaveCppGenericTraitUpdatableDataSink, err = WEAVE_ERROR_INCORRECT_STATE);
+ VerifyOrExit(NULL != _mWeaveCppGenericTraitUpdatableDataSink, err = WEAVE_ERROR_INCORRECT_STATE);
// need this bracket to use Verify macros
{
@@ -372,16 +375,14 @@
return err;
}
-- (WEAVE_ERROR)setUnsigned:(uint64_t)val
- path:(NSString *)path
- conditional:(BOOL) isConditional
+- (WEAVE_ERROR)setUnsigned:(uint64_t)val path:(NSString *)path conditional:(BOOL)isConditional
{
__block WEAVE_ERROR err = WEAVE_NO_ERROR;
__block bool isConditionalBool = isConditional;
WDM_LOG_METHOD_SIG();
- VerifyOrExit(NULL !=_mWeaveCppGenericTraitUpdatableDataSink, err = WEAVE_ERROR_INCORRECT_STATE);
+ VerifyOrExit(NULL != _mWeaveCppGenericTraitUpdatableDataSink, err = WEAVE_ERROR_INCORRECT_STATE);
// need this bracket to use Verify macros
{
@@ -401,16 +402,14 @@
return err;
}
-- (WEAVE_ERROR)setDouble:(double)val
- path:(NSString *)path
- conditional:(BOOL) isConditional
+- (WEAVE_ERROR)setDouble:(double)val path:(NSString *)path conditional:(BOOL)isConditional
{
__block WEAVE_ERROR err = WEAVE_NO_ERROR;
__block bool isConditionalBool = isConditional;
WDM_LOG_METHOD_SIG();
- VerifyOrExit(NULL !=_mWeaveCppGenericTraitUpdatableDataSink, err = WEAVE_ERROR_INCORRECT_STATE);
+ VerifyOrExit(NULL != _mWeaveCppGenericTraitUpdatableDataSink, err = WEAVE_ERROR_INCORRECT_STATE);
// need this bracket to use Verify macros
{
@@ -429,16 +428,14 @@
return err;
}
-- (WEAVE_ERROR)setBoolean:(BOOL) val
- path:(NSString *)path
- conditional:(BOOL) isConditional
+- (WEAVE_ERROR)setBoolean:(BOOL)val path:(NSString *)path conditional:(BOOL)isConditional
{
__block WEAVE_ERROR err = WEAVE_NO_ERROR;
__block bool isConditionalBool = isConditional;
- __block bool valBool= val;
+ __block bool valBool = val;
WDM_LOG_METHOD_SIG();
- VerifyOrExit(NULL !=_mWeaveCppGenericTraitUpdatableDataSink, err = WEAVE_ERROR_INCORRECT_STATE);
+ VerifyOrExit(NULL != _mWeaveCppGenericTraitUpdatableDataSink, err = WEAVE_ERROR_INCORRECT_STATE);
// need this bracket to use Verify macros
{
@@ -456,9 +453,7 @@
return err;
}
-- (WEAVE_ERROR)setString:(NSString *) val
- path:(NSString *) path
- conditional:(BOOL) isConditional
+- (WEAVE_ERROR)setString:(NSString *)val path:(NSString *)path conditional:(BOOL)isConditional
{
__block WEAVE_ERROR err = WEAVE_NO_ERROR;
__block bool isConditionalBool = isConditional;
@@ -483,15 +478,14 @@
return err;
}
-- (WEAVE_ERROR)setNull:(NSString *)path
- conditional:(BOOL) isConditional
+- (WEAVE_ERROR)setNull:(NSString *)path conditional:(BOOL)isConditional
{
__block WEAVE_ERROR err = WEAVE_NO_ERROR;
__block bool isConditionalBool = isConditional;
WDM_LOG_METHOD_SIG();
- VerifyOrExit(NULL !=_mWeaveCppGenericTraitUpdatableDataSink, err = WEAVE_ERROR_INCORRECT_STATE);
+ VerifyOrExit(NULL != _mWeaveCppGenericTraitUpdatableDataSink, err = WEAVE_ERROR_INCORRECT_STATE);
// need this bracket to use Verify macros
{
@@ -510,22 +504,19 @@
return err;
}
-- (WEAVE_ERROR)setBytes:(NSData *) val
- path:(NSString *) path
- conditional:(BOOL) isConditional
+- (WEAVE_ERROR)setBytes:(NSData *)val path:(NSString *)path conditional:(BOOL)isConditional
{
__block WEAVE_ERROR err = WEAVE_NO_ERROR;
- __block bool isConditionalBool= isConditional;
+ __block bool isConditionalBool = isConditional;
WDM_LOG_METHOD_SIG();
- VerifyOrExit(NULL !=_mWeaveCppGenericTraitUpdatableDataSink, err = WEAVE_ERROR_INCORRECT_STATE);
+ VerifyOrExit(NULL != _mWeaveCppGenericTraitUpdatableDataSink, err = WEAVE_ERROR_INCORRECT_STATE);
// need this bracket to use Verify macros
{
// we use sync so the result is immediately available to the caller upon return
dispatch_sync(_mWeaveWorkQueue, ^() {
-
uint32_t valLen = (uint32_t)[val length];
uint8_t * pVal = (uint8_t *) [val bytes];
err = _mWeaveCppGenericTraitUpdatableDataSink->SetBytes([path UTF8String], pVal, valLen, isConditionalBool);
@@ -541,21 +532,18 @@
return err;
}
-- (WEAVE_ERROR)setStringArray:(NSArray*)stringArray
- path:(NSString *) path
- conditional:(BOOL) isConditional
+- (WEAVE_ERROR)setStringArray:(NSArray *)stringArray path:(NSString *)path conditional:(BOOL)isConditional
{
__block WEAVE_ERROR err = WEAVE_NO_ERROR;
- __block bool isConditionalBool= isConditional;
+ __block bool isConditionalBool = isConditional;
std::vector<std::string> stringVector;
WDM_LOG_METHOD_SIG();
- VerifyOrExit(NULL !=_mWeaveCppGenericTraitUpdatableDataSink, err = WEAVE_ERROR_INCORRECT_STATE);
+ VerifyOrExit(NULL != _mWeaveCppGenericTraitUpdatableDataSink, err = WEAVE_ERROR_INCORRECT_STATE);
- for (id object in stringArray)
- {
+ for (id object in stringArray) {
stringVector.push_back(std::string([object UTF8String]));
}
// need this bracket to use Verify macros
@@ -574,64 +562,56 @@
return err;
}
-- (WEAVE_ERROR)setSigned:(int64_t)val
- path:(NSString *)path
+- (WEAVE_ERROR)setSigned:(int64_t)val path:(NSString *)path
{
- return [self setSigned:val path:path conditional: NO];
+ return [self setSigned:val path:path conditional:NO];
}
-- (WEAVE_ERROR)setUnsigned:(uint64_t)val
- path:(NSString *)path
+- (WEAVE_ERROR)setUnsigned:(uint64_t)val path:(NSString *)path
{
- return [self setUnsigned:val path:path conditional: NO];
+ return [self setUnsigned:val path:path conditional:NO];
}
-- (WEAVE_ERROR)setDouble:(double)val
- path:(NSString *)path
+- (WEAVE_ERROR)setDouble:(double)val path:(NSString *)path
{
- return [self setDouble:val path:path conditional: NO];
+ return [self setDouble:val path:path conditional:NO];
}
-- (WEAVE_ERROR)setBoolean:(BOOL) val
- path:(NSString *)path
+- (WEAVE_ERROR)setBoolean:(BOOL)val path:(NSString *)path
{
- return [self setBoolean:val path:path conditional: NO];
+ return [self setBoolean:val path:path conditional:NO];
}
-- (WEAVE_ERROR)setString:(NSString *) val
- path:(NSString *) path
+- (WEAVE_ERROR)setString:(NSString *)val path:(NSString *)path
{
- return [self setString:val path:path conditional: NO];
+ return [self setString:val path:path conditional:NO];
}
- (WEAVE_ERROR)setNull:(NSString *)path
{
- return [self setNull:path conditional: NO];
+ return [self setNull:path conditional:NO];
}
-- (WEAVE_ERROR)setBytes:(NSData *) val
- path:(NSString *) path
+- (WEAVE_ERROR)setBytes:(NSData *)val path:(NSString *)path
{
- return [self setBytes:val path:path conditional: NO];
+ return [self setBytes:val path:path conditional:NO];
}
-- (WEAVE_ERROR)setStringArray:(NSArray*)stringArray
- path:(NSString *) path
+- (WEAVE_ERROR)setStringArray:(NSArray *)stringArray path:(NSString *)path
{
- return [self setStringArray:stringArray path:path conditional: NO];
+ return [self setStringArray:stringArray path:path conditional:NO];
}
-- (WEAVE_ERROR)getSigned:(int64_t *)val
- path:(NSString *)path
+- (WEAVE_ERROR)getSigned:(int64_t *)val path:(NSString *)path
{
__block WEAVE_ERROR err = WEAVE_NO_ERROR;
__block int64_t result = 0;
WDM_LOG_METHOD_SIG();
- VerifyOrExit(NULL !=_mWeaveCppGenericTraitUpdatableDataSink, err = WEAVE_ERROR_INCORRECT_STATE);
+ VerifyOrExit(NULL != _mWeaveCppGenericTraitUpdatableDataSink, err = WEAVE_ERROR_INCORRECT_STATE);
VerifyOrExit(NULL != val, err = WEAVE_ERROR_INVALID_ARGUMENT);
// need this bracket to use Verify macros
@@ -657,15 +637,14 @@
return err;
}
-- (WEAVE_ERROR)getUnsigned:(uint64_t *)val
- path:(NSString *)path
+- (WEAVE_ERROR)getUnsigned:(uint64_t *)val path:(NSString *)path
{
__block WEAVE_ERROR err = WEAVE_NO_ERROR;
__block uint64_t result = 0;
WDM_LOG_METHOD_SIG();
- VerifyOrExit(NULL !=_mWeaveCppGenericTraitUpdatableDataSink, err = WEAVE_ERROR_INCORRECT_STATE);
+ VerifyOrExit(NULL != _mWeaveCppGenericTraitUpdatableDataSink, err = WEAVE_ERROR_INCORRECT_STATE);
VerifyOrExit(NULL != val, err = WEAVE_ERROR_INVALID_ARGUMENT);
// need this bracket to use Verify macros
@@ -691,15 +670,14 @@
return err;
}
-- (WEAVE_ERROR)getDouble:(double *)val
- path:(NSString *)path
+- (WEAVE_ERROR)getDouble:(double *)val path:(NSString *)path
{
__block WEAVE_ERROR err = WEAVE_NO_ERROR;
__block double result = 0;
WDM_LOG_METHOD_SIG();
- VerifyOrExit(NULL !=_mWeaveCppGenericTraitUpdatableDataSink, err = WEAVE_ERROR_INCORRECT_STATE);
+ VerifyOrExit(NULL != _mWeaveCppGenericTraitUpdatableDataSink, err = WEAVE_ERROR_INCORRECT_STATE);
VerifyOrExit(NULL != val, err = WEAVE_ERROR_INVALID_ARGUMENT);
// need this bracket to use Verify macros
@@ -725,15 +703,14 @@
return err;
}
-- (WEAVE_ERROR)getBoolean:(BOOL *)val
- path:(NSString *)path
+- (WEAVE_ERROR)getBoolean:(BOOL *)val path:(NSString *)path
{
__block WEAVE_ERROR err = WEAVE_NO_ERROR;
__block bool result = false;
WDM_LOG_METHOD_SIG();
- VerifyOrExit(NULL !=_mWeaveCppGenericTraitUpdatableDataSink, err = WEAVE_ERROR_INCORRECT_STATE);
+ VerifyOrExit(NULL != _mWeaveCppGenericTraitUpdatableDataSink, err = WEAVE_ERROR_INCORRECT_STATE);
VerifyOrExit(NULL != val, err = WEAVE_ERROR_INVALID_ARGUMENT);
// need this bracket to use Verify macros
@@ -761,17 +738,16 @@
- (NSString *)getString:(NSString *)path
{
__block WEAVE_ERROR err = WEAVE_NO_ERROR;
- __block nl::Weave::DeviceManager::BytesData bytesData;
+ __block nl::Weave::DeviceManager::BytesData bytesData;
NSString * result = nil;
WDM_LOG_METHOD_SIG();
- VerifyOrExit(NULL !=_mWeaveCppGenericTraitUpdatableDataSink, err = WEAVE_ERROR_INCORRECT_STATE);
+ VerifyOrExit(NULL != _mWeaveCppGenericTraitUpdatableDataSink, err = WEAVE_ERROR_INCORRECT_STATE);
// need this bracket to use Verify macros
{
// we use sync so the result is immediately available to the caller upon return
dispatch_sync(_mWeaveWorkQueue, ^() {
-
err = _mWeaveCppGenericTraitUpdatableDataSink->GetBytes([path UTF8String], &bytesData);
if (err == WEAVE_ERROR_INCORRECT_STATE) {
@@ -781,59 +757,57 @@
}
});
}
- result = [[NSString alloc]initWithBytes:bytesData.mpDataBuf length:bytesData.mDataLen encoding:NSUTF8StringEncoding];
+ result = [[NSString alloc] initWithBytes:bytesData.mpDataBuf length:bytesData.mDataLen encoding:NSUTF8StringEncoding];
exit:
return result;
}
-- (WEAVE_ERROR)isNull:(BOOL *)val
- path:(NSString *)path;
+- (WEAVE_ERROR)isNull:(BOOL *)val path:(NSString *)path;
{
__block WEAVE_ERROR err = WEAVE_NO_ERROR;
__block bool result = false;
-
+
WDM_LOG_METHOD_SIG();
-
- VerifyOrExit(NULL !=_mWeaveCppGenericTraitUpdatableDataSink, err = WEAVE_ERROR_INCORRECT_STATE);
+
+ VerifyOrExit(NULL != _mWeaveCppGenericTraitUpdatableDataSink, err = WEAVE_ERROR_INCORRECT_STATE);
VerifyOrExit(NULL != val, err = WEAVE_ERROR_INVALID_ARGUMENT);
-
+
// need this bracket to use Verify macros
{
// we use sync so the result is immediately available to the caller upon return
dispatch_sync(_mWeaveWorkQueue, ^() {
err = _mWeaveCppGenericTraitUpdatableDataSink->IsNull([path UTF8String], result);
-
+
if (err == WEAVE_ERROR_INCORRECT_STATE) {
WDM_LOG_DEBUG(@"Got incorrect state error from isNull, ignore");
-
+
err = WEAVE_NO_ERROR; // No exception, just return 0.
}
});
}
-
+
exit:
if ((WEAVE_NO_ERROR == err) && (NULL != val)) {
*val = result;
}
-
+
return err;
}
- (NSData *)getBytes:(NSString *)path
{
__block WEAVE_ERROR err = WEAVE_NO_ERROR;
- __block nl::Weave::DeviceManager::BytesData bytesData;
+ __block nl::Weave::DeviceManager::BytesData bytesData;
NSData * result = nil;
WDM_LOG_METHOD_SIG();
- VerifyOrExit(NULL !=_mWeaveCppGenericTraitUpdatableDataSink, err = WEAVE_ERROR_INCORRECT_STATE);
+ VerifyOrExit(NULL != _mWeaveCppGenericTraitUpdatableDataSink, err = WEAVE_ERROR_INCORRECT_STATE);
// need this bracket to use Verify macros
{
// we use sync so the result is immediately available to the caller upon return
dispatch_sync(_mWeaveWorkQueue, ^() {
-
err = _mWeaveCppGenericTraitUpdatableDataSink->GetBytes([path UTF8String], &bytesData);
if (err == WEAVE_ERROR_INCORRECT_STATE) {
@@ -853,11 +827,11 @@
{
__block WEAVE_ERROR err = WEAVE_NO_ERROR;
__block std::vector<std::string> stringVector;
- NSMutableArray *arrayOut = [[NSMutableArray alloc] init];
+ NSMutableArray * arrayOut = [[NSMutableArray alloc] init];
WDM_LOG_METHOD_SIG();
- VerifyOrExit(NULL !=_mWeaveCppGenericTraitUpdatableDataSink, err = WEAVE_ERROR_INCORRECT_STATE);
+ VerifyOrExit(NULL != _mWeaveCppGenericTraitUpdatableDataSink, err = WEAVE_ERROR_INCORRECT_STATE);
// need this bracket to use Verify macros
{
@@ -873,8 +847,7 @@
});
}
- for (auto iter = stringVector.begin(); iter < stringVector.end(); iter++)
- {
+ for (auto iter = stringVector.begin(); iter < stringVector.end(); iter++) {
[arrayOut addObject:[NSString stringWithCString:iter->c_str() encoding:[NSString defaultCStringEncoding]]];
}
@@ -889,7 +862,7 @@
WDM_LOG_METHOD_SIG();
- VerifyOrExit(NULL !=_mWeaveCppGenericTraitUpdatableDataSink, err = WEAVE_ERROR_INCORRECT_STATE);
+ VerifyOrExit(NULL != _mWeaveCppGenericTraitUpdatableDataSink, err = WEAVE_ERROR_INCORRECT_STATE);
VerifyOrExit(NULL != val, err = WEAVE_ERROR_INVALID_ARGUMENT);
// need this bracket to use Verify macros
diff --git a/src/device-manager/cocoa/NLGenericTraitUpdatableDataSink_Protected.h b/src/device-manager/cocoa/NLGenericTraitUpdatableDataSink_Protected.h
index f8c3a03..510c764 100644
--- a/src/device-manager/cocoa/NLGenericTraitUpdatableDataSink_Protected.h
+++ b/src/device-manager/cocoa/NLGenericTraitUpdatableDataSink_Protected.h
@@ -18,7 +18,8 @@
/**
* @file
- * This file provides defines non-public portion of NLGenericUpdatableDataSink interface
+ * This file provides defines non-public portion of NLGenericUpdatableDataSink interface.
+ * This is WEAVE_CONFIG_DATA_MANAGEMENT_EXPERIMENTAL feature.
*
*/
@@ -28,10 +29,10 @@
#if WEAVE_CONFIG_DATA_MANAGEMENT_CLIENT_EXPERIMENTAL
@interface NLGenericTraitUpdatableDataSink ()
- (instancetype)init:(NSString *)name
- weaveWorkQueue:(dispatch_queue_t)weaveWorkQueue
- appCallbackQueue:(dispatch_queue_t)appCallbackQueue
- genericTraitUpdatableDataSinkPtr: (nl::Weave::DeviceManager::GenericTraitUpdatableDataSink *)dataSinkPtr
- nlWdmClient:(NLWdmClient *)nlWdmClient NS_DESIGNATED_INITIALIZER;
+ weaveWorkQueue:(dispatch_queue_t)weaveWorkQueue
+ appCallbackQueue:(dispatch_queue_t)appCallbackQueue
+ genericTraitUpdatableDataSinkPtr:(nl::Weave::DeviceManager::GenericTraitUpdatableDataSink *)dataSinkPtr
+ nlWdmClient:(NLWdmClient *)nlWdmClient NS_DESIGNATED_INITIALIZER;
- (NSString *)statusReportToString:(NSUInteger)profileId statusCode:(NSInteger)statusCode;
/**
diff --git a/src/device-manager/cocoa/NLResourceIdentifier.h b/src/device-manager/cocoa/NLResourceIdentifier.h
index c451056..ecd2c69 100644
--- a/src/device-manager/cocoa/NLResourceIdentifier.h
+++ b/src/device-manager/cocoa/NLResourceIdentifier.h
@@ -30,6 +30,5 @@
@property (nonatomic) uint64_t ResourceId;
- (instancetype)init NS_DESIGNATED_INITIALIZER;
-- (instancetype)initWithType:(int32_t)type
- id:(uint64_t)idValue;
+- (instancetype)initWithType:(int32_t)type id:(uint64_t)idValue;
@end
diff --git a/src/device-manager/cocoa/NLResourceIdentifier.mm b/src/device-manager/cocoa/NLResourceIdentifier.mm
index b2276a0..704a7e6 100644
--- a/src/device-manager/cocoa/NLResourceIdentifier.mm
+++ b/src/device-manager/cocoa/NLResourceIdentifier.mm
@@ -34,8 +34,7 @@
return self = [self initWithType:RESOURCE_TYPE_RESERVED id:SELF_NODE_ID];
}
-- (instancetype)initWithType:(int32_t)type
- id:(uint64_t)idValue
+- (instancetype)initWithType:(int32_t)type id:(uint64_t)idValue
{
if (self = [super init]) {
diff --git a/src/device-manager/cocoa/NLWdmClient.h b/src/device-manager/cocoa/NLWdmClient.h
index 0e44fce..bd77c43 100644
--- a/src/device-manager/cocoa/NLWdmClient.h
+++ b/src/device-manager/cocoa/NLWdmClient.h
@@ -18,7 +18,8 @@
/**
* @file
- * This file defines NLWdmClient interface
+ * This file defines NLWdmClient interface.
+ * This is WEAVE_CONFIG_DATA_MANAGEMENT_EXPERIMENTAL feature.
*
*/
@@ -41,20 +42,19 @@
- (instancetype)init NS_UNAVAILABLE;
/**
- * @brief Forcifully release all resources and destroy all references.
+ * @brief Forcefully release all resources and destroy all references.
*
- * There is no way to revive this device manager after this call.
+ * There is no way to revive this WDMClient after this call.
*/
- (void)close:(WdmClientCompletionBlock)completionHandler;
-
// ----- Error Logging -----
- (NSString *)toErrorString:(WEAVE_ERROR)err;
/**
- * set weave node id in trait catalog in WdmClient
+ * set Weave node ID in trait catalog in WdmClient
*
- * @param nodeId weave node id
+ * @param nodeId Weave node ID
*
*/
- (void *)setNodeId:(uint64_t)nodeId;
@@ -62,23 +62,22 @@
/**
* Create the new data newDataSink
*
- * @param nlResourceIdentifier resource id is a globally-unique identifier for a Weave/phoenix resource
+ * @param nlResourceIdentifier resource id is a globally-unique identifier for a Weave resource
* @param profileId trait profile id
* @param instanceId trait instance id
* @param path trait path
*
*/
- (NLGenericTraitUpdatableDataSink *)newDataSink:(NLResourceIdentifier *)nlResourceIdentifier
- profileId: (uint32_t)profileId
- instanceId: (uint64_t)instanceId
- path: (NSString *)path;
+ profileId:(uint32_t)profileId
+ instanceId:(uint64_t)instanceId
+ path:(NSString *)path;
/**
* Begins a flush of all trait data. The result of this operation can be observed through the CompletionHandler and
* failureHandler
*/
-- (void)flushUpdate:(WdmClientCompletionBlock)completionHandler
- failure:(WdmClientFailureBlock)failureHandler;
+- (void)flushUpdate:(WdmClientCompletionBlock)completionHandler failure:(WdmClientFailureBlock)failureHandler;
/**
* Begins a sync of all trait data. The result of this operation can be observed through the CompletionHandler and
@@ -87,4 +86,3 @@
- (void)refreshData:(WdmClientCompletionBlock)completionHandler failure:(WdmClientFailureBlock)failureHandler;
@end
-
diff --git a/src/device-manager/cocoa/NLWdmClient.mm b/src/device-manager/cocoa/NLWdmClient.mm
index 7d82c94..fffdf8e 100644
--- a/src/device-manager/cocoa/NLWdmClient.mm
+++ b/src/device-manager/cocoa/NLWdmClient.mm
@@ -18,7 +18,8 @@
/**
* @file
- * This file implements NLWdmClient interface
+ * This file implements NLWdmClient interface.
+ * This is WEAVE_CONFIG_DATA_MANAGEMENT_EXPERIMENTAL feature.
*
*/
@@ -51,37 +52,36 @@
using namespace nl::Weave::Profiles::DataManagement;
#if WEAVE_CONFIG_DATA_MANAGEMENT_CLIENT_EXPERIMENTAL
-static void bindingEventCallback (void * const apAppState, const nl::Weave::Binding::EventType aEvent,
- const nl::Weave::Binding::InEventParam & aInParam, nl::Weave::Binding::OutEventParam & aOutParam);
+static void bindingEventCallback(void * const apAppState, const nl::Weave::Binding::EventType aEvent,
+ const nl::Weave::Binding::InEventParam & aInParam, nl::Weave::Binding::OutEventParam & aOutParam);
-void bindingEventCallback (void * const apAppState, const nl::Weave::Binding::EventType aEvent,
- const nl::Weave::Binding::InEventParam & aInParam, nl::Weave::Binding::OutEventParam & aOutParam)
+void bindingEventCallback(void * const apAppState, const nl::Weave::Binding::EventType aEvent,
+ const nl::Weave::Binding::InEventParam & aInParam, nl::Weave::Binding::OutEventParam & aOutParam)
{
WDM_LOG_DEBUG(@"%s: Event(%d)", __func__, aEvent);
- switch (aEvent)
- {
- case nl::Weave::Binding::kEvent_PrepareRequested:
- WDM_LOG_DEBUG(@"kEvent_PrepareRequested");
- break;
+ switch (aEvent) {
+ case nl::Weave::Binding::kEvent_PrepareRequested:
+ WDM_LOG_DEBUG(@"kEvent_PrepareRequested");
+ break;
- case nl::Weave::Binding::kEvent_PrepareFailed:
- WDM_LOG_DEBUG(@"kEvent_PrepareFailed: reason %s", ::nl::ErrorStr(aInParam.PrepareFailed.Reason));
- break;
+ case nl::Weave::Binding::kEvent_PrepareFailed:
+ WDM_LOG_DEBUG(@"kEvent_PrepareFailed: reason %s", ::nl::ErrorStr(aInParam.PrepareFailed.Reason));
+ break;
- case nl::Weave::Binding::kEvent_BindingFailed:
- WDM_LOG_DEBUG(@"kEvent_BindingFailed: reason %s", ::nl::ErrorStr(aInParam.PrepareFailed.Reason));
- break;
+ case nl::Weave::Binding::kEvent_BindingFailed:
+ WDM_LOG_DEBUG(@"kEvent_BindingFailed: reason %s", ::nl::ErrorStr(aInParam.PrepareFailed.Reason));
+ break;
- case nl::Weave::Binding::kEvent_BindingReady:
- WDM_LOG_DEBUG(@"kEvent_BindingReady");
- break;
+ case nl::Weave::Binding::kEvent_BindingReady:
+ WDM_LOG_DEBUG(@"kEvent_BindingReady");
+ break;
- case nl::Weave::Binding::kEvent_DefaultCheck:
- WDM_LOG_DEBUG(@"kEvent_DefaultCheck");
- // fall through
- default:
- nl::Weave::Binding::DefaultEventHandler(apAppState, aEvent, aInParam, aOutParam);
+ case nl::Weave::Binding::kEvent_DefaultCheck:
+ WDM_LOG_DEBUG(@"kEvent_DefaultCheck");
+ // fall through
+ default:
+ nl::Weave::Binding::DefaultEventHandler(apAppState, aEvent, aInParam, aOutParam);
}
}
@@ -126,11 +126,11 @@
}
- (instancetype)init:(NSString *)name
- weaveWorkQueue:(dispatch_queue_t)weaveWorkQueue
- appCallbackQueue:(dispatch_queue_t)appCallbackQueue
- exchangeMgr:(nl::Weave::WeaveExchangeManager *)exchangeMgr
- messageLayer:(nl::Weave::WeaveMessageLayer *)messageLayer
- nlWeaveDeviceManager:(NLWeaveDeviceManager *)deviceMgr
+ weaveWorkQueue:(dispatch_queue_t)weaveWorkQueue
+ appCallbackQueue:(dispatch_queue_t)appCallbackQueue
+ exchangeMgr:(nl::Weave::WeaveExchangeManager *)exchangeMgr
+ messageLayer:(nl::Weave::WeaveMessageLayer *)messageLayer
+ nlWeaveDeviceManager:(NLWeaveDeviceManager *)deviceMgr
{
WEAVE_ERROR err = WEAVE_NO_ERROR;
long long deviceMgrCppPtr = 0;
@@ -149,10 +149,10 @@
WDM_LOG_DEBUG(@"NewWdmClient() called");
[deviceMgr GetDeviceMgrPtr:&deviceMgrCppPtr];
- pBinding = exchangeMgr->NewBinding(bindingEventCallback, (nl::Weave::DeviceManager::WeaveDeviceManager*)deviceMgrCppPtr);
+ pBinding = exchangeMgr->NewBinding(bindingEventCallback, (nl::Weave::DeviceManager::WeaveDeviceManager *) deviceMgrCppPtr);
VerifyOrExit(NULL != pBinding, err = WEAVE_ERROR_NO_MEMORY);
- err = ((nl::Weave::DeviceManager::WeaveDeviceManager*)deviceMgrCppPtr)->ConfigureBinding(pBinding);
+ err = ((nl::Weave::DeviceManager::WeaveDeviceManager *) deviceMgrCppPtr)->ConfigureBinding(pBinding);
SuccessOrExit(err);
_mWeaveCppWdmClient = new nl::Weave::DeviceManager::WdmClient();
@@ -172,8 +172,7 @@
} else {
WDM_LOG_ERROR(@"Error in init : (%d) %@\n", err, [NSString stringWithUTF8String:nl::ErrorStr(err)]);
[self shutdown_Internal];
- if (NULL != pBinding)
- {
+ if (NULL != pBinding) {
pBinding->Release();
}
}
@@ -189,8 +188,8 @@
[client dispatchAsyncCompletionBlock:nil];
}
-static void handleWdmClientError(void * wdmClient, void * appReqState, WEAVE_ERROR code,
- nl::Weave::DeviceManager::DeviceStatus * devStatus)
+static void handleWdmClientError(
+ void * wdmClient, void * appReqState, WEAVE_ERROR code, nl::Weave::DeviceManager::DeviceStatus * devStatus)
{
WDM_LOG_DEBUG(@"handleWdmClientError");
@@ -210,14 +209,14 @@
errorCode:devStatus->SystemErrorCode
statusReport:[client statusReportToString:devStatus->StatusProfileId statusCode:devStatus->StatusCode]];
requestError = NLWeaveRequestError_ProfileStatusError;
- userInfo = @{ @"WeaveRequestErrorType" : @(requestError), @"errorInfo" : statusError };
+ userInfo = @{@"WeaveRequestErrorType" : @(requestError), @"errorInfo" : statusError};
WDM_LOG_DEBUG(@"%@: status error: %@", client.name, userInfo);
} else {
NLWeaveError * weaveError = [[NLWeaveError alloc] initWithWeaveError:code
report:[NSString stringWithUTF8String:nl::ErrorStr(code)]];
requestError = NLWeaveRequestError_WeaveError;
- userInfo = @{ @"WeaveRequestErrorType" : @(requestError), @"errorInfo" : weaveError };
+ userInfo = @{@"WeaveRequestErrorType" : @(requestError), @"errorInfo" : weaveError};
}
error = [NSError errorWithDomain:@"com.nest.error" code:code userInfo:userInfo];
@@ -285,7 +284,6 @@
dispatch_async(_mAppCallbackQueue, ^() {
completionHandler(_owner, data);
});
-
}
}
@@ -332,16 +330,14 @@
{
WDM_LOG_METHOD_SIG();
- NSArray * keys =[_mTraitMap allKeys];
-
- for(NSString * key in keys)
- {
- NLGenericTraitUpdatableDataSink * pDataSink =[_mTraitMap objectForKey:key];
- NSLog(@"key=%@, pDataSink=%@",key, pDataSink);
- if ((NSNull *)pDataSink != [NSNull null])
- {
- [pDataSink close];
- }
+ NSArray * keys = [_mTraitMap allKeys];
+
+ for (NSString * key in keys) {
+ NLGenericTraitUpdatableDataSink * pDataSink = [_mTraitMap objectForKey:key];
+ NSLog(@"key=%@, pDataSink=%@", key, pDataSink);
+ if ((NSNull *) pDataSink != [NSNull null]) {
+ [pDataSink close];
+ }
}
[_mTraitMap removeAllObjects];
_mTraitMap = nil;
@@ -376,12 +372,11 @@
});
}
-- (void) removeDataSinkRef:(long long)traitInstancePtr;
+- (void)removeDataSinkRef:(long long)traitInstancePtr;
{
- NSString *address = [NSString stringWithFormat:@"%lld", traitInstancePtr];
+ NSString * address = [NSString stringWithFormat:@"%lld", traitInstancePtr];
- if ([_mTraitMap objectForKey:address] != nil)
- {
+ if ([_mTraitMap objectForKey:address] != nil) {
_mTraitMap[address] = [NSNull null];
}
}
@@ -390,7 +385,7 @@
{
WDM_LOG_METHOD_SIG();
- //VerifyOrExit(NULL != _mWeaveCppWdmClient, err = WEAVE_ERROR_INCORRECT_STATE);
+ // VerifyOrExit(NULL != _mWeaveCppWdmClient, err = WEAVE_ERROR_INCORRECT_STATE);
dispatch_sync(_mWeaveWorkQueue, ^() {
_mWeaveCppWdmClient->SetNodeId(nodeId);
@@ -398,46 +393,43 @@
}
- (NLGenericTraitUpdatableDataSink *)newDataSink:(NLResourceIdentifier *)nlResourceIdentifier
- profileId: (uint32_t)profileId
- instanceId: (uint64_t)instanceId
- path: (NSString *)path;
+ profileId:(uint32_t)profileId
+ instanceId:(uint64_t)instanceId
+ path:(NSString *)path;
{
__block WEAVE_ERROR err = WEAVE_NO_ERROR;
__block nl::Weave::DeviceManager::GenericTraitUpdatableDataSink * pDataSink = NULL;
WDM_LOG_METHOD_SIG();
- //VerifyOrExit(NULL != _mWeaveCppWdmClient, err = WEAVE_ERROR_INCORRECT_STATE);
+ // VerifyOrExit(NULL != _mWeaveCppWdmClient, err = WEAVE_ERROR_INCORRECT_STATE);
dispatch_sync(_mWeaveWorkQueue, ^() {
ResourceIdentifier resId = [nlResourceIdentifier toResourceIdentifier];
err = _mWeaveCppWdmClient->NewDataSink(resId, profileId, instanceId, [path UTF8String], pDataSink);
});
-
- if (err != WEAVE_NO_ERROR || pDataSink == NULL)
- {
+
+ if (err != WEAVE_NO_ERROR || pDataSink == NULL) {
WDM_LOG_ERROR(@"pDataSink is not ready");
return nil;
}
- NSString *address = [NSString stringWithFormat:@"%lld", (long long)pDataSink];
+ NSString * address = [NSString stringWithFormat:@"%lld", (long long) pDataSink];
- if ([_mTraitMap objectForKey:address] == nil)
- {
+ if ([_mTraitMap objectForKey:address] == nil) {
WDM_LOG_DEBUG(@"creating new NLGenericTraitUpdatableDataSink with profild id %d", profileId);
NLGenericTraitUpdatableDataSink * pTrait = [[NLGenericTraitUpdatableDataSink alloc] init:_name
- weaveWorkQueue:_mWeaveWorkQueue
- appCallbackQueue:_mAppCallbackQueue
- genericTraitUpdatableDataSinkPtr: pDataSink
- nlWdmClient:self];
+ weaveWorkQueue:_mWeaveWorkQueue
+ appCallbackQueue:_mAppCallbackQueue
+ genericTraitUpdatableDataSinkPtr:pDataSink
+ nlWdmClient:self];
[_mTraitMap setObject:pTrait forKey:address];
}
return [_mTraitMap objectForKey:address];
}
-- (void)flushUpdate:(WdmClientCompletionBlock)completionHandler
- failure:(WdmClientFailureBlock)failureHandler
+- (void)flushUpdate:(WdmClientCompletionBlock)completionHandler failure:(WdmClientFailureBlock)failureHandler
{
WDM_LOG_METHOD_SIG();
@@ -450,7 +442,8 @@
_mCompletionHandler = [completionHandler copy];
_mFailureHandler = [failureHandler copy];
- WEAVE_ERROR err = _mWeaveCppWdmClient->FlushUpdate((__bridge void *) self, handleWdmClientComplete, handleWdmClientError);
+ WEAVE_ERROR err
+ = _mWeaveCppWdmClient->FlushUpdate((__bridge void *) self, handleWdmClientComplete, handleWdmClientError);
if (WEAVE_NO_ERROR != err) {
[self dispatchAsyncDefaultFailureBlockWithCode:err];
@@ -464,8 +457,7 @@
});
}
-- (void)refreshData:(WdmClientCompletionBlock)completionHandler
- failure:(WdmClientFailureBlock)failureHandler
+- (void)refreshData:(WdmClientCompletionBlock)completionHandler failure:(WdmClientFailureBlock)failureHandler
{
WDM_LOG_METHOD_SIG();
@@ -478,7 +470,8 @@
_mCompletionHandler = [completionHandler copy];
_mFailureHandler = [failureHandler copy];
- WEAVE_ERROR err = _mWeaveCppWdmClient->RefreshData((__bridge void *) self, handleWdmClientComplete, handleWdmClientError, NULL);
+ WEAVE_ERROR err
+ = _mWeaveCppWdmClient->RefreshData((__bridge void *) self, handleWdmClientComplete, handleWdmClientError, NULL);
if (WEAVE_NO_ERROR != err) {
[self dispatchAsyncDefaultFailureBlockWithCode:err];
diff --git a/src/device-manager/cocoa/NLWdmClient_Protected.h b/src/device-manager/cocoa/NLWdmClient_Protected.h
index df07e01..ae11451 100644
--- a/src/device-manager/cocoa/NLWdmClient_Protected.h
+++ b/src/device-manager/cocoa/NLWdmClient_Protected.h
@@ -18,7 +18,8 @@
/**
* @file
- * This file provides defines non-public portion of NLWdmClient interface
+ * This file provides defines non-public portion of NLWdmClient interface.
+ * This is WEAVE_CONFIG_DATA_MANAGEMENT_EXPERIMENTAL feature.
*
*/
@@ -28,11 +29,11 @@
@interface NLWdmClient ()
- (instancetype)init:(NSString *)name
- weaveWorkQueue:(dispatch_queue_t)weaveWorkQueue
- appCallbackQueue:(dispatch_queue_t)appCallbackQueue
- exchangeMgr:(nl::Weave::WeaveExchangeManager *)exchangeMgr
- messageLayer:(nl::Weave::WeaveMessageLayer *)messageLayer
- nlWeaveDeviceManager:(NLWeaveDeviceManager *)deviceMgr NS_DESIGNATED_INITIALIZER;
+ weaveWorkQueue:(dispatch_queue_t)weaveWorkQueue
+ appCallbackQueue:(dispatch_queue_t)appCallbackQueue
+ exchangeMgr:(nl::Weave::WeaveExchangeManager *)exchangeMgr
+ messageLayer:(nl::Weave::WeaveMessageLayer *)messageLayer
+ nlWeaveDeviceManager:(NLWeaveDeviceManager *)deviceMgr NS_DESIGNATED_INITIALIZER;
- (NSString *)statusReportToString:(NSUInteger)profileId statusCode:(NSInteger)statusCode;
diff --git a/src/device-manager/cocoa/NLWeaveDeviceManager.mm b/src/device-manager/cocoa/NLWeaveDeviceManager.mm
index 9809a5e..05bb3e5 100644
--- a/src/device-manager/cocoa/NLWeaveDeviceManager.mm
+++ b/src/device-manager/cocoa/NLWeaveDeviceManager.mm
@@ -31,7 +31,6 @@
#include <Weave/Support/CodeUtils.h>
#include <WeaveDeviceManager.h>
-#include <WeaveDataManagementClient.h>
#include <net/if.h>