gopro / OpenGoPro

An open source interface specification to communicate with a GoPro camera with accompanying demos and tutorials.
https://gopro.github.io/OpenGoPro/
MIT License
682 stars 151 forks source link

Documentation(BLE2.0): Status Codes Ids seems not correct #101

Closed XHMM closed 2 years ago

XHMM commented 2 years ago

In the ble2.0 status codes documentation, I tried many status id listed here, none of them returned the correct value.

For example: 'External battery level':

I write value 02:13:04 to 0x0076, but the response is always0x0513000401ff (0xff=255), but my battery is 20%. ( (I’m using swift for IOS, the raw log is <CBCharacteristic: 0x2828376c0, UUID = B5F90077-AA8D-11E3-9046-0002A5D5C51B, properties = 0x10, value = {length = 6, bytes = 0x0513000401ff}, notifying = YES>),)

I tried the unofficial doc, changed to 02:13:46, the response is 0x051300460114 (0x14 == 20), it's correct

Is the status codes list miswritten? (I can be sure that there is no error in my code, I have tried writing commands, writing and query settings, they work very well)

Hardware

tcamise-gpsw commented 2 years ago

Hello. The Official docs Status IDs are correct. The problem here is that you are using the wrong status: 0x04 == external battery when really you should be caring about internal battery.

You're likely interested in the following ID's:

FYI there is a battery logging demo in the Python SDK. Here is a sample of it's log:

INFO     | <----------- register_value_update : StatusId.BATT_LEVEL
DEBUG    | Writing to b5f90076-aa8d-11e3-9046-0002a5d5c51b: 02:53:02
DEBUG    | Received response on UUID.CQ_QUERY_RESP: 05:53:00:02:01:04
INFO     | -----------> {
    "status": "SUCCESS",
    "id": "UUID.CQ_QUERY_RESP::QueryCmdId.REG_STATUS_VAL_UPDATE",
    "StatusId.BATT_LEVEL": 4
}

INFO     | <----------- register_value_update : StatusId.INT_BATT_PER
DEBUG    | Writing to b5f90076-aa8d-11e3-9046-0002a5d5c51b: 02:53:46
DEBUG    | Received response on UUID.CQ_QUERY_RESP: 05:53:00:46:01:57
INFO     | -----------> {
    "status": "SUCCESS",
    "id": "UUID.CQ_QUERY_RESP::QueryCmdId.REG_STATUS_VAL_UPDATE",
    "StatusId.INT_BATT_PER": 87
}

DEBUG    | Received response on UUID.CQ_QUERY_RESP: 0e:93:00:02:01:03:0a:01:00:46:01:57:52:01:01
INFO     | --(ASYNC)--> {
    "status": "SUCCESS",
    "id": "UUID.CQ_QUERY_RESP::QueryCmdId.STATUS_VAL_PUSH",
    "StatusId.BATT_LEVEL": 3,
    "StatusId.ENCODING": false,
    "StatusId.INT_BATT_PER": 87,
    "StatusId.SYSTEM_READY": true
}

DEBUG    | Received response on UUID.CQ_QUERY_RESP: 05:93:00:0a:01:01
INFO     | --(ASYNC)--> {
    "status": "SUCCESS",
    "id": "UUID.CQ_QUERY_RESP::QueryCmdId.STATUS_VAL_PUSH",
    "StatusId.ENCODING": true
}

DEBUG    | Received response on UUID.CQ_QUERY_RESP: 05:93:00:0a:01:00
INFO     | --(ASYNC)--> {
    "status": "SUCCESS",
    "id": "UUID.CQ_QUERY_RESP::QueryCmdId.STATUS_VAL_PUSH",
    "StatusId.ENCODING": false
}

DEBUG    | Received response on UUID.CQ_QUERY_RESP: 05:93:00:46:01:56
INFO     | --(ASYNC)--> {
    "status": "SUCCESS",
    "id": "UUID.CQ_QUERY_RESP::QueryCmdId.STATUS_VAL_PUSH",
    "StatusId.INT_BATT_PER": 86
}

DEBUG    | Received response on UUID.CQ_QUERY_RESP: 05:93:00:46:01:55
INFO     | --(ASYNC)--> {
    "status": "SUCCESS",
    "id": "UUID.CQ_QUERY_RESP::QueryCmdId.STATUS_VAL_PUSH",
    "StatusId.INT_BATT_PER": 85
}