コード例 #1
0
ファイル: SDK.cs プロジェクト: reitse/VantageGroningen
        ////////////////////////////////////////////////////////////////////
        //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
ファイル: EventData.cs プロジェクト: reitse/VantageGroningen
        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
ファイル: SDK.cs プロジェクト: reitse/VantageGroningen
        /// <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
ファイル: EventData.cs プロジェクト: reitse/VantageGroningen
        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
ファイル: EventData.cs プロジェクト: reitse/VantageGroningen
        // 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
ファイル: EventData.cs プロジェクト: reitse/VantageGroningen
        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
ファイル: SDK.cs プロジェクト: reitse/VantageGroningen
 public void DisposeAppliance(MTA mta)
 {
     ClearMTA(mta);
 }