Skip to content

Cannot apply ServiceRecord #443

@Taro7x3

Description

@Taro7x3

Service records created using ServiceRecordBuilder(); cannot be applied to BluetoothListener.ServiceRecord.

var serviceClass = new Guid("00001101-0000-1000-8000-00805F9B34FB");
var serviceName = "Virtual Printer";

var builder = new ServiceRecordBuilder();

builder.AddServiceClass(BluetoothService.SerialPort);
builder.AddServiceClass(BluetoothService.BasicPrinting);
builder.AddServiceClass(BluetoothService.PrintingStatus);
builder.ServiceName = serviceName;

builder.AddCustomAttribute(new ServiceAttribute(0x0304,
    ServiceElement.CreateNumericalServiceElement(ElementType.UInt16, 0x0001)));

ServiceRecord record = builder.ServiceRecord;

listener = new BluetoothListener(serviceClass) 
{
    ServiceRecord = record
};

var radio = BluetoothRadio.PrimaryRadio;
if (radio != null)
{
    radio.Mode = RadioMode.Discoverable;
}

listener.Start();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions