// --------- This code has been automatically generated !!! 2017-12-15T21:13:53.283Z
"use strict";
/**
* @module opcua.address_space.types
*/
var assert = require("node-opcua-assert");
var util = require("util");
var _ = require("underscore");
var makeNodeId = require("node-opcua-nodeid").makeNodeId;
var schema_helpers = require("node-opcua-factory/src/factories_schema_helpers");
var extract_all_fields = schema_helpers.extract_all_fields;
var resolve_schema_field_types = schema_helpers.resolve_schema_field_types;
var initialize_field = schema_helpers.initialize_field;
var initialize_field_array = schema_helpers.initialize_field_array;
var check_options_correctness_against_schema = schema_helpers.check_options_correctness_against_schema;
var _defaultTypeMap = require("node-opcua-factory/src/factories_builtin_types")._defaultTypeMap;
var ec = require("node-opcua-basic-types");
var encodeArray = ec.encodeArray;
var decodeArray = ec.decodeArray;
var makeExpandedNodeId = require("node-opcua-nodeid/src/expanded_nodeid").makeExpandedNodeId;
var generate_new_id = require("node-opcua-factory").generate_new_id;
var _enumerations = require("node-opcua-factory/src/factories_enumerations")._private._enumerations;
var schema = require("../schemas/HelloMessage_schema").HelloMessage_Schema;
var getFactory = require("node-opcua-factory/src/factories_factories").getFactory;
var BaseUAObject = require("node-opcua-factory/src/factories_baseobject").BaseUAObject;
/**
*
* @class HelloMessage
* @constructor
* @extends BaseUAObject
* @param options {Object}
* @param [options.protocolVersion] {UInt32} The latest version of the OPC UA TCP protocol supported by the Client
* @param [options.receiveBufferSize] {UInt32} The largest message that the sender can receive.
* @param [options.sendBufferSize] {UInt32} The largest message that the sender will send.
* @param [options.maxMessageSize] {UInt32} The maximum size for any response message.
* @param [options.maxChunkCount] {UInt32} The maximum number of chunks in any response message
* @param [options.endpointUrl] {UAString} The URL of the Endpoint which the Client wished to connect to.
*/
function HelloMessage(options)
{
options = options || {};
/* istanbul ignore next */
if (schema_helpers.doDebug) { check_options_correctness_against_schema(this,schema,options); }
var self = this;
assert(this instanceof BaseUAObject); // ' keyword "new" is required for constructor call')
resolve_schema_field_types(schema);
BaseUAObject.call(this,options);
/**
* The latest version of the OPC UA TCP protocol supported by the Client
* @property protocolVersion
* @type {UInt32}
*/
self.protocolVersion = initialize_field(schema.fields[0], options.protocolVersion);
/**
* The largest message that the sender can receive.
* @property receiveBufferSize
* @type {UInt32}
*/
self.receiveBufferSize = initialize_field(schema.fields[1], options.receiveBufferSize);
/**
* The largest message that the sender will send.
* @property sendBufferSize
* @type {UInt32}
*/
self.sendBufferSize = initialize_field(schema.fields[2], options.sendBufferSize);
/**
* The maximum size for any response message.
* @property maxMessageSize
* @type {UInt32}
*/
self.maxMessageSize = initialize_field(schema.fields[3], options.maxMessageSize);
/**
* The maximum number of chunks in any response message
* @property maxChunkCount
* @type {UInt32}
*/
self.maxChunkCount = initialize_field(schema.fields[4], options.maxChunkCount);
/**
* The URL of the Endpoint which the Client wished to connect to.
* @property endpointUrl
* @type {UAString}
*/
self.endpointUrl = initialize_field(schema.fields[5], options.endpointUrl);
// Object.preventExtensions(self);
}
util.inherits(HelloMessage,BaseUAObject);
schema.id = generate_new_id();
HelloMessage.prototype.encodingDefaultBinary = makeExpandedNodeId(schema.id);
HelloMessage.prototype._schema = schema;
var encode_UInt32 = _defaultTypeMap.UInt32.encode;
var decode_UInt32 = _defaultTypeMap.UInt32.decode;
var encode_UAString = _defaultTypeMap.UAString.encode;
var decode_UAString = _defaultTypeMap.UAString.decode;
/**
* encode the object into a binary stream
* @method encode
*
* @param stream {BinaryStream}
*/
HelloMessage.prototype.encode = function(stream,options) {
// call base class implementation first
BaseUAObject.prototype.encode.call(this,stream,options);
encode_UInt32(this.protocolVersion,stream);
encode_UInt32(this.receiveBufferSize,stream);
encode_UInt32(this.sendBufferSize,stream);
encode_UInt32(this.maxMessageSize,stream);
encode_UInt32(this.maxChunkCount,stream);
encode_UAString(this.endpointUrl,stream);
};
/**
* decode the object from a binary stream
* @method decode
*
* @param stream {BinaryStream}
* @param [option] {object}
*/
HelloMessage.prototype.decode = function(stream,options) {
// call base class implementation first
BaseUAObject.prototype.decode.call(this,stream,options);
this.protocolVersion = decode_UInt32(stream,options);
this.receiveBufferSize = decode_UInt32(stream,options);
this.sendBufferSize = decode_UInt32(stream,options);
this.maxMessageSize = decode_UInt32(stream,options);
this.maxChunkCount = decode_UInt32(stream,options);
this.endpointUrl = decode_UAString(stream,options);
};
HelloMessage.possibleFields = [
"protocolVersion",
"receiveBufferSize",
"sendBufferSize",
"maxMessageSize",
"maxChunkCount",
"endpointUrl"
];
exports.HelloMessage = HelloMessage;
var register_class_definition = require("node-opcua-factory/src/factories_factories").register_class_definition;
register_class_definition("HelloMessage",HelloMessage);