/*
* Copyright 2015 Kevin Herron
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.digitalpetri.opcua.stack.core.types.structured;
import com.digitalpetri.opcua.stack.core.Identifiers;
import com.digitalpetri.opcua.stack.core.serialization.DelegateRegistry;
import com.digitalpetri.opcua.stack.core.serialization.UaDecoder;
import com.digitalpetri.opcua.stack.core.serialization.UaEncoder;
import com.digitalpetri.opcua.stack.core.serialization.UaRequestMessage;
import com.digitalpetri.opcua.stack.core.types.UaDataType;
import com.digitalpetri.opcua.stack.core.types.builtin.NodeId;
import com.digitalpetri.opcua.stack.core.types.builtin.unsigned.UByte;
import com.digitalpetri.opcua.stack.core.types.builtin.unsigned.UInteger;
@UaDataType("CreateSubscriptionRequest")
public class CreateSubscriptionRequest implements UaRequestMessage {
public static final NodeId TypeId = Identifiers.CreateSubscriptionRequest;
public static final NodeId BinaryEncodingId = Identifiers.CreateSubscriptionRequest_Encoding_DefaultBinary;
public static final NodeId XmlEncodingId = Identifiers.CreateSubscriptionRequest_Encoding_DefaultXml;
protected final RequestHeader _requestHeader;
protected final Double _requestedPublishingInterval;
protected final UInteger _requestedLifetimeCount;
protected final UInteger _requestedMaxKeepAliveCount;
protected final UInteger _maxNotificationsPerPublish;
protected final Boolean _publishingEnabled;
protected final UByte _priority;
public CreateSubscriptionRequest() {
this._requestHeader = null;
this._requestedPublishingInterval = null;
this._requestedLifetimeCount = null;
this._requestedMaxKeepAliveCount = null;
this._maxNotificationsPerPublish = null;
this._publishingEnabled = null;
this._priority = null;
}
public CreateSubscriptionRequest(RequestHeader _requestHeader, Double _requestedPublishingInterval, UInteger _requestedLifetimeCount, UInteger _requestedMaxKeepAliveCount, UInteger _maxNotificationsPerPublish, Boolean _publishingEnabled, UByte _priority) {
this._requestHeader = _requestHeader;
this._requestedPublishingInterval = _requestedPublishingInterval;
this._requestedLifetimeCount = _requestedLifetimeCount;
this._requestedMaxKeepAliveCount = _requestedMaxKeepAliveCount;
this._maxNotificationsPerPublish = _maxNotificationsPerPublish;
this._publishingEnabled = _publishingEnabled;
this._priority = _priority;
}
public RequestHeader getRequestHeader() { return _requestHeader; }
public Double getRequestedPublishingInterval() { return _requestedPublishingInterval; }
public UInteger getRequestedLifetimeCount() { return _requestedLifetimeCount; }
public UInteger getRequestedMaxKeepAliveCount() { return _requestedMaxKeepAliveCount; }
public UInteger getMaxNotificationsPerPublish() { return _maxNotificationsPerPublish; }
public Boolean getPublishingEnabled() { return _publishingEnabled; }
public UByte getPriority() { return _priority; }
@Override
public NodeId getTypeId() { return TypeId; }
@Override
public NodeId getBinaryEncodingId() { return BinaryEncodingId; }
@Override
public NodeId getXmlEncodingId() { return XmlEncodingId; }
public static void encode(CreateSubscriptionRequest createSubscriptionRequest, UaEncoder encoder) {
encoder.encodeSerializable("RequestHeader", createSubscriptionRequest._requestHeader != null ? createSubscriptionRequest._requestHeader : new RequestHeader());
encoder.encodeDouble("RequestedPublishingInterval", createSubscriptionRequest._requestedPublishingInterval);
encoder.encodeUInt32("RequestedLifetimeCount", createSubscriptionRequest._requestedLifetimeCount);
encoder.encodeUInt32("RequestedMaxKeepAliveCount", createSubscriptionRequest._requestedMaxKeepAliveCount);
encoder.encodeUInt32("MaxNotificationsPerPublish", createSubscriptionRequest._maxNotificationsPerPublish);
encoder.encodeBoolean("PublishingEnabled", createSubscriptionRequest._publishingEnabled);
encoder.encodeByte("Priority", createSubscriptionRequest._priority);
}
public static CreateSubscriptionRequest decode(UaDecoder decoder) {
RequestHeader _requestHeader = decoder.decodeSerializable("RequestHeader", RequestHeader.class);
Double _requestedPublishingInterval = decoder.decodeDouble("RequestedPublishingInterval");
UInteger _requestedLifetimeCount = decoder.decodeUInt32("RequestedLifetimeCount");
UInteger _requestedMaxKeepAliveCount = decoder.decodeUInt32("RequestedMaxKeepAliveCount");
UInteger _maxNotificationsPerPublish = decoder.decodeUInt32("MaxNotificationsPerPublish");
Boolean _publishingEnabled = decoder.decodeBoolean("PublishingEnabled");
UByte _priority = decoder.decodeByte("Priority");
return new CreateSubscriptionRequest(_requestHeader, _requestedPublishingInterval, _requestedLifetimeCount, _requestedMaxKeepAliveCount, _maxNotificationsPerPublish, _publishingEnabled, _priority);
}
static {
DelegateRegistry.registerEncoder(CreateSubscriptionRequest::encode, CreateSubscriptionRequest.class, BinaryEncodingId, XmlEncodingId);
DelegateRegistry.registerDecoder(CreateSubscriptionRequest::decode, CreateSubscriptionRequest.class, BinaryEncodingId, XmlEncodingId);
}
}