예제 #1
0
파일: main.cs 프로젝트: GeEmS/ipoki
 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);
 }
예제 #2
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);
        }
예제 #3
0
파일: GPS.cs 프로젝트: jose91enrique/ipoki
        /// <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;
        }
예제 #4
0
파일: main.cs 프로젝트: jose91enrique/ipoki
 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;
 }
예제 #6
0
 public DeviceStateChangedEventArgs(GpsDeviceState deviceState)
 {
     this.deviceState = deviceState;
 }