From 3334de7d06d51b7259aeed5d257988d3f3afe718 Mon Sep 17 00:00:00 2001 From: Cristian Recoseanu Date: Mon, 23 Oct 2023 17:07:11 +0100 Subject: [PATCH] Fix some further merge problems --- code/src/NCModel/Blocks.ts | 7 +++++-- code/src/NCModel/Core.ts | 33 ++++++++++++++++++++++----------- 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/code/src/NCModel/Blocks.ts b/code/src/NCModel/Blocks.ts index 6e3cd71..dd38b3c 100644 --- a/code/src/NCModel/Blocks.ts +++ b/code/src/NCModel/Blocks.ts @@ -312,7 +312,7 @@ export class NcBlock extends NcObject if(holders) return new CommandResponseWithValue(handle, NcMethodStatus.OK, this.SetPropertiesHolders(holders)); else - return new CommandResponseError(handle, NcMethodStatus.InvalidRequest, 'Invalid arguments provided'); + return new CommandResponseError(handle, NcMethodStatus.InvalidRequest, 'Invalid arguments provided'); } else return new CommandResponseError(handle, NcMethodStatus.InvalidRequest, 'Invalid arguments provided'); @@ -386,7 +386,10 @@ export class NcBlock extends NcObject new NcParameterDescriptor("classId", "NcClassId", false, false, null, "Class id to search for"), new NcParameterDescriptor("includeDerived", "NcBoolean", false, false, null, "If TRUE it will also include derived class descriptors"), new NcParameterDescriptor("recurse", "NcBoolean", false, false, null, "TRUE to search nested blocks") - ], "Finds members with given class id") + ], "Finds members with given class id"), + new NcMethodDescriptor(new NcElementId(2, 5), "SetPropertiesByPath", "NcMethodResult", [ + new NcParameterDescriptor("holders", "NcPropertyValueHolder", false, true, null, "Sequence of properties holders") + ], "Set properties by path") ], [] ); diff --git a/code/src/NCModel/Core.ts b/code/src/NCModel/Core.ts index c3167e1..60079a6 100644 --- a/code/src/NCModel/Core.ts +++ b/code/src/NCModel/Core.ts @@ -285,13 +285,7 @@ export abstract class NcObject else return new CommandResponseError(handle, NcMethodStatus.InvalidRequest, 'Invalid arguments provided'); } - } - } - - - switch(key) - { - case '1m7': + case '1m8': //GetAllProperties { if(args != null) { @@ -305,12 +299,23 @@ export abstract class NcObject else return new CommandResponseError(handle, NcMethodStatus.InvalidRequest, 'Invalid arguments provided'); } - default: - return new CommandResponseError(handle, NcMethodStatus.MethodNotImplemented, 'Method does not exist in object'); + case '1m9': //SetProperties + { + if(args != null) + { + let properties = args['properties'] as NcPropertyValueHolder[]; + if(properties) + return new CommandResponseWithValue(handle, NcMethodStatus.OK, this.SetProperties(properties)); + else + return new CommandResponseWithValue(handle, NcMethodStatus.OK, this.SetProperties(properties)); + } + else + return new CommandResponseError(handle, NcMethodStatus.InvalidRequest, 'Invalid arguments provided'); + } } } - return new CommandResponseError(handle, NcMethodStatus.InvalidRequest, 'OID could not be found'); + return new CommandResponseError(handle, NcMethodStatus.MethodNotImplemented, 'Method does not exist in object'); } public GenerateMemberDescriptor() : NcBlockMemberDescriptor @@ -359,7 +364,13 @@ export abstract class NcObject ], "Delete sequence item"), new NcMethodDescriptor(new NcElementId(1, 7), "GetSequenceLength", "NcMethodResultLength", [ new NcParameterDescriptor("id", "NcPropertyId", false, false, null, "Property id") - ], "Get sequence length") + ], "Get sequence length"), + new NcMethodDescriptor(new NcElementId(1, 8), "GetAllProperties", "NcMethodResultObjectPropertiesHolder", [ + new NcParameterDescriptor("recurse", "NcBoolean", false, false, null, "Should method recurse") + ], "Get sequence length"), + new NcMethodDescriptor(new NcElementId(1, 9), "SetProperties", "NcMethodResult", [ + new NcParameterDescriptor("properties", "NcPropertyValueHolder", false, true, null, "Sequence of properties to set") + ], "Set properties method") ], [ new NcEventDescriptor(new NcElementId(1, 1), "PropertyChanged", "NcPropertyChangedEventData", "Property changed event") ] );