| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 module arc.mojom; | 5 module arc.mojom; |
| 6 | 6 |
| 7 [Extensible] | 7 [Extensible] |
| 8 enum BluetoothAdapterState { | 8 enum BluetoothAdapterState { |
| 9 OFF = 0, | 9 OFF = 0, |
| 10 ON | 10 ON |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 BluetoothServiceRecord service_record; | 121 BluetoothServiceRecord service_record; |
| 122 BluetoothScanMode adapter_scan_mode; | 122 BluetoothScanMode adapter_scan_mode; |
| 123 array<BluetoothAddress> bonded_devices; | 123 array<BluetoothAddress> bonded_devices; |
| 124 uint32 discovery_timeout; | 124 uint32 discovery_timeout; |
| 125 string remote_friendly_name; | 125 string remote_friendly_name; |
| 126 int32 remote_rssi; | 126 int32 remote_rssi; |
| 127 BluetoothRemoteVersion remote_version; | 127 BluetoothRemoteVersion remote_version; |
| 128 BluetoothLocalLEFeatures local_le_features; | 128 BluetoothLocalLEFeatures local_le_features; |
| 129 }; | 129 }; |
| 130 | 130 |
| 131 // Bluetooth GATT types |
| 132 [Extensible] |
| 133 enum BluetoothGattStatus { |
| 134 GATT_SUCCESS = 0, |
| 135 GATT_READ_NOT_PERMITTED = 0x2, |
| 136 GATT_WRITE_NOT_PERMITTED = 0x3, |
| 137 GATT_INSUFFICIENT_AUTHENTICATION = 0x5, |
| 138 GATT_REQUEST_NOT_SUPPORTED = 0x6, |
| 139 GATT_INVALID_OFFSET = 0x7, |
| 140 GATT_INVALID_ATTRIBUTE_LENGTH = 0xd, |
| 141 GATT_INSUFFICIENT_ENCRYPTION = 0xf, |
| 142 GATT_CONNECTION_CONGESTED = 0x8f, |
| 143 GATT_FAILURE = 0x101, |
| 144 }; |
| 145 |
| 146 struct BluetoothGattID { |
| 147 BluetoothUUID uuid; |
| 148 uint8 inst_id; |
| 149 }; |
| 150 |
| 151 struct BluetoothGattServiceID { |
| 152 BluetoothGattID id; |
| 153 uint8 is_primary; |
| 154 }; |
| 155 |
| 156 struct BluetoothGattValue { |
| 157 BluetoothGattStatus status; |
| 158 uint32 len; |
| 159 uint32 type; |
| 160 array<uint8> value; |
| 161 }; |
| 162 |
| 163 [Extensible] |
| 164 enum BluetoothGattDBAttributeType { |
| 165 BTGATT_DB_PRIMARY_SERVICE = 0, |
| 166 BTGATT_DB_SECONDARY_SERVICE, |
| 167 BTGATT_DB_INCLUDED_SERVICE, |
| 168 BTGATT_DB_CHARACTERISTIC, |
| 169 BTGATT_DB_DESCRIPTOR, |
| 170 }; |
| 171 |
| 172 struct BluetoothGattDBElement { |
| 173 uint8 id; |
| 174 BluetoothUUID uuid; |
| 175 BluetoothGattDBAttributeType type; |
| 176 uint16 attribute_handle; |
| 177 |
| 178 /* |
| 179 * If |type| is |BTGATT_DB_PRIMARY_SERVICE|, or |
| 180 * |BTGATT_DB_SECONDARY_SERVICE|, this contains the start and end attribute |
| 181 * handles. |
| 182 */ |
| 183 uint16 start_handle; |
| 184 uint16 end_handle; |
| 185 |
| 186 /* |
| 187 * If |type| is |BTGATT_DB_CHARACTERISTIC|, this contains the properties of |
| 188 * the characteristic. |
| 189 */ |
| 190 uint8 properties; |
| 191 }; |
| 192 |
| 131 interface BluetoothHost { | 193 interface BluetoothHost { |
| 132 EnableAdapter() => (BluetoothAdapterState state); | 194 EnableAdapter() => (BluetoothAdapterState state); |
| 133 DisableAdapter() => (BluetoothAdapterState state); | 195 DisableAdapter() => (BluetoothAdapterState state); |
| 134 GetAdapterProperty(BluetoothPropertyType type); | 196 GetAdapterProperty(BluetoothPropertyType type); |
| 135 SetAdapterProperty(BluetoothProperty property); | 197 SetAdapterProperty(BluetoothProperty property); |
| 136 GetRemoteDeviceProperty(BluetoothAddress remote_addr, | 198 GetRemoteDeviceProperty(BluetoothAddress remote_addr, |
| 137 BluetoothPropertyType type); | 199 BluetoothPropertyType type); |
| 138 SetRemoteDeviceProperty(BluetoothAddress remote_addr, | 200 SetRemoteDeviceProperty(BluetoothAddress remote_addr, |
| 139 BluetoothProperty property); | 201 BluetoothProperty property); |
| 140 GetRemoteServiceRecord(BluetoothAddress remote_addr, | 202 GetRemoteServiceRecord(BluetoothAddress remote_addr, |
| 141 BluetoothUUID uuid); | 203 BluetoothUUID uuid); |
| 142 GetRemoteServices(BluetoothAddress remote_addr); | 204 GetRemoteServices(BluetoothAddress remote_addr); |
| 143 StartDiscovery(); | 205 StartDiscovery(); |
| 144 CancelDiscovery(); | 206 CancelDiscovery(); |
| 145 CreateBond(BluetoothAddress addr, int32 transport); | 207 CreateBond(BluetoothAddress addr, int32 transport); |
| 146 RemoveBond(BluetoothAddress addr); | 208 RemoveBond(BluetoothAddress addr); |
| 147 CancelBond(BluetoothAddress addr); | 209 CancelBond(BluetoothAddress addr); |
| 148 | 210 |
| 149 GetConnectionState(BluetoothAddress addr) => (bool connected); | 211 GetConnectionState(BluetoothAddress addr) => (bool connected); |
| 212 |
| 213 // Bluetooth Gatt Client functions |
| 214 [MinVersion=1] StartLEScan(); |
| 215 [MinVersion=1] StopLEScan(); |
| 216 [MinVersion=1] ConnectLEDevice(BluetoothAddress remote_addr); |
| 217 [MinVersion=1] DisconnectLEDevice(BluetoothAddress remote_addr); |
| 218 [MinVersion=1] SearchService(BluetoothAddress remote_addr); |
| 219 [MinVersion=1] GetGattDB(BluetoothAddress remote_addr); |
| 220 [MinVersion=1] StartLEListen() => (BluetoothGattStatus status); |
| 221 [MinVersion=1] StopLEListen() => (BluetoothGattStatus status); |
| 222 [MinVersion=1] ReadGattCharacteristic(BluetoothAddress remote_addr, |
| 223 BluetoothGattServiceID service_id, |
| 224 BluetoothGattID char_id) |
| 225 => (BluetoothGattValue value); |
| 226 [MinVersion=1] WriteGattCharacteristic(BluetoothAddress remote_addr, |
| 227 BluetoothGattServiceID service_id, |
| 228 BluetoothGattID char_id, |
| 229 BluetoothGattValue value) |
| 230 => (BluetoothGattStatus status); |
| 231 [MinVersion=1] ReadGattDescriptor(BluetoothAddress remote_addr, |
| 232 BluetoothGattServiceID service_id, |
| 233 BluetoothGattID char_id, |
| 234 BluetoothGattID desc_id) |
| 235 => (BluetoothGattValue value); |
| 236 [MinVersion=1] WriteGattDescriptor(BluetoothAddress remote_addr, |
| 237 BluetoothGattServiceID service_id, |
| 238 BluetoothGattID char_id, |
| 239 BluetoothGattID desc_id, |
| 240 BluetoothGattValue value) |
| 241 => (BluetoothGattStatus status); |
| 242 [MinVersion=1] RegisterForGattNotification(BluetoothAddress remote_addr, |
| 243 BluetoothGattServiceID service_id, |
| 244 BluetoothGattID char_id) |
| 245 => (BluetoothGattStatus status); |
| 246 [MinVersion=1] DeregisterForGattNotification(BluetoothAddress remote_addr, |
| 247 BluetoothGattServiceID service_id
, |
| 248 BluetoothGattID char_id) |
| 249 => (BluetoothGattStatus status); |
| 250 [MinVersion=1] ReadRemoteRssi(BluetoothAddress remote_addr) |
| 251 => (int32 rssi); |
| 252 |
| 150 }; | 253 }; |
| 151 | 254 |
| 152 interface BluetoothInstance { | 255 interface BluetoothInstance { |
| 153 Init(BluetoothHost host_ptr); | 256 Init(BluetoothHost host_ptr); |
| 154 | 257 |
| 155 OnAdapterProperties(BluetoothStatus status, | 258 OnAdapterProperties(BluetoothStatus status, |
| 156 array<BluetoothProperty> properties); | 259 array<BluetoothProperty> properties); |
| 157 OnRemoteDeviceProperties(BluetoothStatus status, | 260 OnRemoteDeviceProperties(BluetoothStatus status, |
| 158 BluetoothAddress address, | 261 BluetoothAddress address, |
| 159 array<BluetoothProperty> properties); | 262 array<BluetoothProperty> properties); |
| 160 OnDeviceFound(array<BluetoothProperty> properties); | 263 OnDeviceFound(array<BluetoothProperty> properties); |
| 161 OnDiscoveryStateChanged(BluetoothDiscoveryState state); | 264 OnDiscoveryStateChanged(BluetoothDiscoveryState state); |
| 162 OnBondStateChanged(BluetoothStatus status, | 265 OnBondStateChanged(BluetoothStatus status, |
| 163 BluetoothAddress remote_addr, | 266 BluetoothAddress remote_addr, |
| 164 BluetoothBondState state); | 267 BluetoothBondState state); |
| 165 OnAclStateChanged(BluetoothStatus status, | 268 OnAclStateChanged(BluetoothStatus status, |
| 166 BluetoothAddress remote_addr, | 269 BluetoothAddress remote_addr, |
| 167 BluetoothAclState state); | 270 BluetoothAclState state); |
| 271 |
| 272 // Bluetooth Gatt Client callbacks |
| 273 [MinVersion=1] OnLEDeviceFound(BluetoothAddress addr, |
| 274 int32 rssi, |
| 275 array<uint8> adv_data); |
| 276 [MinVersion=1] OnLEConnectionStateChange(BluetoothAddress remote_addr, |
| 277 bool connected); |
| 278 [MinVersion=1] OnSearchComplete(BluetoothAddress remote_addr, |
| 279 BluetoothGattStatus status); |
| 280 [MinVersion=1] OnGetGattDB(BluetoothAddress remote_addr, |
| 281 array<BluetoothGattDBElement> db); |
| 282 [MinVersion=1] OnServicesRemoved(BluetoothAddress remote_addr, |
| 283 uint16 start_handle, |
| 284 uint16 end_handle); |
| 285 [MinVersion=1] OnServicesAdded(BluetoothAddress remote_addr, |
| 286 array<BluetoothGattDBElement> db); |
| 168 }; | 287 }; |
| OLD | NEW |