/// <summary> /// Queries the device state. /// </summary> /// <returns>Device state information</returns> public GpsDeviceState GetDeviceState() //GpsInitialisation! { 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); //Prüfung ob Anbindung erfolgreich 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); }
static 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 if (updatePositionDataHandler != null) { updateDeviceDataHandler.Invoke(sender, args); } }
public DeviceStateChangedEventArgs(GpsDeviceState deviceState) { this.deviceState = deviceState; }
//GpsInitialisation! /// <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); //Prüfung ob Anbindung erfolgreich 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; }