In The Hand
ServiceRecordBuilder Class
NamespacesInTheHand.Net.BluetoothServiceRecordBuilder
.NET Components for Mobility
Provides a simple way to build a ServiceRecord, including ServiceClassIds and ServiceNames attributes etc.
Declaration Syntax
C#Visual Basic
public class ServiceRecordBuilder
Public Class ServiceRecordBuilder
Members
All MembersConstructorsMethodsProperties



IconMemberDescription
ServiceRecordBuilder()()()
Create a new instance of the ServiceRecordBuilder class.

AddBluetoothProfileDescriptor(Guid, Byte, Byte)
AddCustomAttribute(ServiceAttribute)
Add a custom attribute.

AddCustomAttributes(IEnumerable<(Of <(ServiceAttribute>)>))
Add a set of custom attribute.

AddCustomAttributes(IEnumerable)
Add a set of custom attribute.

AddCustomAttributes(array<ServiceAttribute>[]()[])
Add a set of custom attribute.

AddServiceClass(Guid)
Add a Service Class Id.

AddServiceClass(UInt16)
Add a Service Class Id.

AddServiceClass(UInt32)
Add a Service Class Id.

AddServiceClass(Int32)
Add a Service Class Id.

Equals(Object)
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Finalize()()()
Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
(Inherited from Object.)
FromJsr82ServerUri(String)
Converts a Java JSR 82 Bluetooth server URL into a ServiceRecordBuilder instance.

GetHashCode()()()
Serves as a hash function for a particular type.
(Inherited from Object.)
GetType()()()
Gets the Type of the current instance.
(Inherited from Object.)
MemberwiseClone()()()
Creates a shallow copy of the current Object.
(Inherited from Object.)
ProtocolType
Get or set which type of element will be added for the ProtocolDescriptorList attribute.

ProviderName
Get or set a value for the ProviderName attribute.

ServiceDescription
Get or set a value for the ServiceDescription attribute.

ServiceName
Get or set a value for the ServiceName attribute.

ServiceRecord
Gets the ServiceRecord instance constructed by the specified ServiceRecordBuilder instance.

ToString()()()
Returns a String that represents the current Object.
(Inherited from Object.)
Remarks

The service’s Class Id can be set with the AddServiceClass()()() (etc) methods, the protocol stack set with the ProtocolType property (default RFCOMM), and the Service Name set with the ServiceName property. Other properties and methods exist for controlling the more advanced attributes.

Adding the standard text-string attributes (ServiceName etc) is normally quite difficult due to the very baroque manner of specifying these strings’ character encoding and natural language. The builder handles all the complexity internally; the strings are written in UTF-8 encoding and marked as 'English' language.

Examples
CopyC#
ServiceRecordBuilder bldr = new ServiceRecordBuilder();
bldr.AddServiceClass(BluetoothService.SerialPort);
bldr.ServiceName = "Alan's SPP service";
// 
ServiceRecord rcd = bldr.ServiceRecord;
CopyC#
ServiceRecordBuilder bldr = new ServiceRecordBuilder();
bldr.ProtocolType = BluetoothProtocolDescriptorType.GeneralObex;
bldr.AddServiceClass(BluetoothService.ObexFileTransfer);
bldr.ServiceName = "Alan's FTP service";
// 
ServiceRecord rcd = bldr.ServiceRecord;
Inheritance Hierarchy
Object
ServiceRecordBuilder

Assembly: InTheHand.Net.Personal (Module: InTheHand.Net.Personal) Version: 3.0.0.0