Пример #1
0
        ////////////////////////////////////////////////////////////////////
        //Creating And Destroying Appliances
        ////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Creates an appliance instance.
        /// </summary>
        /// <exception cref="MylapsException">
        /// Throws a MylapsException when it failes to create an instance.
        /// A brief error description is available from MylapsMessage member.
        /// </exception>
        public MTA CreateMTA()
        {
            var result = new MTA(this);

            _mtaHandleWrappers.Add(result);
            return(result);
        }
Пример #2
0
        internal static EventData CreateLive(MTA mta)
        {
            var nativeHandle = NativeMethods.mta_eventdata_handle_alloc_live(mta.NativeHandle, IntPtr.Zero);

            if (nativeHandle == IntPtr.Zero)
            {
                throw new MylapsSDK.Exceptions.MylapsException("Unable to allocate new event data handle");
            }
            return(new EventData(mta, nativeHandle));
        }
Пример #3
0
        /// <summary>
        /// Disconnects the Appliance, releases the delegates and clears all Data
        /// </summary>
        /// <exception cref="MylapsException">
        /// Throws a MylapsException when the appliance is not created with this SDK instance.
        /// A brief error description is available from MylapsMessage member.
        /// </exception>
        /// <param name="mta">
        /// the appliance should be created by this SDK instance
        /// </param>
        public void ClearMTA(MTA mta)
        {
            if (!_mtaHandleWrappers.Contains(mta))
            {
                throw new MylapsException("Appliance " + mta.GetHostname() + " does not exist in this SDK");
            }

            _mtaHandleWrappers.Remove(mta);
            mta.Dispose();
        }
Пример #4
0
        internal static EventData CreateLiveWithResend(MTA mta, DateTime beginTime)
        {
            if (beginTime.Kind != DateTimeKind.Utc)
            {
                throw new MylapsException("Begin time for interval should always be given in UTC, not local or unspecified time.");
            }
            var mtaNow = mta.GetUTCTime();
            var time   = SDKHelperFunctions.DateTimeToTimestamp(beginTime);

            var nativeHandle = NativeMethods.mta_eventdata_handle_alloc_live_with_resend(mta.NativeHandle, time, IntPtr.Zero);

            if (nativeHandle == IntPtr.Zero)
            {
                throw new MylapsSDK.Exceptions.MylapsException("Unable to allocate new event data handle");
            }
            return(new EventData(mta, nativeHandle));
        }
Пример #5
0
        // Implement IDisposable.
        // Do not make this method virtual.
        // A derived class should not be able to override this method.
        public void Dispose()
        {
            // Check to see if Dispose has already been called.
            if (!_disposed)
            {
                // Dispose all managed and unmanaged resources.
                // Dispose managed resources.
                ClearContainers();

                RollbackChanges();
                NativeMethods.mta_eventdata_handle_dealloc(_mtaHandleWrapper.NativeHandle, _nativeHandle);
                _nativeHandle     = IntPtr.Zero;
                _mtaHandleWrapper = null;

                // Note disposing has been done.
                _disposed = true;
            }
        }
Пример #6
0
        private EventData(MTA mta, IntPtr nativeHandle)
        {
            _nativeHandle     = nativeHandle;
            _mtaHandleWrapper = mta;

            _beaconLogAndDataContainer = new BeaconLogAndDataContainer(this);

            _auxStatusContainer           = new AuxStatusContainer(this, false);
            _decoderStatusContainer       = new DecoderStatusContainer(this, false);
            _transponderStatusContainer   = new TransponderStatusContainer(this, false);
            _loopTriggerContainer         = new LoopTriggerContainer(this, false);
            _passingFirstContactContainer = new PassingFirstContactContainer(this, false);

            _beaconDownloadStatusContainer  = new BeaconDownloadStatusContainer(this, false);
            _beaconDownloadTriggerContainer = new BeaconDownloadTriggerContainer(this, false);
            _manualEventContainer           = new ManualEventContainer(this, false);
            _passingContainer        = new PassingContainer(this, false);
            _passingTriggerContainer = new PassingTriggerContainer(this, false);
            _twoWayMessageContainer  = new TwoWayMessageContainer(this, false);
            _driverInfoContainer     = new DriverInfoContainer(this, false);
            _auxEventContainer       = new AuxEventContainer(this, false);
        }
Пример #7
0
 public void DisposeAppliance(MTA mta)
 {
     ClearMTA(mta);
 }