using System.Runtime.InteropServices; using ArchestrAServices.ASBContract; using ArchestrAServices.ASBIDataContract.V2; using ArchestrAServices.ASBIDataV2Contract; using ArchestrAServices.Proxy; public class CIDataVersionAdapterV2(ASBDataV2Proxy ASBProxy) : CIDataVersionAdapter { private ASBDataV2Proxy m_ASBProxy = ASBProxy; private ConnectionId m_blankConnectionId; [return: MarshalAs(UnmanagedType.U1)] public override bool Connect(ref string errorMessage) { bool result = false; ASBDataV2Proxy aSBProxy = m_ASBProxy; if (aSBProxy != null) { result = aSBProxy.Connect(out errorMessage); } return result; } public override void Abort() { m_ASBProxy?.Abort(); } public override void Disconnect() { m_ASBProxy?.Disconnect(); } [return: MarshalAs(UnmanagedType.U1)] public override bool SupportsArrayElementWrites() { return true; } public override ArchestrAResult KeepAlive() { ArchestrAResult archestrAResult = default(ArchestrAResult); archestrAResult = ResultFactory.MakeResult(ArchestrAError.SpecificError, 32); archestrAResult.SpecificErrorCode = 2147614720u; ASBDataV2Proxy aSBProxy = m_ASBProxy; if (aSBProxy != null) { archestrAResult = aSBProxy.KeepAlive(m_blankConnectionId); } return archestrAResult; } public override ArchestrAResult Read(ref ArchestrAServices.ASBIDataV2Contract.ItemStatus[] Status, ref ArchestrAServices.ASBIDataV2Contract.RuntimeValue[] ItemValues, ArchestrAServices.ASBIDataV2Contract.ItemIdentity[] Items) { ArchestrAResult archestrAResult = default(ArchestrAResult); archestrAResult = ResultFactory.MakeResult(ArchestrAError.SpecificError, 32); archestrAResult.SpecificErrorCode = 2147614720u; ASBDataV2Proxy aSBProxy = m_ASBProxy; if (aSBProxy != null) { archestrAResult = aSBProxy.Read(out Status, out ItemValues, m_blankConnectionId, Items); } return archestrAResult; } public override ArchestrAResult Write(ref ArchestrAServices.ASBIDataV2Contract.ItemStatus[] Status, ArchestrAServices.ASBIDataV2Contract.ItemIdentity[] Items, ArchestrAServices.ASBIDataV2Contract.WriteValue[] Values, uint WriteHandle) { ArchestrAResult archestrAResult = default(ArchestrAResult); archestrAResult = ResultFactory.MakeResult(ArchestrAError.SpecificError, 32); archestrAResult.SpecificErrorCode = 2147614720u; ASBDataV2Proxy aSBProxy = m_ASBProxy; if (aSBProxy != null) { archestrAResult = aSBProxy.Write(out Status, Items, Values, WriteHandle); } return archestrAResult; } public override ArchestrAResult WriteUser(ref ArchestrAServices.ASBIDataV2Contract.ItemStatus[] Status, ArchestrAServices.ASBIDataV2Contract.ItemIdentity[] Items, ArchestrAServices.ASBIDataV2Contract.WriteValue[] Values, ArchestrAServices.ASBIDataV2Contract.UserToken User, uint WriteHandle) { ArchestrAResult archestrAResult = default(ArchestrAResult); archestrAResult = ResultFactory.MakeResult(ArchestrAError.SpecificError, 32); archestrAResult.SpecificErrorCode = 2147614720u; ASBDataV2Proxy aSBProxy = m_ASBProxy; if (aSBProxy != null) { archestrAResult = aSBProxy.WriteUser(out Status, Items, Values, User, WriteHandle); } return archestrAResult; } public override ArchestrAResult WriteVerified(ref ArchestrAServices.ASBIDataV2Contract.ItemStatus[] Status, ArchestrAServices.ASBIDataV2Contract.ItemIdentity[] Items, ArchestrAServices.ASBIDataV2Contract.WriteValue[] Values, ArchestrAServices.ASBIDataV2Contract.UserToken User, ArchestrAServices.ASBIDataV2Contract.UserToken Supervisor, uint WriteHandle) { ArchestrAResult archestrAResult = default(ArchestrAResult); archestrAResult = ResultFactory.MakeResult(ArchestrAError.SpecificError, 32); archestrAResult.SpecificErrorCode = 2147614720u; ASBDataV2Proxy aSBProxy = m_ASBProxy; if (aSBProxy != null) { archestrAResult = aSBProxy.WriteVerified(out Status, Items, Values, User, Supervisor, WriteHandle); } return archestrAResult; } public override ArchestrAResult WriteSecured(ref ArchestrAServices.ASBIDataV2Contract.ItemStatus[] Status, ArchestrAServices.ASBIDataV2Contract.ItemIdentity[] Items, ArchestrAServices.ASBIDataV2Contract.WriteValue[] Values, ArchestrAServices.ASBIDataV2Contract.UserToken User, uint WriteHandle) { ArchestrAResult archestrAResult = default(ArchestrAResult); archestrAResult = ResultFactory.MakeResult(ArchestrAError.SpecificError, 32); archestrAResult.SpecificErrorCode = 2147614720u; ASBDataV2Proxy aSBProxy = m_ASBProxy; if (aSBProxy != null) { archestrAResult = aSBProxy.WriteSecured(out Status, Items, Values, User, WriteHandle); } return archestrAResult; } public override ArchestrAResult WriteConfirmed(ref ArchestrAServices.ASBIDataV2Contract.WriteValue ValueReceived, ref long WriteToken, ArchestrAServices.ASBIDataV2Contract.ItemIdentity Item, ArchestrAServices.ASBIDataV2Contract.WriteValue Value, ArchestrAServices.ASBIDataV2Contract.UserToken User, ArchestrAServices.ASBIDataV2Contract.UserToken Supervisor) { ArchestrAResult archestrAResult = default(ArchestrAResult); archestrAResult = ResultFactory.MakeResult(ArchestrAError.SpecificError, 32); archestrAResult.SpecificErrorCode = 2147614720u; ASBDataV2Proxy aSBProxy = m_ASBProxy; if (aSBProxy != null) { archestrAResult = aSBProxy.WriteConfirmed(out ValueReceived, out WriteToken, Item, Value, User, Supervisor); } return archestrAResult; } public override ArchestrAResult ConfirmWrite(ArchestrAServices.ASBIDataV2Contract.ItemIdentity Item, long WriteToken, ArchestrAServices.ASBIDataV2Contract.WriteValue Value, ArchestrAServices.ASBIDataV2Contract.UserToken User, ArchestrAServices.ASBIDataV2Contract.UserToken Supervisor, uint WriteHandle) { ArchestrAResult archestrAResult = default(ArchestrAResult); archestrAResult = ResultFactory.MakeResult(ArchestrAError.SpecificError, 32); archestrAResult.SpecificErrorCode = 2147614720u; ASBDataV2Proxy aSBProxy = m_ASBProxy; if (aSBProxy != null) { archestrAResult = aSBProxy.ConfirmWrite(Item, WriteToken, Value, User, Supervisor, WriteHandle); } return archestrAResult; } public override ArchestrAResult PublishWriteComplete(ref ArchestrAServices.ASBIDataV2Contract.ItemWriteComplete[] CompleteWrites) { ArchestrAResult archestrAResult = default(ArchestrAResult); archestrAResult = ResultFactory.MakeResult(ArchestrAError.SpecificError, 32); archestrAResult.SpecificErrorCode = 2147614720u; ASBDataV2Proxy aSBProxy = m_ASBProxy; if (aSBProxy != null) { archestrAResult = aSBProxy.PublishWriteComplete(out CompleteWrites); } return archestrAResult; } public override ArchestrAResult CreateSubscription(ref long SubscriptionId, long MaxQueueSize, ulong SampleInterval) { ArchestrAResult archestrAResult = default(ArchestrAResult); archestrAResult = ResultFactory.MakeResult(ArchestrAError.SpecificError, 32); archestrAResult.SpecificErrorCode = 2147614720u; ASBDataV2Proxy aSBProxy = m_ASBProxy; if (aSBProxy != null) { archestrAResult = aSBProxy.CreateSubscription(out SubscriptionId, MaxQueueSize, SampleInterval); } return archestrAResult; } public override ArchestrAResult SetSubscriptionState(long SubscriptionId, ArchestrAServices.ASBIDataContract.V2.Variant NewState, ushort StateToChange) { ArchestrAResult archestrAResult = default(ArchestrAResult); archestrAResult = ResultFactory.MakeResult(ArchestrAError.SpecificError, 32); archestrAResult.SpecificErrorCode = 2147614720u; ASBDataV2Proxy aSBProxy = m_ASBProxy; if (aSBProxy != null) { archestrAResult = aSBProxy.SetSubscriptionState(SubscriptionId, NewState, StateToChange); } return archestrAResult; } public override ArchestrAResult GetSubscriptionState(ref ArchestrAServices.ASBIDataContract.V2.Variant State, long SubscriptionId, ushort StateToGet) { ArchestrAResult archestrAResult = default(ArchestrAResult); archestrAResult = ResultFactory.MakeResult(ArchestrAError.SpecificError, 32); archestrAResult.SpecificErrorCode = 2147614720u; ASBDataV2Proxy aSBProxy = m_ASBProxy; if (aSBProxy != null) { archestrAResult = aSBProxy.GetSubscriptionState(out State, SubscriptionId, StateToGet); } return archestrAResult; } public override ArchestrAResult DeleteSubscription(long SubscriptionId) { ArchestrAResult archestrAResult = default(ArchestrAResult); archestrAResult = ResultFactory.MakeResult(ArchestrAError.SpecificError, 32); archestrAResult.SpecificErrorCode = 2147614720u; ASBDataV2Proxy aSBProxy = m_ASBProxy; if (aSBProxy != null) { archestrAResult = aSBProxy.DeleteSubscription(SubscriptionId); } return archestrAResult; } public override ArchestrAResult AddMonitoredItems(ref ArchestrAServices.ASBIDataV2Contract.ItemStatus[] Status, ref ArchestrAServices.ASBIDataV2Contract.ItemRegistration[] ItemCapabilities, long SubscriptionId, ArchestrAServices.ASBIDataV2Contract.MonitoredItem[] Items, byte RequireId) { ArchestrAResult archestrAResult = default(ArchestrAResult); archestrAResult = ResultFactory.MakeResult(ArchestrAError.SpecificError, 32); archestrAResult.SpecificErrorCode = 2147614720u; ASBDataV2Proxy aSBProxy = m_ASBProxy; if (aSBProxy != null) { archestrAResult = aSBProxy.AddMonitoredItems(out Status, out ItemCapabilities, SubscriptionId, Items, RequireId); } return archestrAResult; } public override ArchestrAResult DeleteMonitoredItems(ref ArchestrAServices.ASBIDataV2Contract.ItemStatus[] Status, long SubscriptionId, ArchestrAServices.ASBIDataV2Contract.MonitoredItem[] Items) { ArchestrAResult archestrAResult = default(ArchestrAResult); archestrAResult = ResultFactory.MakeResult(ArchestrAError.SpecificError, 32); archestrAResult.SpecificErrorCode = 2147614720u; ASBDataV2Proxy aSBProxy = m_ASBProxy; if (aSBProxy != null) { archestrAResult = aSBProxy.DeleteMonitoredItems(out Status, SubscriptionId, Items); } return archestrAResult; } public override ArchestrAResult GetMonitoredItems(ref ArchestrAServices.ASBIDataV2Contract.MonitoredItem[] Items, long SubscriptionId) { ArchestrAResult archestrAResult = default(ArchestrAResult); archestrAResult = ResultFactory.MakeResult(ArchestrAError.SpecificError, 32); archestrAResult.SpecificErrorCode = 2147614720u; ASBDataV2Proxy aSBProxy = m_ASBProxy; if (aSBProxy != null) { archestrAResult = aSBProxy.GetMonitoredItems(out Items, SubscriptionId); } return archestrAResult; } public override ArchestrAResult Publish(ref ArchestrAServices.ASBIDataV2Contract.ItemStatus[] Status, ref ArchestrAServices.ASBIDataV2Contract.MonitoredItemValue[] Values, long SubscriptionId) { ArchestrAResult archestrAResult = default(ArchestrAResult); archestrAResult = ResultFactory.MakeResult(ArchestrAError.SpecificError, 32); archestrAResult.SpecificErrorCode = 2147614720u; ASBDataV2Proxy aSBProxy = m_ASBProxy; if (aSBProxy != null) { archestrAResult = aSBProxy.Publish(out Status, out Values, SubscriptionId); } return archestrAResult; } public override ArchestrAResult RegisterItems(ref ArchestrAServices.ASBIDataV2Contract.ItemStatus[] Status, ref ArchestrAServices.ASBIDataV2Contract.ItemRegistration[] ItemCapabilities, ArchestrAServices.ASBIDataV2Contract.ItemIdentity[] Items, byte RequireId, byte RegisterOnly) { ArchestrAResult archestrAResult = default(ArchestrAResult); archestrAResult = ResultFactory.MakeResult(ArchestrAError.SpecificError, 32); archestrAResult.SpecificErrorCode = 2147614720u; ASBDataV2Proxy aSBProxy = m_ASBProxy; if (aSBProxy != null) { archestrAResult = aSBProxy.RegisterItems(out Status, out ItemCapabilities, Items, RequireId, RegisterOnly); } return archestrAResult; } public override ArchestrAResult UnregisterItems(ref ArchestrAServices.ASBIDataV2Contract.ItemStatus[] Status, ArchestrAServices.ASBIDataV2Contract.ItemIdentity[] Items) { ArchestrAResult archestrAResult = default(ArchestrAResult); archestrAResult = ResultFactory.MakeResult(ArchestrAError.SpecificError, 32); archestrAResult.SpecificErrorCode = 2147614720u; ASBDataV2Proxy aSBProxy = m_ASBProxy; if (aSBProxy != null) { archestrAResult = aSBProxy.UnregisterItems(out Status, Items); } return archestrAResult; } }