diff --git a/lib/opcua_node_ids.js b/lib/opcua_node_ids.js index 84c1c99f82..36fc3c109c 100644 --- a/lib/opcua_node_ids.js +++ b/lib/opcua_node_ids.js @@ -280,7 +280,7 @@ HistoryModifiedData: 11217 , HistoryUpdateType: 11234 , PerformUpdateType: 11293 , - UpdateStructureDataDetails: 11295 , + UpdateStructureDataDetails: 11295 }; exports.ReferenceType= { References: 31 , @@ -311,7 +311,7 @@ AlwaysGeneratesEvent: 3065 , HasTrueSubState: 9004 , HasFalseSubState: 9005 , - HasCondition: 9006 , + HasCondition: 9006 }; exports.ObjectType= { BaseObjectType: 58 , @@ -416,7 +416,7 @@ AggregateFunctionsType: 11167 , AggregateConfigurationType: 11187 , ProgressEventType: 11436 , - SystemStatusChangeEventType: 11446 , + SystemStatusChangeEventType: 11446 }; exports.VariableType= { BaseVariableType: 62 , @@ -449,7 +449,7 @@ TwoStateVariableType: 8995 , ConditionVariableType: 9002 , MultiStateValueDiscreteType: 11238 , - OptionSetType: 11487 , + OptionSetType: 11487 }; exports.Object= { ModellingRule_Mandatory: 78 , @@ -1152,7 +1152,7 @@ AggregateFunction_StandardDeviationSample: 11426 , AggregateFunction_StandardDeviationPopulation: 11427 , AggregateFunction_VarianceSample: 11428 , - AggregateFunction_VariancePopulation: 11429 , + AggregateFunction_VariancePopulation: 11429 }; exports.Variable= { DataTypeDescriptionType_DataTypeVersion: 104 , @@ -1317,7 +1317,7 @@ Server_ServerStatus_BuildInfo_ProductName: 2261 , Server_ServerStatus_BuildInfo_ProductUri: 2262 , Server_ServerStatus_BuildInfo_ManufacturerName: 2263 , - Server_ServerStatus_BuildInfo_SoftwareVersion: 2264 , + Server_ServerStatus_BuildInfo_SoftwareVersion: 2264 , Server_ServerStatus_BuildInfo_BuildNumber: 2265 , Server_ServerStatus_BuildInfo_BuildDate: 2266 , Server_ServiceLevel: 2267 , @@ -5458,7 +5458,7 @@ Server_GetMonitoredItems_InputArguments: 11493 , Server_GetMonitoredItems_OutputArguments: 11494 , GetMonitoredItemsMethodType_InputArguments: 11496 , - GetMonitoredItemsMethodType_OutputArguments: 11497 , + GetMonitoredItemsMethodType_OutputArguments: 11497 }; exports.Method= { ProgramStateMachineType_Start: 2426 , @@ -5611,5 +5611,5 @@ TripAlarmType_ShelvingState_TimedShelve: 10861 , ServerType_GetMonitoredItems: 11489 , Server_GetMonitoredItems: 11492 , - GetMonitoredItemsMethodType: 11495 , + GetMonitoredItemsMethodType: 11495 }; diff --git a/lib/opcua_status_code.js b/lib/opcua_status_code.js index 7eab6744ca..837d8fd637 100644 --- a/lib/opcua_status_code.js +++ b/lib/opcua_status_code.js @@ -12,58 +12,35 @@ function StatusCode(options) { } StatusCode.prototype.toString = function() { return this.name +" (0x" + this.highword.toString(16) + "0000)" ; -} +}; + exports.StatusCode = StatusCode; -var encodeStatusCode = function(statusCode,stream) -{ +var encodeStatusCode = function(statusCode,stream) { assert(statusCode instanceof StatusCode); stream.writeUInt16(0); stream.writeUInt16(statusCode.highword); -} +}; + exports.encodeStatusCode = encodeStatusCode; -var decodeStatusCode = function(stream) -{ +var decodeStatusCode = function(stream) { + + // read low word var l = stream.readUInt16(); + // read high word var h = stream.readUInt16(); var code = h & 0x3FFF; var sc = StatusCodes_reverse_map[code]; - if (!sc){ - console.log("code = ",code); - return StatusCodes_reverse_map[1]; - } + assert(sc !== null,"expecting a known StatusCode"); return sc; +}; -} exports.decodeStatusCode = decodeStatusCode; -/* -function makeStatusCode(statusCode, severity) { - if (typeof(statusCode) === "string" && statusCode.substr(0,2) === "0x") { - var a1 = "00000000" + statusCode.substr(2); - a1 = a1.substr(a1.length-8); - high = parseInt("0x"+a1.substr(0,4)); - low = parseInt("0x"+a1.substr(4,8)); - return [ low.toString(16),high.toString(16)] - } else { - var util = require("util"); - assert(isFinite(statusCode.value), "invalid status code provided " + util.inspect(statusCode)); - high = (statusCode.value | 0x8000); - low = 0; - //xx var b = new Buffer(8); - //xx b.writeUInt8(low ,0); - //xx b.writeUInt32LE(high,4); - //xx return b.toString("hex"); - return [ low.toString(16),high.toString(16)] - } -} -exports.makeStatusCode = makeStatusCode; - -*/ - +/* construct status codes fast search indexes */ var StatusCodes_reverse_map = {}; _.forEach(StatusCodes, function(code) { code = new StatusCode(code); diff --git a/lib/status_code.js b/lib/status_code.js deleted file mode 100644 index e69de29bb2..0000000000