Ejemplo n.º 1
0
        /// <summary>
        /// Queries the device state.
        /// </summary>
        /// <returns>Device state information</returns>
        public GpsDeviceState GetDeviceState()
        {
            GpsDeviceState device = null;

            // allocate a buffer on the native side.  Since the
            IntPtr pGpsDevice = Utils.LocalAlloc(GpsDeviceState.GpsDeviceStructureSize);

            // GPS_DEVICE structure has arrays of characters, it's easier to just
            // write directly into memory rather than create a managed structure with
            // the same layout.
            Marshal.WriteInt32(pGpsDevice, 1);                                        // write out GPS version of 1
            Marshal.WriteInt32(pGpsDevice, 4, GpsDeviceState.GpsDeviceStructureSize); // write out dwSize of structure

            int result = GPSGetDeviceState(pGpsDevice);

            if (result == 0)
            {
                // instantiate the GpsDeviceState class passing in the native pointer
                device = new GpsDeviceState(pGpsDevice);
            }

            // free our native memory
            Utils.LocalFree(pGpsDevice);

            return(device);
        }
Ejemplo n.º 2
0
        void gps_DeviceStateChanged(object sender, DeviceStateChangedEventArgs args)
        {
            device = args.DeviceState;

            // call the UpdateData method via the updateDataHandler so that we
            // update the UI on the UI thread
            Invoke(updateDataHandler);
        }
 public DeviceStateChangedEventArgs(GpsDeviceState deviceState)
 {
     this.deviceState = deviceState;
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Queries the device state.
        /// </summary>
        /// <returns>Device state information</returns>
        public GpsDeviceState GetDeviceState()
        {
            GpsDeviceState device = null;

            // allocate a buffer on the native side.  Since the
            IntPtr pGpsDevice = Utils.LocalAlloc(GpsDeviceState.GpsDeviceStructureSize);

            // GPS_DEVICE structure has arrays of characters, it's easier to just
            // write directly into memory rather than create a managed structure with
            // the same layout.
            Marshal.WriteInt32(pGpsDevice, 1);	// write out GPS version of 1
            Marshal.WriteInt32(pGpsDevice, 4, GpsDeviceState.GpsDeviceStructureSize);	// write out dwSize of structure

            int result = GPSGetDeviceState(pGpsDevice);

            if (result == 0)
            {
                // instantiate the GpsDeviceState class passing in the native pointer
                device = new GpsDeviceState(pGpsDevice);
            }

            // free our native memory
            Utils.LocalFree(pGpsDevice);

            return device;
        }
Ejemplo n.º 5
0
 public DeviceStateChangedEventArgs(GpsDeviceState deviceState)
 {
     this.deviceState = deviceState;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Zmena dat v zarizeni
 /// </summary>
 void gps_DeviceStateChanged(object sender, DeviceStateChangedEventArgs args)
 {
     device = args.DeviceState;
     // call the UpdateData method via the updateDataHandler so that we update the UI on the UI thread
     try
     {
         Invoke(updateDataHandler);
     }
     catch (NullReferenceException)
     {
     }
 }
Ejemplo n.º 7
0
 void _gps_DeviceStateChanged(object sender, DeviceStateChangedEventArgs args)
 {
     GpsDeviceState = args.DeviceState;
     PrintLn("GPS Device State Changed: " + GpsDeviceState);
 }