From edf63d3fc25d759754cf0c457b618eabfb4ef9df Mon Sep 17 00:00:00 2001 From: Morten Nielsen Date: Fri, 25 Jul 2014 12:58:49 -0700 Subject: [PATCH] Update README.md --- README.md | 76 ++++--------------------------------------------------- 1 file changed, 5 insertions(+), 71 deletions(-) diff --git a/README.md b/README.md index ec81567..1c1e77a 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,9 @@ Nmea Parser ========= -Library for handling data NMEA streams coming in from Bluetooth devices in Windows Store and Windows Phone. +Library for handling data NMEA streams coming in from Bluetooth devices in Windows Store and Windows Phone, and Serial ports in Windows Desktop apps. + +There's also generic support for NMEA files (for simulation/playback) and raw streams. This library makes it easy to connect and listen for NMEA messages from Bluetooth Devices in Windows Store and Windows Phone apps. @@ -26,75 +28,7 @@ public class Gprmc : NmeaMessage If you add new messages, please fork, provide a simple unit test for the message and submit a pull request. -Usage - Windows Store +Usage ===================== -Ensure the bluetooth capability is enabled by opening package.appxmanifest in a text editor, and add the following to the section: -``` - - - - - -``` -See more here on bluetooth device capabilities in WinStore: http://msdn.microsoft.com/en-us/library/windows/apps/dn263090.aspx - -``` -//Get list of devices -string serialDeviceType = RfcommDeviceService.GetDeviceSelector(RfcommServiceId.SerialPort); -var devices = await DeviceInformation.FindAllAsync(serialDeviceType); -//Select device by name (in this case TruePulse 360B Laser Range Finder) -var TruePulse360B = devices.Where(t => t.Name.StartsWith("TP360B-")).FirstOrDefault(); -//Get service -RfcommDeviceService rfcommService = await RfcommDeviceService.FromIdAsync(TruePulse360B.Id); -if (rfcommService != null) -{ - var rangeFinder = new NmeaParser.BluetoothDevice(rfcommService); - rangeFinder.MessageReceived += device_NmeaMessageReceived; - await rangeFinder.StartAsync(); -} -... -private void device_NmeaMessageReceived(NmeaParser.NmeaDevice sender, NmeaParser.Nmea.NmeaMessage args) -{ - // called when a message is received -} - -``` - - -Usage - Windows Phone -====================== -Ensure the "ID_CAP_PROXIMITY" capability is enabled in the WMAppManifest.xml file. -``` - -// Search for all paired devices -PeerFinder.AlternateIdentities["Bluetooth:Paired"] = ""; -//Get all devices -var devices = await PeerFinder.FindAllPeersAsync(); -//Select device by name (in this case TruePulse 360B Laser Range Finder) -var TruePulse360B = devices.Where(t => t.DisplayName.StartsWith("TP360B-")).FirstOrDefault(); -if (TruePulse360B != null) -{ - var device = new NmeaParser.BluetoothDevice((PeerInformation)TruePulse360B); - device.MessageReceived += device_NmeaMessageReceived; -} -... -private void device_NmeaMessageReceived(NmeaParser.NmeaDevice sender, NmeaParser.Nmea.NmeaMessage args) -{ - // called when a message is received -} -``` - -Usage - Windows Desktop -====================== -``` - var port = new System.IO.Ports.SerialPort("COM3", 9600); - var device = new NmeaParser.SerialPortDevice(port); - device.MessageReceived += device_NmeaMessageReceived; -... -private void device_NmeaMessageReceived(NmeaParser.NmeaDevice sender, NmeaParser.Nmea.NmeaMessage args) -{ - // called when a message is received -} -``` - +Please see the [WIKI](/dotMorten/NmeaParser/wiki) how to use it on the various platforms