summaryrefslogtreecommitdiffstats
path: root/README.md
blob: fcfd0a1a2044f0a909d7c182dbd95ec200571ee5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

@media only all and (prefers-color-scheme: dark) {
.highlight .hll { background-color: #49483e }
.highlight .c { color: #75715e } /* Comment */
.highlight .err { color: #960050; background-color: #1e0010 } /* Error */
.highlight .k { color: #66d9ef } /* Keyword */
.highlight .l { color: #ae81ff } /* Literal */
.highlight .n { color: #f8f8f2 } /* Name */
.highlight .o { color: #f92672 } /* Operator */
.highlight .p { color: #f8f8f2 } /* Punctuation */
.highlight .ch { color: #75715e } /* Comment.Hashbang */
.highlight .cm { color: #75715e } /* Comment.Multiline */
.highlight .cp { color: #75715e } /* Comment.Preproc */
.highlight .cpf { color: #75715e } /* Comment.PreprocFile */
.highlight .c1 { color: #75715e } /* Comment.Single */
.highlight .cs { color: #75715e } /* Comment.Special */
.highlight .gd { color: #f92672 } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gi { color: #a6e22e } /* Generic.Inserted */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #75715e } /* Generic.Subheading */
.highlight .kc { color: #66d9ef } /* Keyword.Constant */
.highlight .kd { color: #66d9ef } /* Keyword.Declaration */
.highlight .kn { color: #f92672 } /* Keyword.Namespace */
.highlight .kp { color: #66d9ef } /* Keyword.Pseudo */
.highlight .kr { color: #66d9ef } /* Keyword.Reserved */
.highlight .kt { color: #66d9ef } /* Keyword.Type */
.highlight .ld { color: #e6db74 } /* Literal.Date */
.highlight .m { color: #ae81ff } /* Literal.Number */
.highlight .s { color: #e6db74 } /* Literal.String */
.highlight .na { color: #a6e22e } /* Name.Attribute */
.highlight .nb { color: #f8f8f2 } /* Name.Builtin */
.highlight .nc { color: #a6e22e } /* Name.Class */
.highlight .no { color: #66d9ef } /* Name.Constant */
.highlight .nd { color: #a6e22e } /* Name.Decorator */
.highlight .ni { color: #f8f8f2 } /* Name.Entity */
.highlight .ne { color: #a6e22e } /* Name.Exception */
.highlight .nf { color: #a6e22e } /* Name.Function */
.highlight .nl { color: #f8f8f2 } /* Name.Label */
.highlight .nn { color: #f8f8f2 } /* Name.Namespace */
.highlight .nx { color: #a6e22e } /* Name.Other */
.highlight .py { color: #f8f8f2 } /* Name.Property */
.highlight .nt { color: #f92672 } /* Name.Tag */
.highlight .nv { color: #f8f8f2 } /* Name.Variable */
.highlight .ow { color: #f92672 } /* Operator.Word */
.highlight .w { color: #f8f8f2 } /* Text.Whitespace */
.highlight .mb { color: #ae81ff } /* Literal.Number.Bin */
.highlight .mf { color: #ae81ff } /* Literal.Number.Float */
.highlight .mh { color: #ae81ff } /* Literal.Number.Hex */
.highlight .mi { color: #ae81ff } /* Literal.Number.Integer */
.highlight .mo { color: #ae81ff } /* Literal.Number.Oct */
.highlight .sa { color: #e6db74 } /* Literal.String.Affix */
.highlight .sb { color: #e6db74 } /* Literal.String.Backtick */
.highlight .sc { color: #e6db74 } /* Literal.String.Char */
.highlight .dl { color: #e6db74 } /* Literal.String.Delimiter */
.highlight .sd { color: #e6db74 } /* Literal.String.Doc */
.highlight .s2 { color: #e6db74 } /* Literal.String.Double */
.highlight .se { color: #ae81ff } /* Literal.String.Escape */
.highlight .sh { color: #e6db74 } /* Literal.String.Heredoc */
.highlight .si { color: #e6db74 } /* Literal.String.Interpol */
.highlight .sx { color: #e6db74 } /* Literal.String.Other */
.highlight .sr { color: #e6db74 } /* Literal.String.Regex */
.highlight .s1 { color: #e6db74 } /* Literal.String.Single */
.highlight .ss { color: #e6db74 } /* Literal.String.Symbol */
.highlight .bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #a6e22e } /* Name.Function.Magic */
.highlight .vc { color: #f8f8f2 } /* Name.Variable.Class */
.highlight .vg { color: #f8f8f2 } /* Name.Variable.Global */
.highlight .vi { color: #f8f8f2 } /* Name.Variable.Instance */
.highlight .vm { color: #f8f8f2 } /* Name.Variable.Magic */
.highlight .il { color: #ae81ff } /* Literal.Number.Integer.Long */
}
@media (prefers-color-scheme: light) {
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.highlight .py { color: #336699; font-weight: bold } /* Name.Property */
.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #336699 } /* Name.Variable */
.highlight .ow { color: #008800 } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */
.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
.highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
.highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */
.highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
.highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */
.highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */
.highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
.highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */
.highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */
.highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */
.highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */
.highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */
.highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */
.highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */
.highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */
.highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */
.highlight .vc { color: #336699 } /* Name.Variable.Class */
.highlight .vg { color: #dd7700 } /* Name.Variable.Global */
.highlight .vi { color: #3333bb } /* Name.Variable.Instance */
.highlight .vm { color: #336699 } /* Name.Variable.Magic */
.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
}
##Wifi Manager
This folder include Bluetooth manager binding and GUI.

##Function
- Power on/off
- Scan start/stop
- Pair
- Connect (After pairing, support incoming connect as well)
- Disconnect
- Remove

##Guidance for building Bluetooth manager Binding
A. Prepare sdk environment
   - bitbake below:
     $ bitbake agl-demo-platform-crosssdk
   - install sdk
     $ build/tmp/deploy/sdk/poky-agl-glibc*.sh
B. Build
   - Go to folder where Bluetooth Bindings source code exists
   - run below command for setup and make
     $ . /opt/poky-agl/xxx/environment-setup-cortexa15hf-vfp-neon-poky-linux-gnueabi
     $ mkdir build
     $ cmake ..
     $ make 
     <widget wll be generated>	
C. Running app
   - copy widget to porter board
   - do install and start the app
     # afm-util install *.wgt
     # afm-util start <apps's name>@0.1

##TODO
- ADD token security
- ADD event receive
f='#n339'>339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355
# Bluetooth Service

## Overview

Bluetooth service uses the respective BlueZ package to connect to bluetooth devices

## Verbs

| Name               | Description                                             | JSON Response                                                           |
|--------------------|---------------------------------------------------------|-------------------------------------------------------------------------|
| subscribe          | subscribe to bluetooth events                           | *Request:* {"value": "device_changes"}                                  |
| unsubscribe        | unsubscribe to bluetooth events                         | *Request:* {"value": "device_changes"}                                  |
| managed_objects    | retrieve managed bluetooth devices                      | see managed_objects verb section                                        |
| adapter_state      | retrieve or change adapter scan settings                | see adapter_state verb section                                          |
| default_adapter    | retrieve or change default adapter setting              | *Request:* {"adapter": "hci1"}                                          |
| avrcp_controls     | avrcp controls for MediaPlayer1 playback                | see avrcp_controls verb section                                         |
| connect            | connect to already paired device                        | see connect/disconnect verb section                                     |
| disconnect         | disconnect to already connected device                  | see connect/disconnect verb section                                     |
| pair               | initialize a pairing request                            | *Request:* {"device":"dev_88_0F_10_96_D3_20"}                           |
| cancel_pairing     | cancel an outgoing pair request                         |                                                                         |
| confirm_pairing    | confirm incoming/outgoing bluetooth pairing pincode     | *Request:* {"pincode": 31415}                                           |
| remove_device      | remove already paired device                            | *Request:* {"device": "dev_88_0F_10_96_D3_20"}                          |


### managed_objects verb

This verb allows an client to get initial paired devices, and discovered unpaired devices before subscriptio to *devices_changed* event.

<pre>
{
  "response": {
    "adapters": [
      {
        "name": "hci0",
        "properties": {
          "address": "00:1A:7D:DA:71:0F",
          "powered": true,
          "discoverable": true,
          "discoverabletimeout": 180,
          "pairable": true,
          "pairabletimeout": 0,
          "discovering": true,
          "uuids": [
            "00001112-0000-1000-8000-00805f9b34fb",
            "00001801-0000-1000-8000-00805f9b34fb",
            "0000110e-0000-1000-8000-00805f9b34fb",
            "00001800-0000-1000-8000-00805f9b34fb",
            "00001200-0000-1000-8000-00805f9b34fb",
            "0000110c-0000-1000-8000-00805f9b34fb",
            "0000110b-0000-1000-8000-00805f9b34fb",
            "0000110a-0000-1000-8000-00805f9b34fb",
            "0000111e-0000-1000-8000-00805f9b34fb",
            "0000111f-0000-1000-8000-00805f9b34fb",
            "00001108-0000-1000-8000-00805f9b34fb"
          ]
        }
      }
    ],
    "devices": [
      {
        "adapter": "hci0",
        "device": "dev_F8_34_41_DA_BA_46",
        "properties": {
          "address": "F8:34:41:DA:BA:46",
          "name": "roguebox",
          "alias": "roguebox",
          "class": 1835276,
          "icon": "computer",
          "paired": false,
          "trusted": false,
          "blocked": false,
          "legacypairing": false,
          "rssi": -63,
          "connected": false,
          "uuids": [
            "0000110e-0000-1000-8000-00805f9b34fb",
            "0000110c-0000-1000-8000-00805f9b34fb",
            "00001112-0000-1000-8000-00805f9b34fb",
            "00001108-0000-1000-8000-00805f9b34fb",
            "00001133-0000-1000-8000-00805f9b34fb",
            "00001132-0000-1000-8000-00805f9b34fb",
            "0000112f-0000-1000-8000-00805f9b34fb",
            "00001104-0000-1000-8000-00805f9b34fb",
            "00001106-0000-1000-8000-00805f9b34fb",
            "00001105-0000-1000-8000-00805f9b34fb",
            "0000110a-0000-1000-8000-00805f9b34fb",
            "0000110b-0000-1000-8000-00805f9b34fb",
            "00005005-0000-1000-8000-0002ee000001"
          ],
          "modalias": "usb:v1D6Bp0246d0530",
          "adapter": "/org/bluez/hci0",
          "txpower": 12,
          "servicesresolved": false
        }
      },
      {
        "adapter": "hci0",
        "device": "dev_67_13_E2_57_29_0F",
        "properties": {
          "address": "68:13:E2:57:29:0F",
          "alias": "67-13-E2-57-29-0F",
          "paired": false,
          "trusted": false,
          "blocked": false,
          "legacypairing": false,
          "rssi": -69,
          "connected": false,
          "uuids": [],
          "adapter": "/org/bluez/hci0",
          "servicesresolved": false
        }
      },
    ],
    "transports": [
      {
          "endpoint": "fd1",
          "adapter": "hci0",
          "device": "dev_D0_81_7A_5A_BC_5E",
          "properties": {
            "uuid": "0000110B-0000-1000-8000-00805F9B34FB",
            "state": "idle",
            "volume": 127
          }
      }
   ],
}
</pre>


### adapter_state verb

#### adapter_state verb allows setting and retrieving of requested adapter settings

| Name            | Description                                                            |
|-----------------|------------------------------------------------------------------------|
| adapter         | Must be the name of the adapter (i.e. hci0)                            |
| discovery       | Discover nearby broadcasting devices                                   |
| discoverable    | Allow other devices to detect this device                              |
| powered         | Adapter power state (optional, rfkill should be disabled already)      |

#### adapter_state verb write-only parameters

| Name            | Description                                                              |
|-----------------|--------------------------------------------------------------------------|
| filter          | Scan for devices only with respective UUIDS listed                       |
| transport       | Scan for devices with only defined transport type (e.g. auto, bredr, le) |

### avrcp_controls verb

avrcp_controls verb allow controlling the playback of the defined device

| Name            | Description                                                                                  |
|-----------------|----------------------------------------------------------------------------------------------|
| adapter         | Name of the adapter (i.e. hci0)                                                              |
| device          | Must be the name of the device (i.e. dev_88_0F_10_96_D3_20)                                  |
| action          | Playback control action to take (e.g Play, Pause, Stop, Next, Previous, FastForward, Rewind) |

### connect/disconnect verbs

NOTE: uuid in this respect is not related to the afb framework but the Bluetooth profile UUID

To connect/disconnect using the respective verb with all known and authenticated profiles:

<pre>
  {"device": "dev_88_0F_10_96_D3_20"}
</pre>

To do the same for the respective device, verb, and for singular profile

<pre>
  {"device": "dev_88_0F_10_96_D3_20", "uuid": "0000110e-0000-1000-8000-00805f9b34fb"}
</pre>

## Events

| Name              | Description                              | JSON Event Data                           |
|-------------------|------------------------------------------|-------------------------------------------|
| adapter_changes   | report on Bluetooth adapter states       | see adapter_changes event section         |
| device_changes    | report on Bluetooth devices              | see device_changes event section          |
| media             | report on MediaPlayer1 events            | see media event section                   |
| agent             | PIN from BlueZ agent for confirmation    | see agent event section                   |


### adapter_changes event

Sample of adding new adapter event:

<pre>
{
  "adapter": "hci0",
  "action": "added",
  "properties": {
    "address": "60:30:D4:66:55:A7",
    "powered": false,
    "discoverable": false,
    "discoverabletimeout": 180,
    "pairable": true,
    "pairabletimeout": 0,
    "discovering": false,
    "uuids": [
      "00001801-0000-1000-8000-00805f9b34fb",
      "0000110e-0000-1000-8000-00805f9b34fb",
      "00001200-0000-1000-8000-00805f9b34fb",
      "00001800-0000-1000-8000-00805f9b34fb",
      "0000111e-0000-1000-8000-00805f9b34fb",
      "0000110c-0000-1000-8000-00805f9b34fb"
    ]
  }
}
</pre>

Sample of adapter property changes:

<pre>
{
  "adapter": "hci0",
  "action": "changed",
  "properties": {
    "powered": false,
    "discovering": false,
    "discoverable": false
  }
}
</pre>

Sample of adapter being removed:

<pre>
{
  "adapter": "hci0",
  "action": "removed",
}
</pre>

### device_changes event

Sample of discovering a new device event:

<pre>
{
  "adapter": "hci0",
  "device": "dev_88_0F_10_96_D3_20",
  "action": "added",
  "properties": {
    "address": "88:0F:10:96:D3:20",
    "name": "MI_SCALE",
    "alias": "MI_SCALE",
    "class": 7995916,
    "icon": "phone",
    "paired": false,
    "trusted": false,
    "blocked": false,
    "legacypairing": false,
    "rssi": -55,
    "connected": false,
    "uuids": [
      "00001200-0000-1000-8000-00805f9b34fb",
      "0000111f-0000-1000-8000-00805f9b34fb",
      "0000112f-0000-1000-8000-00805f9b34fb",
      "0000110a-0000-1000-8000-00805f9b34fb",
      "0000110c-0000-1000-8000-00805f9b34fb",
      "00001116-0000-1000-8000-00805f9b34fb",
      "00001132-0000-1000-8000-00805f9b34fb",
      "00000000-deca-fade-deca-deafdecacafe",
      "02030302-1d19-415f-86f2-22a2106a0a77",
      "2d8d2466-e14d-451c-88bc-7301abea291a"
    ],
    "adapter": "/org/bluez/hci0",
    "servicesresolved": false
  }
}
</pre>

Changed status events for a device:

<pre>
{
  "adapter": "hci0",
  "device": "dev_88_0F_10_96_D3_20",
  "action": "changed",
  "properties": {
    "connected": true
  }
}
</pre>

### media event

Playing audio reporting event (not all fields will be passed in every event):

<pre>
{
        "adapter": "hci0",
        "device": "dev_D0_81_7A_5A_BC_5E",
        "type": "playback",
        "track": {
                "title": "True Colors",
                "duration": 228000,
                "album": "True Colors",
                "tracknumber": 6,
                "artist": "Zedd",
                "numberoftracks": 11,
                "genre": "Dance & DJ/General"
        },
        "position": 5600,
        "status": "playing"
        "connected": false
}
</pre>

A2DP transport addition/removal (some fields are optional):

<pre>
{
        "adapter": "hci0",
        "device": "dev_D0_81_7A_5A_BC_5E",
        "action": "added",
        "type": "transport",
        "endpoint": "fd0"
        "properties": {
                "uuid": "0000110B-0000-1000-8000-00805F9B34FB",
                "state": "idle",
                "volume": 127
         },
}
...
{
        "adapter": "hci0",
        "device": "dev_D0_81_7A_5A_BC_5E",
        "action": "removed",
        "type": "transport",
        "endpoint": "fd0"
}
</pre>

### agent event

After pairing request agent will send event for a pincode that must be confirmed on both sides:

<pre>
{
  "adapter": "hci0",
  "device": "dev_88_OF_10_96_D3_20",
  "action": "request_confirmation",
  "pincode": 327142
}
</pre>

If pairing is canceled or fails:

<pre>
{
  "action": "canceled_pairing"
}
</pre>