How do I use bluetoothctl's gatt menu to make an RFCOMMM discoverable?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



have a very simple application that I've spent way too much time on.
I have a Raspberry pi 5, I've created a bluetooth serial port using rfcomm.
Now I want this new serial port to be announced by the rpi5.  Conceptually
simple.  I've spent time going through the bluetooth spec, and reading the
serial port profile spec.  It took some time to track things down, but I
enjoyed it and now I want to put my knowledge to use.

The bluetoothctl gatt menu looks like it has exactly the capability I want.
But I've had a very hard time understanding how to use it.  I haven't been
able to find good explanations or many examples of how to use it.

(1) Can anyone point me to examples and documentation of bluetoothctl's gatt?
Maybe I just haven't tried the right search terms and there is a trove sitting
out there.

I tried looking through the bluez user mailing list.
  http://news.gmane.org/gmane.linux.bluez.kernel
As referenced from here
  https://www.bluez.org/development/lists/
But I'm getting server not found.
The list at marc.info works.

I tried reading the source code for bluez/client.  But It's hopeless. I learned
a few things, but the effort is too high to find what I need.

I found blues/client/scripts.  That was helpful, but there aren't enough
examples to answer the questions I have.

I've found a number of docs like this:
  https://ubuntu.com/core/docs/bluez/reference/accessing-gatt-services
but they don't go into how to create gatt entries.

>From the serial port profile doc,
https://www.bluetooth.com/specifications/specs/serial-port-profile-1-1/,
I want to declare the following information.

ServiceClassIDList(0x0001)
ServicClass0 UUID  0x1101 == SerialPort
ProtocolDescriptorList(0x0004)
Protocol0 0x100 == L2CAP
Protocol1 0x3 == RFCOMMM
ProtocolSpecificParameter0 1 == channel #
ServiceName(0x0000) String "MySerialPort"

>From experimenting, I gather the gatt menu uses a nested strategy.
- Start with register-service
- continue by adding a characteristic with register-characteristic
- If the characteristic is a list, add entries to it using
  register-descriptor.

I tried
    version
    #Version 5.66

    register-service 0x1101 #(Serial port profile)
    #It asks it if this a primary service, I answer yes.

    # Here I'm trying to start the service class ID list.
    register-chacteristic 0x0001 read
    #Ooops, it is showing SDP.
    # [NEW] Characteristic (Handle 0x0000)
    #   /org/bluez/app/service0/chrc0
    #   0x0001
    #   SDP
    # And it's asking for a value.  What is the value for?
    # (2) What I'm I misunderstanding here?

    # Now I want to add a descriptor to the list.
    register-descriptor 0x1101 read
    # [NEW] Descriptor (Handle 0x0000)
    #    /org/bluez/app/service0/chrc0/desc0
    #    0x1101
    #    Serial Port
    # [/org/bluez/app/service0/chrc0/desc0] Enter value:
    # (3) Do I want to specify 0x1101 again, it was already
    #     used in register service?
    # (4) And again, what is the value it is asking for.

    # I would then go on to add other characteristics, but there
    # is no point in continuing without understing better.

    # If this had all worked, I would do
    register-application
    # And the service would be available for other bluetooth
    # devices to see.

(5)  I also don't understand when to use acquire-write, release-write
     and write.  Pointers for docs?

(6) Are there any other steps I have to do?  Do you see other
    glaring misconnections I have?

I think bluez is quite an amazing project.

Thanks




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux