NFC / NDEF Library for Proximity APIs  4.1.0
Easily parse and create NDEF records with the Windows Proximity APIs / Near Field Communication NFC.
Public Types | Public Member Functions | Static Public Member Functions | Properties | List of all members
NdefLibrary.Ndef.NdefBtSecureSimplePairingRecord.BtServiceClasses Class Reference

Utility class to handle the Bluetooth Service Classes defined in the OOB data of the Secure Simple Pairing Record. More...

Public Types

enum  ServiceClassTypes : ushort {
  ServiceDiscoveryServerServiceClassID = 0x1000, BrowseGroupDescriptorServiceClassID = 0x1001, SerialPort = 0x1101, LANAccessUsingPPP = 0x1102,
  DialupNetworking = 0x1103, IrMCSync = 0x1104, OBEXObjectPush = 0x1105, OBEXFileTransfer = 0x1106,
  IrMCSyncCommand = 0x1107, Headset = 0x1108, CordlessTelephony = 0x1109, AudioSource = 0x110A,
  AudioSink = 0x110B, AV_RemoteControlTarget = 0x110C, AdvancedAudioDistribution = 0x110D, AV_RemoteControl = 0x110E,
  AV_RemoteControlController = 0x110F, Intercom = 0x1110, Fax = 0x1111, Headset_AudioGateway = 0x1112,
  WAP = 0x1113, WAP_CLIENT = 0x1114, PANU = 0x1115, NAP = 0x1116,
  GN = 0x1117, DirectPrinting = 0x1118, ReferencePrinting = 0x1119, BasicImagingProfile = 0x111A,
  ImagingResponder = 0x111B, ImagingAutomaticArchive = 0x111C, ImagingReferencedObjects = 0x111D, Handsfree = 0x111E,
  HandsfreeAudioGateway = 0x111F, DirectPrintingReferenceObjectsService = 0x1120, ReflectedUI = 0x1121, BasicPrinting = 0x1122,
  PrintingStatus = 0x1123, HumanInterfaceDeviceService = 0x1124, HardcopyCableReplacement = 0x1125, HCR_Print = 0x1126,
  HCR_Scan = 0x1127, Common_ISDN_Access = 0x1128, SIM_Access = 0x112D, PhonebookAccess_PCE = 0x112E,
  PhonebookAccess_PSE = 0x112F, PhonebookAccess = 0x1130, HeadsetHS = 0x1131, MessageAccessServer = 0x1132,
  MessageNotificationServer = 0x1133, MessageAccessProfile = 0x1134, GNSS = 0x1135, GNSS_Server = 0x1136,
  ThreeD_Display = 0x1137, ThreeD_Glasses = 0x1138, ThreeD_Synchronization = 0x1139, MPS_Profile_UUID = 0x113A,
  MPS_SC_UUID = 0x113B, PnPInformation = 0x1200, GenericNetworking = 0x1201, GenericFileTransfer = 0x1202,
  GenericAudio = 0x1203, GenericTelephony = 0x1204, UPNP_Service = 0x1205, UPNP_IP_Service = 0x1206,
  ESDP_UPNP_IP_PAN = 0x1300, ESDP_UPNP_IP_LAP = 0x1301, ESDP_UPNP_L2CAP = 0x1302, VideoSource = 0x1303,
  VideoSink = 0x1304, VideoDistribution = 0x1305, HDP = 0x1400, HDPSource = 0x1401,
  HDPSink = 0x1402
}
 Contains a list of currently valid Bluetooth service classes according to the specification. More...
 

Public Member Functions

int BitsPerServiceClass ()
 How many bit are used for each service class according to the current DataType setting in this instance. More...
 
int BytesPerServiceClass ()
 How many bytes are used for each service class according to the current DataType setting in this instance. More...
 
void AddServiceClassType (ServiceClassTypes newSc)
 Add a new service class to the list, specified as an enum value instead of a raw byte array. The method will take care of using the correct bit length to store the UUID, according to the setting in use for this instance. More...
 
 BtServiceClasses (byte scType, byte[] scData)
 Create a new instance of the Bluetooth Service Class and parse the supplied service class type (defines the UUID lengths) and data (contains the actual service class UUIDs). More...
 
 BtServiceClasses ()
 Create an empty instance of the Bluetooth Service Class helper. More...
 
byte [] ToByteArray ()
 Convert the properties currently stored in this class instance to a byte array, which can then be used to embed this information into OOB data payload of the parent Bluetooth Secure Simple Pairing record. More...
 

Static Public Member Functions

static string UuidAs128BitString (ServiceClassTypes serviceClassType)
 Format the specified service class type enum value as a string that represents the 128 bit format conversion. More...
 
static ServiceClassTypes UuidFrom128String (string uuid)
 Convert the specified service class string to a service class type enum value. More...
 
static ServiceClassTypes ConvertServiceClassToType (byte[] scBytes)
 Convert the specified service class byte array to the enum type for more convenient use in your app. More...
 

Properties

List< byte[]> ServiceClasses [get, set]
 Contains the list of raw byte values specifying the individual service classes assigned. The number of bits for each contained byte array corresponds to the service list type. More...
 
List< ServiceClassTypes > ServiceClassesAsTypes [get]
 Return the currently set service class values as a list of enum values for easier use within your own application. More...
 
OobDataTypes DataType [get, set]
 Defines the data structure of the service classes (complete / incomplete, 16, 32 or 128 bit per service class definition) More...
 

Detailed Description

Utility class to handle the Bluetooth Service Classes defined in the OOB data of the Secure Simple Pairing Record.

The service class UUIDs are defined as per the Bluetooth specificiation: https://www.bluetooth.org/en-us/specification/assigned-numbers/service-discovery The values can either be defined as 16 / 32 / 128 bit values. Most common are 16 bit values, as these are currently enough to cover all standardized Bluetooth use cases. It is possible to create a higher-bit value from a lower bit value, e.g. to create a 128 bit value from a 128 bit value. From the Bluetooth Specification 4.1 [Vol 3], page 228, section 2.5.1 128_bit_value = 16_bit_value * 2^96 + Bluetooth_Base_UUID 128_bit_value = 32_bit_value * 2^96 + Bluetooth_Base_UUID A 16-bit UUID may be converted to 32-bit UUID format by zero-extending the 16-bit value to 32-bits. An equivalent method is to add the 16-bit UUID value to a zero-valued 32-bit UUID.

Member Enumeration Documentation

◆ ServiceClassTypes

Contains a list of currently valid Bluetooth service classes according to the specification.

The enum defines the byte values that can be directly used for the service classes. For the complete list, see: https://www.bluetooth.org/en-us/specification/assigned-numbers/service-discovery

Constructor & Destructor Documentation

◆ BtServiceClasses() [1/2]

NdefLibrary.Ndef.NdefBtSecureSimplePairingRecord.BtServiceClasses.BtServiceClasses ( byte  scType,
byte []  scData 
)

Create a new instance of the Bluetooth Service Class and parse the supplied service class type (defines the UUID lengths) and data (contains the actual service class UUIDs).

Parameters
scTypeSpecifies the service class type, which has to be defined in the OobDataTypes enum and defines the number of bits used for each service class UUID (16 / 32 / 128 bits)
scDataByte array continaing one or more service class UUIDs, each in the bit length specified by the scType parameter.

◆ BtServiceClasses() [2/2]

NdefLibrary.Ndef.NdefBtSecureSimplePairingRecord.BtServiceClasses.BtServiceClasses ( )

Create an empty instance of the Bluetooth Service Class helper.

Member Function Documentation

◆ AddServiceClassType()

void NdefLibrary.Ndef.NdefBtSecureSimplePairingRecord.BtServiceClasses.AddServiceClassType ( ServiceClassTypes  newSc)

Add a new service class to the list, specified as an enum value instead of a raw byte array. The method will take care of using the correct bit length to store the UUID, according to the setting in use for this instance.

Parameters
newScNew service class type to add.

◆ BitsPerServiceClass()

int NdefLibrary.Ndef.NdefBtSecureSimplePairingRecord.BtServiceClasses.BitsPerServiceClass ( )

How many bit are used for each service class according to the current DataType setting in this instance.

Returns
Number of bits used for each service class - 16, 32 or 128.

◆ BytesPerServiceClass()

int NdefLibrary.Ndef.NdefBtSecureSimplePairingRecord.BtServiceClasses.BytesPerServiceClass ( )

How many bytes are used for each service class according to the current DataType setting in this instance.

Returns
Number of bytes used for each service class - 2, 4 or 16.

◆ ConvertServiceClassToType()

static ServiceClassTypes NdefLibrary.Ndef.NdefBtSecureSimplePairingRecord.BtServiceClasses.ConvertServiceClassToType ( byte []  scBytes)
static

Convert the specified service class byte array to the enum type for more convenient use in your app.

Parameters
scBytesByte array that contains the service class. Has to have a length of 2, 4 or 16 bytes.
Returns
The service class byte array converted the the enum value definition.
Exceptions
NdefExceptionThrown if the supplied byte array does not have a valid length.

◆ ToByteArray()

byte [] NdefLibrary.Ndef.NdefBtSecureSimplePairingRecord.BtServiceClasses.ToByteArray ( )

Convert the properties currently stored in this class instance to a byte array, which can then be used to embed this information into OOB data payload of the parent Bluetooth Secure Simple Pairing record.

Returns
The service class list converted to a byte array. The actual size of the byte array depends on the number of service classes set, as well as the number of bits used for each service class.

◆ UuidAs128BitString()

static string NdefLibrary.Ndef.NdefBtSecureSimplePairingRecord.BtServiceClasses.UuidAs128BitString ( ServiceClassTypes  serviceClassType)
static

Format the specified service class type enum value as a string that represents the 128 bit format conversion.

Parameters
serviceClassTypeThe service class type to represent as a string.
Returns
Service class type converted to a string that contains the 128 bit service class UUID.

◆ UuidFrom128String()

static ServiceClassTypes NdefLibrary.Ndef.NdefBtSecureSimplePairingRecord.BtServiceClasses.UuidFrom128String ( string  uuid)
static

Convert the specified service class string to a service class type enum value.

Only works for UUIDs that are based on the Bluetooth standard base UUID where only the first 16 / 32 bit are customized. The string needs to correspond to the schema: "xxxx-0000-1000-8000-00805f9b34fb", where xxxx is the 32-bit value used for the service class.

Parameters
uuidString-based UUID to parse
Returns
The converted service class type.

Property Documentation

◆ DataType

OobDataTypes NdefLibrary.Ndef.NdefBtSecureSimplePairingRecord.BtServiceClasses.DataType
getset

Defines the data structure of the service classes (complete / incomplete, 16, 32 or 128 bit per service class definition)

If you change this value, all the currently stored service classes will be automatically recreated based on the new bit length.

◆ ServiceClasses

List<byte[]> NdefLibrary.Ndef.NdefBtSecureSimplePairingRecord.BtServiceClasses.ServiceClasses
getset

Contains the list of raw byte values specifying the individual service classes assigned. The number of bits for each contained byte array corresponds to the service list type.

◆ ServiceClassesAsTypes

List<ServiceClassTypes> NdefLibrary.Ndef.NdefBtSecureSimplePairingRecord.BtServiceClasses.ServiceClassesAsTypes
get

Return the currently set service class values as a list of enum values for easier use within your own application.


The documentation for this class was generated from the following file: