Method FromAccessory
FromAccessory(EAAccessory, String)
Creates a NMEA LocationDataSource based on an iOS ExternalAccessory.EAAccessory.
Declaration
public static NmeaLocationDataSource FromAccessory(EAAccessory accessory, string protocol)
Parameters
Type | Name | Description |
---|---|---|
ExternalAccessory.EAAccessory | accessory | The accessory to read NMEA from. |
System.String | protocol | The accessory protocol used to read data. See ExternalAccessory.EAAccessory.ProtocolStrings for a list of supported strings on the accessory. |
Returns
Type | Description |
---|---|
NmeaLocationDataSource | A NMEA Location Datasource that reads from the specified accessory |
Remarks
The created datasource will automatically handle opening the specified accessory and reading data from it when the datasource is started. Once the datasource has been started, the NmeaDataStream will be available.
To use the device in an iOS app, ensure the device is supported and enabled in Info.plist
. For example this is required to enable support for a Bad Elf GPS receiver:
<key>UISupportedExternalAccessoryProtocols</key>
<array>
<string>com.bad-elf.gps</string>
</array>
To obtain a supported accessory use the ExternalAccessory.EAAccessoryManager.ConnectedAccessories property and search by name:
foreach (var accessory in ExternalAccessory.EAAccessoryManager.SharedAccessoryManager.ConnectedAccessories)
{
if (accessory.Name == "Bad Elf GNSS Surveyor")
{
return NmeaLocationDataSource.FromAccessory(accessory, "com.bad-elf.gps");
}
}
Applies to
Platforms and versions
Target | Versions |
---|---|
.NET iOS | 200.0 - 200.8 |
Xamarin.iOS | 100.10 - 100.15 |