This website is available for multi language.

Document

obnizのハードウェアやクラウドの仕様や特徴について


ble.peripheral

use obniz as peripheral

request: advertisement_start

Related item

path type conditions description
ble.advertisement.adv_data bleAdvertiseData
  • required
 
ble.advertisement.scan_resp bleAdvertiseData    
// Json Example
[
    {
        "ble": {
            "advertisement": {
                "adv_data": [2, 1, 26, 7, 9, 83, 97, 109, 112, 108, 101],
                "scan_resp": [7, 9, 83, 97, 109, 112, 108, 101]
            }
        }
    }
]

request: advertisement_stop

path type conditions description
ble.advertisement null
  • required
 
// Json Example
[
    {
        "ble": {
            "advertisement": null
        }
    }
]

request: service_start

callback of external device connected

Related item

path type conditions description
ble.peripheral.services[].uuid uuid
  • required
 
ble.peripheral.services[].characteristics[].uuid uuid
  • required
 
ble.peripheral.services[].characteristics[].data dataArray    
ble.peripheral.services[].characteristics[].properties[] string
  • enum
    • "broadcast"
    • "read"
    • "write_without_response"
    • "write"
    • "notify"
    • "indicate"
    • "auth"
    • "extended_properties"
 
ble.peripheral.services[].characteristics[].permissions[] string
  • default read,write
  • enum
    • "read"
    • "read_encrypted"
    • "read_encrypted_mitm"
    • "write"
    • "write_encrypted"
    • "write_encrypted_mitm"
    • "write_signed"
    • "write_signed_mitm"
 
ble.peripheral.services[].characteristics[].descriptors[].uuid uuid
  • required
 
ble.peripheral.services[].characteristics[].descriptors[].data dataArray    
ble.peripheral.services[].characteristics[].descriptors[].permissions[] string
  • default read,write
  • enum
    • "read"
    • "read_encrypted"
    • "read_encrypted_mitm"
    • "write"
    • "write_encrypted"
    • "write_encrypted_mitm"
    • "write_signed"
    • "write_signed_mitm"
 
// Json Example
[
    {
        "ble": {
            "peripheral": {
                "services": [
                    {
                        "uuid": "e1cfb0d1-ae63-4d6f-b3b6-de2054f87e5e",
                        "characteristics": [
                            {
                                "uuid": "8d3591bda71140fd8f9f00535fe57179",
                                "data": [16, 34, 242],
                                "properties": [
                                    "broadcast"
                                ],
                                "permissions": [
                                    [
                                        "read",
                                        "write"
                                    ]
                                ],
                                "descriptors": [
                                    {
                                        "uuid": "d822b53c",
                                        "data": [100, 255, 21, 0, 21],
                                        "permissions": [
                                            [
                                                "read",
                                                "write"
                                            ]
                                        ]
                                    }
                                ]
                            }
                        ]
                    }
                ]
            }
        }
    }
]

request: service_stop

path type conditions description
ble.peripheral.stop_service.service_uuid uuid
  • required
 
// Json Example
[
    {
        "ble": {
            "peripheral": {
                "stop_service": {
                    "service_uuid": "e1cfb0d1-ae63-4d6f-b3b6-de2054f87e5e"
                }
            }
        }
    }
]

request: service_stop_all

path type conditions description
ble.peripheral null
  • required
 
// Json Example
[
    {
        "ble": {
            "peripheral": null
        }
    }
]

request: characteristic_read

read characteristic on own service

Related item

path type conditions description
ble.peripheral.read_characteristic.service_uuid uuid
  • required
 
ble.peripheral.read_characteristic.characteristic_uuid uuid
  • required
 
// Json Example
[
    {
        "ble": {
            "peripheral": {
                "read_characteristic": {
                    "service_uuid": "e1cfb0d1-ae63-4d6f-b3b6-de2054f87e5e",
                    "characteristic_uuid": "8d3591bda71140fd8f9f00535fe57179"
                }
            }
        }
    }
]

request: characteristic_write

write characteristic on own service

Related item

path type conditions description
ble.peripheral.write_characteristic.service_uuid uuid
  • required
 
ble.peripheral.write_characteristic.characteristic_uuid uuid
  • required
 
ble.peripheral.write_characteristic.data dataArray
  • required
 
// Json Example
[
    {
        "ble": {
            "peripheral": {
                "write_characteristic": {
                    "service_uuid": "e1cfb0d1-ae63-4d6f-b3b6-de2054f87e5e",
                    "characteristic_uuid": "8d3591bda71140fd8f9f00535fe57179",
                    "data": [16, 34, 242]
                }
            }
        }
    }
]

request: descriptor_read

read descriptor on own service

Related item

path type conditions description
ble.peripheral.read_descriptor.service_uuid uuid
  • required
 
ble.peripheral.read_descriptor.characteristic_uuid uuid
  • required
 
ble.peripheral.read_descriptor.descriptor_uuid uuid    
// Json Example
[
    {
        "ble": {
            "peripheral": {
                "read_descriptor": {
                    "service_uuid": "e1cfb0d1-ae63-4d6f-b3b6-de2054f87e5e",
                    "characteristic_uuid": "8d3591bda71140fd8f9f00535fe57179",
                    "descriptor_uuid": "d822b53c"
                }
            }
        }
    }
]

request: descriptor_write

write descriptor on own service

Related item

path type conditions description
ble.peripheral.write_descriptor.service_uuid uuid
  • required
 
ble.peripheral.write_descriptor.characteristic_uuid uuid
  • required
 
ble.peripheral.write_descriptor.descriptor_uuid uuid
  • required
 
ble.peripheral.write_descriptor.data dataArray
  • required
 
// Json Example
[
    {
        "ble": {
            "peripheral": {
                "write_descriptor": {
                    "service_uuid": "e1cfb0d1-ae63-4d6f-b3b6-de2054f87e5e",
                    "characteristic_uuid": "8d3591bda71140fd8f9f00535fe57179",
                    "descriptor_uuid": "d822b53c",
                    "data": [16, 34, 242]
                }
            }
        }
    }
]

response: status

path type conditions description
ble.peripheral.connection_status.address deviceAddress
  • required
 
ble.peripheral.connection_status.status string
  • required
  • enum
    • "connected"
    • "disconnected"
 
//Response Example
[
    {
        "ble": {
            "peripheral": {
                "connection_status": {
                    "address": "77e754ab8591",
                    "status": "connected"
                }
            }
        }
    }
]

response: characteristic_read

callback of read characteristic

path type conditions description
ble.peripheral.read_characteristic_result.service_uuid uuid
  • required
 
ble.peripheral.read_characteristic_result.characteristic_uuid uuid
  • required
 
ble.peripheral.read_characteristic_result.data dataArray
  • required
 
ble.peripheral.read_characteristic_result.result string
  • required
  • enum
    • "success"
    • "failed"
 
//Response Example
[
    {
        "ble": {
            "peripheral": {
                "read_characteristic_result": {
                    "service_uuid": "e1cfb0d1-ae63-4d6f-b3b6-de2054f87e5e",
                    "characteristic_uuid": "8d3591bda71140fd8f9f00535fe57179",
                    "data": [16, 34, 242],
                    "result": "success"
                }
            }
        }
    }
]

response: characteristic_write

callback of write characteristic

path type conditions description
ble.peripheral.write_characteristic_result.service_uuid uuid
  • required
 
ble.peripheral.write_characteristic_result.characteristic_uuid uuid
  • required
 
ble.peripheral.write_characteristic_result.result string
  • required
  • enum
    • "success"
    • "failed"
 
//Response Example
[
    {
        "ble": {
            "peripheral": {
                "write_characteristic_result": {
                    "service_uuid": "e1cfb0d1-ae63-4d6f-b3b6-de2054f87e5e",
                    "characteristic_uuid": "8d3591bda71140fd8f9f00535fe57179",
                    "result": "success"
                }
            }
        }
    }
]

response: characteristic_notify_read

callback of external device read characteristic

path type conditions description
ble.peripheral.notify_read_characteristic.address deviceAddress
  • required
 
ble.peripheral.notify_read_characteristic.service_uuid uuid
  • required
 
ble.peripheral.notify_read_characteristic.characteristic_uuid uuid
  • required
 
//Response Example
[
    {
        "ble": {
            "peripheral": {
                "notify_read_characteristic": {
                    "address": "77e754ab8591",
                    "service_uuid": "e1cfb0d1-ae63-4d6f-b3b6-de2054f87e5e",
                    "characteristic_uuid": "8d3591bda71140fd8f9f00535fe57179"
                }
            }
        }
    }
]

response: characteristic_notify_write

callback of external device write characteristic

path type conditions description
ble.peripheral.notify_write_characteristic.address deviceAddress
  • required
 
ble.peripheral.notify_write_characteristic.service_uuid uuid
  • required
 
ble.peripheral.notify_write_characteristic.characteristic_uuid uuid
  • required
 
ble.peripheral.notify_write_characteristic.data dataArray
  • required
 
//Response Example
[
    {
        "ble": {
            "peripheral": {
                "notify_write_characteristic": {
                    "address": "77e754ab8591",
                    "service_uuid": "e1cfb0d1-ae63-4d6f-b3b6-de2054f87e5e",
                    "characteristic_uuid": "8d3591bda71140fd8f9f00535fe57179",
                    "data": [16, 34, 242]
                }
            }
        }
    }
]

response: descriptor_read

callback of read descriptor

path type conditions description
ble.peripheral.read_descriptor_result.service_uuid uuid
  • required
 
ble.peripheral.read_descriptor_result.characteristic_uuid uuid
  • required
 
ble.peripheral.read_descriptor_result.descriptor_uuid uuid
  • required
 
ble.peripheral.read_descriptor_result.data dataArray
  • required
 
ble.peripheral.read_descriptor_result.result string
  • required
  • enum
    • "success"
    • "failed"
 
//Response Example
[
    {
        "ble": {
            "peripheral": {
                "read_descriptor_result": {
                    "service_uuid": "e1cfb0d1-ae63-4d6f-b3b6-de2054f87e5e",
                    "characteristic_uuid": "8d3591bda71140fd8f9f00535fe57179",
                    "descriptor_uuid": "d822b53c",
                    "data": [16, 34, 242],
                    "result": "success"
                }
            }
        }
    }
]

response: descriptor_write

callback of write descriptor

path type conditions description
ble.peripheral.write_descriptor_result.service_uuid uuid
  • required
 
ble.peripheral.write_descriptor_result.characteristic_uuid uuid
  • required
 
ble.peripheral.write_descriptor_result.descriptor_uuid uuid
  • required
 
ble.peripheral.write_descriptor_result.result string
  • required
  • enum
    • "success"
    • "failed"
 
//Response Example
[
    {
        "ble": {
            "peripheral": {
                "write_descriptor_result": {
                    "service_uuid": "e1cfb0d1-ae63-4d6f-b3b6-de2054f87e5e",
                    "characteristic_uuid": "8d3591bda71140fd8f9f00535fe57179",
                    "descriptor_uuid": "d822b53c",
                    "result": "success"
                }
            }
        }
    }
]

response: descriptor_notify_read

callback of external device read descriptor

path type conditions description
ble.peripheral.notify_read_descriptor.address deviceAddress
  • required
 
ble.peripheral.notify_read_descriptor.service_uuid uuid
  • required
 
ble.peripheral.notify_read_descriptor.characteristic_uuid uuid
  • required
 
ble.peripheral.notify_read_descriptor.descriptor_uuid uuid
  • required
 
//Response Example
[
    {
        "ble": {
            "peripheral": {
                "notify_read_descriptor": {
                    "address": "77e754ab8591",
                    "service_uuid": "e1cfb0d1-ae63-4d6f-b3b6-de2054f87e5e",
                    "characteristic_uuid": "8d3591bda71140fd8f9f00535fe57179",
                    "descriptor_uuid": "d822b53c"
                }
            }
        }
    }
]

response: descriptor_notify_write

callback of external device write descriptor

path type conditions description
ble.peripheral.notify_write_descriptor.address deviceAddress
  • required
 
ble.peripheral.notify_write_descriptor.service_uuid uuid
  • required
 
ble.peripheral.notify_write_descriptor.characteristic_uuid uuid
  • required
 
ble.peripheral.notify_write_descriptor.descriptor_uuid uuid
  • required
 
ble.peripheral.notify_write_descriptor.data dataArray
  • required
 
//Response Example
[
    {
        "ble": {
            "peripheral": {
                "notify_write_descriptor": {
                    "address": "77e754ab8591",
                    "service_uuid": "e1cfb0d1-ae63-4d6f-b3b6-de2054f87e5e",
                    "characteristic_uuid": "8d3591bda71140fd8f9f00535fe57179",
                    "descriptor_uuid": "d822b53c",
                    "data": [16, 34, 242]
                }
            }
        }
    }
]

type defines

bleAdvertiseData

type conditions examples description
array
  • length ≤ 31
  • items
    • 0 ≤ value ≤ 255
  • [2, 1, 26, 7, 9, 83, 97, 109, 112, 108, 101]
  • [7, 9, 83, 97, 109, 112, 108, 101]
 

dataArray

type conditions examples description
array
  • items
    • 0 ≤ value ≤ 255
  • [16, 34, 242]
  • [100, 255, 21, 0, 21]
Binary data array. 

deviceAddress

type conditions examples description
string
  • length = 12
  • "77e754ab8591"
Bluetooth device id. It's hexString cannot contain '0x' or '-'. 

uuid

type conditions examples description
string
  • 4 ≤ length ≤ 36
  • "e1cfb0d1-ae63-4d6f-b3b6-de2054f87e5e"
  • "8d3591bda71140fd8f9f00535fe57179"
  • "d822b53c"
  • "de44"
Bluetooth uuid. If it contain '-', it ignored.