在iOS中更新BLE设备固件

时间:2015-10-13 11:16:22

标签: ios bluetooth-lowenergy core-bluetooth

在我目前的iOS项目中,我需要根据新版本的可用性升级BLE设备的当前固件。服务器正在向我提供样本格式的数据

{
    "fileId": "687659c1-02be-48b9-97bf-37472bcbc9b6",
    "length": 143184,
    "createdDate": 1426010825894,
    "version": "0.34",
    "packets": [
        {
            "address": "00008000",
            "data": "0041002091F3000035E100008DF300008DF300008DF300008DF30000000000000000000000000000000000008DF300008DF30000000000008DF30000ADAD00008DF30000C1E40000D1E40000E1E40000F1E4000001E5000011E5000021E5000031E5000041E5000051E5000061E5000071E5000081E5000091E50000A1E50000B1E500008DF300008DF300008DF300008DF300008DF300008DF300008DF300008DF300008DF300008DF300008DF300008DF300008DF300008DF300008DF300008DF300008DF300008DF300008DF300008DF300008DF300008DF300008DF30000ADDE00008DF300008DF300008DF30000C9AD000045E1000055E1000065E1000075E1000085E1000095E10000A5E10000B5E100008DF300008DF300008DF300008DF300008DF300008DF300008DF300008DF3000015F100008DF3000029F100008DF300008DF300008DF300008DF300008DF300007DDC00008DF300008DF300008DF300008DF300008DF300008DF300008DF300003DF1000051F100008DF3000008B50548054B1B1A062B00D808BD044B002BFBD09847F9E7743C0100773C01000000000008B50748074B1B1A9B1003EBD373591000D108BD044A002AFBD09047F9E700BF743C0100743C01000000000010B5064C237843B9FFF7D2FF044B13B10448AFF300800123237010BDD80E002000000000743C010008B5084B1BB10848"
        },
        {
            "address": "00008200",
            "data": "0849AFF300800848036813B1074B03B19847BDE80840FFF7C5BF00BF00000000743C0100DC0E0020743C01000000000070B50E46154678B914467119002CC4EB010106DD064B1868064B1B689847013CF3E725EAE57070BD4FF0FF3070BD00BF68300020201100200C4B1A6882B0920354BFD12240F2DD220192019AD2080192019A511E0191002AFAD140F0AA4240F02A401A60186002B0704700BF000C0F4010220023027201220360436043728272C27203734373704770B50C46154680E83000274B0846984723681E0746D42368244E13F0010F03D12368D8030FD507E0206820F00100B0472368D907FCD4F3E7206820F48030B0472368DA03FCD495E80C00287A697A0002134300F4F8501843AB7A8904002BEB7A01F4F80140EA010014BF80210021002B2B7B40EA01000CBF00210221002B40EA01000CBF002310231843B047206840F48030B0472368DB03FCD52046044B9847012070BD002070BD8DD400006982000051D7000038B590E830000C4B204698472B7B13B10423E361E3606B7B2068002B0CBF0023082340F001001843044B9847044B1B68DB07FBD538BD00BF8DD4000069820000000C0F4003689A689207FCD5024A5A6002F1AA425A607047010000557FB50E4B02A8984707238DF8103001238DF8133068460A490A4B02AA984748B172B6BFF35F8F084B00221A706846074B9847FEE707B05DF8"
        }
    ],
    "type": "application/octet-stream",
    "name": "nextgen_0_34.hex"
}

我通过调用方法

了解writing dataCBPeripheral的方法

[peripheral writeValue:dataToWrite forCharacteristic:interestingCharacteristic type:CBCharacteristicWriteWithResponse];

我的问题是:

  1. 如何在创建CBMutableCharacteristic
  2. 时使用这些地址
  3. 我收到大约120个包。有没有办法可以逐个编写数据,以便向用户显示进度?

0 个答案:

没有答案