APIs

Show:
  1. // --------- This code has been automatically generated !!! 2018-09-03T20:28:07.604Z
  2. "use strict";
  3. /**
  4. * @module opcua.address_space.types
  5. */
  6. const assert = require("node-opcua-assert").assert;
  7. const util = require("util");
  8. const _ = require("underscore");
  9. const makeNodeId = require("node-opcua-nodeid").makeNodeId;
  10. const schema_helpers = require("node-opcua-factory/src/factories_schema_helpers");
  11. const extract_all_fields = schema_helpers.extract_all_fields;
  12. const resolve_schema_field_types = schema_helpers.resolve_schema_field_types;
  13. const initialize_field = schema_helpers.initialize_field;
  14. const initialize_field_array = schema_helpers.initialize_field_array;
  15. const check_options_correctness_against_schema = schema_helpers.check_options_correctness_against_schema;
  16. const _defaultTypeMap = require("node-opcua-factory/src/factories_builtin_types")._defaultTypeMap;
  17. const ec = require("node-opcua-basic-types");
  18. const encodeArray = ec.encodeArray;
  19. const decodeArray = ec.decodeArray;
  20. const makeExpandedNodeId = require("node-opcua-nodeid/src/expanded_nodeid").makeExpandedNodeId;
  21. const generate_new_id = require("node-opcua-factory").generate_new_id;
  22. const _enumerations = require("node-opcua-factory/src/factories_enumerations")._private._enumerations;
  23. const schema = require("../schemas/FindServersOnNetworkRequest_schema").FindServersOnNetworkRequest_Schema;
  24. const getFactory = require("node-opcua-factory/src/factories_factories").getFactory;
  25. const RequestHeader = getFactory("RequestHeader");
  26. const BaseUAObject = require("node-opcua-factory/src/factories_baseobject").BaseUAObject;
  27.  
  28. /**
  29. * Finds the servers known to the discovery server.
  30. *
  31. * @class FindServersOnNetworkRequest
  32. * @constructor
  33. * @extends BaseUAObject
  34. * @param options {Object}
  35. */
  36. function FindServersOnNetworkRequest(options)
  37. {
  38. options = options || {};
  39. /* istanbul ignore next */
  40. if (schema_helpers.doDebug) { check_options_correctness_against_schema(this,schema,options); }
  41. const self = this;
  42. assert(this instanceof BaseUAObject); // ' keyword "new" is required for constructor call')
  43. resolve_schema_field_types(schema);
  44.  
  45. BaseUAObject.call(this,options);
  46. if (options === null) {
  47. BaseUAObject.call(this,options);
  48. self.requestHeader = null; /* new RequestHeader(null); */
  49. return ;
  50. }
  51.  
  52. /**
  53. * A standard header included in all requests sent to a server.
  54. * @property requestHeader
  55. * @type {RequestHeader}
  56. */
  57. self.requestHeader = new RequestHeader( options.requestHeader);
  58.  
  59. /**
  60. * Only records with an identifier greater than this number will be returned. Specify 0 to start with the first record in the cache.
  61. * @property startingRecordId
  62. * @type {Counter}
  63. */
  64. self.startingRecordId = initialize_field(schema.fields[1], options.startingRecordId);
  65.  
  66. /**
  67. * The maximum number of records to return in the response.
  68. 0 indicates that there is no limit.
  69. * @property maxRecordsToReturn
  70. * @type {UInt32}
  71. */
  72. self.maxRecordsToReturn = initialize_field(schema.fields[2], options.maxRecordsToReturn);
  73.  
  74. /**
  75. * List of Server capability filters. The set of allowed server capabilities
  76. are defined in Part 12.
  77. Only records with all of the specified server capabilities are
  78. returned.
  79. The comparison is case insensitive.
  80. If this list is empty then no filtering is performed.
  81. * @property serverCapabilityFilter
  82. * @type {String[]}
  83. */
  84. self.serverCapabilityFilter = initialize_field_array(schema.fields[3], options.serverCapabilityFilter);
  85.  
  86. // Object.preventExtensions(self);
  87. }
  88. util.inherits(FindServersOnNetworkRequest,BaseUAObject);
  89. FindServersOnNetworkRequest.prototype.encodingDefaultBinary = makeExpandedNodeId(12208,0);
  90. FindServersOnNetworkRequest.prototype.encodingDefaultXml = makeExpandedNodeId(12196,0);
  91. FindServersOnNetworkRequest.prototype._schema = schema;
  92.  
  93. const encode_Counter = _defaultTypeMap.Counter.encode;
  94. const decode_Counter = _defaultTypeMap.Counter.decode;
  95. const encode_UInt32 = _defaultTypeMap.UInt32.encode;
  96. const decode_UInt32 = _defaultTypeMap.UInt32.decode;
  97. const encode_String = _defaultTypeMap.String.encode;
  98. const decode_String = _defaultTypeMap.String.decode;
  99. /**
  100. * encode the object into a binary stream
  101. * @method encode
  102. *
  103. * @param stream {BinaryStream}
  104. */
  105. FindServersOnNetworkRequest.prototype.encode = function(stream,options) {
  106. // call base class implementation first
  107. BaseUAObject.prototype.encode.call(this,stream,options);
  108. this.requestHeader.encode(stream,options);
  109. encode_Counter(this.startingRecordId,stream);
  110. encode_UInt32(this.maxRecordsToReturn,stream);
  111. encodeArray(this.serverCapabilityFilter, stream, encode_String);
  112. };
  113. /**
  114. * decode the object from a binary stream
  115. * @method decode
  116. *
  117. * @param stream {BinaryStream}
  118. */
  119. FindServersOnNetworkRequest.prototype.decode = function(stream) {
  120. // call base class implementation first
  121. BaseUAObject.prototype.decode.call(this,stream);
  122. this.requestHeader.decode(stream);
  123. this.startingRecordId = decode_Counter(stream);
  124. this.maxRecordsToReturn = decode_UInt32(stream);
  125. this.serverCapabilityFilter = decodeArray(stream, decode_String);
  126. };
  127. FindServersOnNetworkRequest.possibleFields = [
  128. "requestHeader",
  129. "startingRecordId",
  130. "maxRecordsToReturn",
  131. "serverCapabilityFilter"
  132. ];
  133.  
  134.  
  135. exports.FindServersOnNetworkRequest = FindServersOnNetworkRequest;
  136. const register_class_definition = require("node-opcua-factory/src/factories_factories").register_class_definition;
  137. register_class_definition("FindServersOnNetworkRequest",FindServersOnNetworkRequest);
  138.