@blueid/access-capacitor 0.104.0 → 0.106.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/BlueidAccessCapacitor.podspec +2 -1
  2. package/dist/esm/BlueCore_pb.d.ts +12 -0
  3. package/dist/esm/BlueCore_pb.js +11 -0
  4. package/dist/esm/BlueCore_pb.js.map +1 -1
  5. package/dist/esm/BlueSDK_pb.d.ts +52 -0
  6. package/dist/esm/BlueSDK_pb.js +13 -0
  7. package/dist/esm/BlueSDK_pb.js.map +1 -1
  8. package/dist/esm/BlueSystem_pb.d.ts +12 -0
  9. package/dist/esm/BlueSystem_pb.js +3 -0
  10. package/dist/esm/BlueSystem_pb.js.map +1 -1
  11. package/dist/plugin.cjs.js +27 -0
  12. package/dist/plugin.cjs.js.map +1 -1
  13. package/dist/plugin.js +27 -0
  14. package/dist/plugin.js.map +1 -1
  15. package/ios/CBlueIDAccess.xcframework/Info.plist +5 -5
  16. package/ios/CBlueIDAccess.xcframework/ios-arm64/Headers/core/BlueCore.pb.h +9 -4
  17. package/ios/CBlueIDAccess.xcframework/ios-arm64/libCBlueIDAccess.a +0 -0
  18. package/ios/CBlueIDAccess.xcframework/ios-arm64_x86_64-simulator/Headers/core/BlueCore.pb.h +9 -4
  19. package/ios/CBlueIDAccess.xcframework/ios-arm64_x86_64-simulator/libCBlueIDAccess.a +0 -0
  20. package/ios/CBlueIDAccess.xcframework/macos-arm64_x86_64/Headers/core/BlueCore.pb.h +9 -4
  21. package/ios/CBlueIDAccess.xcframework/macos-arm64_x86_64/libCBlueIDAccess.a +0 -0
  22. package/ios/Plugin/BlueIDAccessSDK/BlueAPI.swift +7 -0
  23. package/ios/Plugin/BlueIDAccessSDK/BlueAPIProtocol.swift +20 -0
  24. package/ios/Plugin/BlueIDAccessSDK/BlueAccess.swift +50 -24
  25. package/ios/Plugin/BlueIDAccessSDK/BlueCommands.swift +3 -0
  26. package/ios/Plugin/BlueIDAccessSDK/BlueCore.pb.swift +25 -0
  27. package/ios/Plugin/BlueIDAccessSDK/BlueDFU/BlueDFUPeripheralService.swift +73 -0
  28. package/ios/Plugin/BlueIDAccessSDK/BlueDFU/BlueUpdateAccessDeviceFirmwareCommand.swift +252 -0
  29. package/ios/Plugin/BlueIDAccessSDK/BlueDevices.swift +24 -0
  30. package/ios/Plugin/BlueIDAccessSDK/BlueError.swift +1 -1
  31. package/ios/Plugin/BlueIDAccessSDK/BlueFetch.swift +10 -2
  32. package/ios/Plugin/BlueIDAccessSDK/BlueModal/BlueModal.swift +30 -5
  33. package/ios/Plugin/BlueIDAccessSDK/BlueModal/{BlueSynchronizeAccessDeviceModalSession.swift → BlueStepProgressModalSession.swift} +4 -4
  34. package/ios/Plugin/BlueIDAccessSDK/BlueModal/{BlueSynchronizeAccessDeviceModalView.swift → BlueStepProgressModalView.swift} +59 -19
  35. package/ios/Plugin/BlueIDAccessSDK/BlueSDK.pb.swift +234 -0
  36. package/ios/Plugin/BlueIDAccessSDK/BlueSystem.pb.swift +51 -0
  37. package/ios/Plugin/BlueIDAccessSDK/BlueTaskRunner.swift +42 -5
  38. package/ios/Plugin/BlueIDAccessSDK/BlueZip.swift +30 -0
  39. package/package.json +1 -1
@@ -10,16 +10,15 @@
10
10
  <key>HeadersPath</key>
11
11
  <string>Headers</string>
12
12
  <key>LibraryIdentifier</key>
13
- <string>macos-arm64_x86_64</string>
13
+ <string>ios-arm64</string>
14
14
  <key>LibraryPath</key>
15
15
  <string>libCBlueIDAccess.a</string>
16
16
  <key>SupportedArchitectures</key>
17
17
  <array>
18
18
  <string>arm64</string>
19
- <string>x86_64</string>
20
19
  </array>
21
20
  <key>SupportedPlatform</key>
22
- <string>macos</string>
21
+ <string>ios</string>
23
22
  </dict>
24
23
  <dict>
25
24
  <key>BinaryPath</key>
@@ -27,15 +26,16 @@
27
26
  <key>HeadersPath</key>
28
27
  <string>Headers</string>
29
28
  <key>LibraryIdentifier</key>
30
- <string>ios-arm64</string>
29
+ <string>macos-arm64_x86_64</string>
31
30
  <key>LibraryPath</key>
32
31
  <string>libCBlueIDAccess.a</string>
33
32
  <key>SupportedArchitectures</key>
34
33
  <array>
35
34
  <string>arm64</string>
35
+ <string>x86_64</string>
36
36
  </array>
37
37
  <key>SupportedPlatform</key>
38
- <string>ios</string>
38
+ <string>macos</string>
39
39
  </dict>
40
40
  <dict>
41
41
  <key>BinaryPath</key>
@@ -110,6 +110,8 @@ typedef enum BlueReturnCode {
110
110
  BlueReturnCode_SdkGetBlacklistEntriesFailed = -419,
111
111
  BlueReturnCode_SdkGetSystemStatusFailed = -420,
112
112
  BlueReturnCode_SdkWaitDeviceToRestartFailed = -421,
113
+ BlueReturnCode_SdkUnzipError = -422,
114
+ BlueReturnCode_SdkInvalidFirmwareURL = -423,
113
115
  BlueReturnCode_OssMAReturnCodeStart = -1000,
114
116
  BlueReturnCode_OssMAReturnCodeEnd = -1100
115
117
  } BlueReturnCode_t;
@@ -287,6 +289,7 @@ typedef struct BlueSharedDemoData {
287
289
  typedef struct BlueVersionInfo {
288
290
  uint32_t buildTime;
289
291
  uint16_t version;
292
+ uint16_t testVersion;
290
293
  } BlueVersionInfo_t;
291
294
 
292
295
  typedef struct BlueLocalTimestamp {
@@ -862,7 +865,7 @@ extern "C" {
862
865
 
863
866
  /* Initializer values for message structs */
864
867
  #define BLUESHAREDDEMODATA_INIT_DEFAULT {"wa0y1YwS", {138, {0x30,0x81,0x87,0x02,0x01,0x00,0x30,0x13,0x06,0x07,0x2a,0x86,0x48,0xce,0x3d,0x02,0x01,0x06,0x08,0x2a,0x86,0x48,0xce,0x3d,0x03,0x01,0x07,0x04,0x6d,0x30,0x6b,0x02,0x01,0x01,0x04,0x20,0xa5,0xab,0x6d,0x14,0x11,0x30,0x47,0xa7,0xad,0x6c,0x10,0xe4,0x4d,0xe6,0x3c,0x05,0xb9,0x6b,0x84,0xb5,0x1f,0xe3,0x14,0xd6,0x87,0x5c,0x46,0x9e,0xb9,0xcd,0x69,0x2b,0xa1,0x44,0x03,0x42,0x00,0x04,0x3a,0x66,0x86,0x75,0xc9,0x29,0x29,0x07,0xc3,0x63,0x18,0x97,0x4d,0xd9,0x44,0x1c,0x71,0xf9,0xe4,0x45,0xe8,0x74,0x1a,0x3f,0xaf,0x6b,0xc5,0x8c,0x9c,0x69,0x13,0xbe,0x44,0x14,0x0b,0x60,0x45,0x4f,0x76,0x2f,0xc2,0xf1,0x98,0x41,0x98,0xec,0x6e,0x39,0x1b,0x53,0x36,0x8b,0x90,0x73,0xea,0x1d,0xe7,0x20,0xcf,0xa1,0xbe,0x2d,0xd4,0xf1}}, {91, {0x30,0x59,0x30,0x13,0x06,0x07,0x2a,0x86,0x48,0xce,0x3d,0x02,0x01,0x06,0x08,0x2a,0x86,0x48,0xce,0x3d,0x03,0x01,0x07,0x03,0x42,0x00,0x04,0x3a,0x66,0x86,0x75,0xc9,0x29,0x29,0x07,0xc3,0x63,0x18,0x97,0x4d,0xd9,0x44,0x1c,0x71,0xf9,0xe4,0x45,0xe8,0x74,0x1a,0x3f,0xaf,0x6b,0xc5,0x8c,0x9c,0x69,0x13,0xbe,0x44,0x14,0x0b,0x60,0x45,0x4f,0x76,0x2f,0xc2,0xf1,0x98,0x41,0x98,0xec,0x6e,0x39,0x1b,0x53,0x36,0x8b,0x90,0x73,0xea,0x1d,0xe7,0x20,0xcf,0xa1,0xbe,0x2d,0xd4,0xf1}}, {138, {0x30,0x81,0x87,0x02,0x01,0x00,0x30,0x13,0x06,0x07,0x2a,0x86,0x48,0xce,0x3d,0x02,0x01,0x06,0x08,0x2a,0x86,0x48,0xce,0x3d,0x03,0x01,0x07,0x04,0x6d,0x30,0x6b,0x02,0x01,0x01,0x04,0x20,0xef,0x36,0x55,0xc9,0x4d,0x80,0x1e,0xf4,0x92,0x56,0x75,0x0e,0x70,0xe1,0x51,0x0e,0xcc,0xe8,0xb4,0x6c,0x54,0x5e,0x55,0x1d,0xde,0xbb,0xfc,0x6f,0x22,0xa8,0x49,0x50,0xa1,0x44,0x03,0x42,0x00,0x04,0x5a,0x0d,0x6e,0x67,0x45,0xcc,0xd5,0xc1,0x8c,0xeb,0xd8,0xaf,0xf6,0xea,0x86,0xd8,0xc3,0xaf,0x43,0x3f,0xb7,0xa2,0xd2,0x5f,0x21,0x34,0x42,0xd4,0xcd,0x96,0x83,0xb4,0xe6,0x7d,0x2d,0xdc,0x25,0xeb,0x53,0xf9,0x12,0x76,0x1e,0x40,0xe6,0xc9,0x99,0x83,0xdd,0x90,0x90,0xfe,0xf0,0xb4,0x25,0x99,0xcd,0x16,0xae,0x39,0x2f,0xcf,0x96,0x43}}, {91, {0x30,0x59,0x30,0x13,0x06,0x07,0x2a,0x86,0x48,0xce,0x3d,0x02,0x01,0x06,0x08,0x2a,0x86,0x48,0xce,0x3d,0x03,0x01,0x07,0x03,0x42,0x00,0x04,0x5a,0x0d,0x6e,0x67,0x45,0xcc,0xd5,0xc1,0x8c,0xeb,0xd8,0xaf,0xf6,0xea,0x86,0xd8,0xc3,0xaf,0x43,0x3f,0xb7,0xa2,0xd2,0x5f,0x21,0x34,0x42,0xd4,0xcd,0x96,0x83,0xb4,0xe6,0x7d,0x2d,0xdc,0x25,0xeb,0x53,0xf9,0x12,0x76,0x1e,0x40,0xe6,0xc9,0x99,0x83,0xdd,0x90,0x90,0xfe,0xf0,0xb4,0x25,0x99,0xcd,0x16,0xae,0x39,0x2f,0xcf,0x96,0x43}}}
865
- #define BLUEVERSIONINFO_INIT_DEFAULT {0, 0}
868
+ #define BLUEVERSIONINFO_INIT_DEFAULT {0, 0, 0}
866
869
  #define BLUELOCALTIMESTAMP_INIT_DEFAULT {0, 0, 0, 0, 0, 0u}
867
870
  #define BLUELOCALTIMEPERIOD_INIT_DEFAULT {0, 0, 0, 0}
868
871
  #define BLUELOCALTIMESCHEDULE_INIT_DEFAULT {0, 0, 0, {0, 0, 0, 0, 0, 0, 0}, BLUELOCALTIMEPERIOD_INIT_DEFAULT}
@@ -918,7 +921,7 @@ extern "C" {
918
921
  #define BLUEOSSSOSETTINGS_INIT_DEFAULT {false, BLUEOSSSOMIFAREDESFIRECONFIGURATION_INIT_DEFAULT}
919
922
  #define _BLUETESTENCODEDECODE_INIT_DEFAULT {"", "", 0, 0}
920
923
  #define BLUESHAREDDEMODATA_INIT_ZERO {"", {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}}
921
- #define BLUEVERSIONINFO_INIT_ZERO {0, 0}
924
+ #define BLUEVERSIONINFO_INIT_ZERO {0, 0, 0}
922
925
  #define BLUELOCALTIMESTAMP_INIT_ZERO {0, 0, 0, 0, 0, 0}
923
926
  #define BLUELOCALTIMEPERIOD_INIT_ZERO {0, 0, 0, 0}
924
927
  #define BLUELOCALTIMESCHEDULE_INIT_ZERO {0, 0, 0, {0, 0, 0, 0, 0, 0, 0}, BLUELOCALTIMEPERIOD_INIT_ZERO}
@@ -982,6 +985,7 @@ extern "C" {
982
985
  #define BLUESHAREDDEMODATA_SIGNATUREPUBLICKEY_TAG 5
983
986
  #define BLUEVERSIONINFO_BUILDTIME_TAG 1
984
987
  #define BLUEVERSIONINFO_VERSION_TAG 2
988
+ #define BLUEVERSIONINFO_TESTVERSION_TAG 3
985
989
  #define BLUELOCALTIMESTAMP_YEAR_TAG 1
986
990
  #define BLUELOCALTIMESTAMP_MONTH_TAG 2
987
991
  #define BLUELOCALTIMESTAMP_DATE_TAG 3
@@ -1175,7 +1179,8 @@ X(a, STATIC, REQUIRED, BYTES, signaturePublicKey, 5)
1175
1179
 
1176
1180
  #define BLUEVERSIONINFO_FIELDLIST(X, a) \
1177
1181
  X(a, STATIC, REQUIRED, UINT32, buildTime, 1) \
1178
- X(a, STATIC, REQUIRED, UINT32, version, 2)
1182
+ X(a, STATIC, REQUIRED, UINT32, version, 2) \
1183
+ X(a, STATIC, REQUIRED, UINT32, testVersion, 3)
1179
1184
  #define BLUEVERSIONINFO_CALLBACK NULL
1180
1185
  #define BLUEVERSIONINFO_DEFAULT NULL
1181
1186
 
@@ -1793,7 +1798,7 @@ extern const pb_msgdesc_t _BlueTestEncodeDecode_t_msg;
1793
1798
  #define BLUESPRESULT_SIZE 1795
1794
1799
  #define BLUESPTOKENCOMMAND_SIZE 1861
1795
1800
  #define BLUESPTOKEN_SIZE 1940
1796
- #define BLUEVERSIONINFO_SIZE 10
1801
+ #define BLUEVERSIONINFO_SIZE 14
1797
1802
  #define _BLUETESTENCODEDECODE_SIZE 90
1798
1803
 
1799
1804
  #ifdef __cplusplus
@@ -110,6 +110,8 @@ typedef enum BlueReturnCode {
110
110
  BlueReturnCode_SdkGetBlacklistEntriesFailed = -419,
111
111
  BlueReturnCode_SdkGetSystemStatusFailed = -420,
112
112
  BlueReturnCode_SdkWaitDeviceToRestartFailed = -421,
113
+ BlueReturnCode_SdkUnzipError = -422,
114
+ BlueReturnCode_SdkInvalidFirmwareURL = -423,
113
115
  BlueReturnCode_OssMAReturnCodeStart = -1000,
114
116
  BlueReturnCode_OssMAReturnCodeEnd = -1100
115
117
  } BlueReturnCode_t;
@@ -287,6 +289,7 @@ typedef struct BlueSharedDemoData {
287
289
  typedef struct BlueVersionInfo {
288
290
  uint32_t buildTime;
289
291
  uint16_t version;
292
+ uint16_t testVersion;
290
293
  } BlueVersionInfo_t;
291
294
 
292
295
  typedef struct BlueLocalTimestamp {
@@ -862,7 +865,7 @@ extern "C" {
862
865
 
863
866
  /* Initializer values for message structs */
864
867
  #define BLUESHAREDDEMODATA_INIT_DEFAULT {"wa0y1YwS", {138, {0x30,0x81,0x87,0x02,0x01,0x00,0x30,0x13,0x06,0x07,0x2a,0x86,0x48,0xce,0x3d,0x02,0x01,0x06,0x08,0x2a,0x86,0x48,0xce,0x3d,0x03,0x01,0x07,0x04,0x6d,0x30,0x6b,0x02,0x01,0x01,0x04,0x20,0xa5,0xab,0x6d,0x14,0x11,0x30,0x47,0xa7,0xad,0x6c,0x10,0xe4,0x4d,0xe6,0x3c,0x05,0xb9,0x6b,0x84,0xb5,0x1f,0xe3,0x14,0xd6,0x87,0x5c,0x46,0x9e,0xb9,0xcd,0x69,0x2b,0xa1,0x44,0x03,0x42,0x00,0x04,0x3a,0x66,0x86,0x75,0xc9,0x29,0x29,0x07,0xc3,0x63,0x18,0x97,0x4d,0xd9,0x44,0x1c,0x71,0xf9,0xe4,0x45,0xe8,0x74,0x1a,0x3f,0xaf,0x6b,0xc5,0x8c,0x9c,0x69,0x13,0xbe,0x44,0x14,0x0b,0x60,0x45,0x4f,0x76,0x2f,0xc2,0xf1,0x98,0x41,0x98,0xec,0x6e,0x39,0x1b,0x53,0x36,0x8b,0x90,0x73,0xea,0x1d,0xe7,0x20,0xcf,0xa1,0xbe,0x2d,0xd4,0xf1}}, {91, {0x30,0x59,0x30,0x13,0x06,0x07,0x2a,0x86,0x48,0xce,0x3d,0x02,0x01,0x06,0x08,0x2a,0x86,0x48,0xce,0x3d,0x03,0x01,0x07,0x03,0x42,0x00,0x04,0x3a,0x66,0x86,0x75,0xc9,0x29,0x29,0x07,0xc3,0x63,0x18,0x97,0x4d,0xd9,0x44,0x1c,0x71,0xf9,0xe4,0x45,0xe8,0x74,0x1a,0x3f,0xaf,0x6b,0xc5,0x8c,0x9c,0x69,0x13,0xbe,0x44,0x14,0x0b,0x60,0x45,0x4f,0x76,0x2f,0xc2,0xf1,0x98,0x41,0x98,0xec,0x6e,0x39,0x1b,0x53,0x36,0x8b,0x90,0x73,0xea,0x1d,0xe7,0x20,0xcf,0xa1,0xbe,0x2d,0xd4,0xf1}}, {138, {0x30,0x81,0x87,0x02,0x01,0x00,0x30,0x13,0x06,0x07,0x2a,0x86,0x48,0xce,0x3d,0x02,0x01,0x06,0x08,0x2a,0x86,0x48,0xce,0x3d,0x03,0x01,0x07,0x04,0x6d,0x30,0x6b,0x02,0x01,0x01,0x04,0x20,0xef,0x36,0x55,0xc9,0x4d,0x80,0x1e,0xf4,0x92,0x56,0x75,0x0e,0x70,0xe1,0x51,0x0e,0xcc,0xe8,0xb4,0x6c,0x54,0x5e,0x55,0x1d,0xde,0xbb,0xfc,0x6f,0x22,0xa8,0x49,0x50,0xa1,0x44,0x03,0x42,0x00,0x04,0x5a,0x0d,0x6e,0x67,0x45,0xcc,0xd5,0xc1,0x8c,0xeb,0xd8,0xaf,0xf6,0xea,0x86,0xd8,0xc3,0xaf,0x43,0x3f,0xb7,0xa2,0xd2,0x5f,0x21,0x34,0x42,0xd4,0xcd,0x96,0x83,0xb4,0xe6,0x7d,0x2d,0xdc,0x25,0xeb,0x53,0xf9,0x12,0x76,0x1e,0x40,0xe6,0xc9,0x99,0x83,0xdd,0x90,0x90,0xfe,0xf0,0xb4,0x25,0x99,0xcd,0x16,0xae,0x39,0x2f,0xcf,0x96,0x43}}, {91, {0x30,0x59,0x30,0x13,0x06,0x07,0x2a,0x86,0x48,0xce,0x3d,0x02,0x01,0x06,0x08,0x2a,0x86,0x48,0xce,0x3d,0x03,0x01,0x07,0x03,0x42,0x00,0x04,0x5a,0x0d,0x6e,0x67,0x45,0xcc,0xd5,0xc1,0x8c,0xeb,0xd8,0xaf,0xf6,0xea,0x86,0xd8,0xc3,0xaf,0x43,0x3f,0xb7,0xa2,0xd2,0x5f,0x21,0x34,0x42,0xd4,0xcd,0x96,0x83,0xb4,0xe6,0x7d,0x2d,0xdc,0x25,0xeb,0x53,0xf9,0x12,0x76,0x1e,0x40,0xe6,0xc9,0x99,0x83,0xdd,0x90,0x90,0xfe,0xf0,0xb4,0x25,0x99,0xcd,0x16,0xae,0x39,0x2f,0xcf,0x96,0x43}}}
865
- #define BLUEVERSIONINFO_INIT_DEFAULT {0, 0}
868
+ #define BLUEVERSIONINFO_INIT_DEFAULT {0, 0, 0}
866
869
  #define BLUELOCALTIMESTAMP_INIT_DEFAULT {0, 0, 0, 0, 0, 0u}
867
870
  #define BLUELOCALTIMEPERIOD_INIT_DEFAULT {0, 0, 0, 0}
868
871
  #define BLUELOCALTIMESCHEDULE_INIT_DEFAULT {0, 0, 0, {0, 0, 0, 0, 0, 0, 0}, BLUELOCALTIMEPERIOD_INIT_DEFAULT}
@@ -918,7 +921,7 @@ extern "C" {
918
921
  #define BLUEOSSSOSETTINGS_INIT_DEFAULT {false, BLUEOSSSOMIFAREDESFIRECONFIGURATION_INIT_DEFAULT}
919
922
  #define _BLUETESTENCODEDECODE_INIT_DEFAULT {"", "", 0, 0}
920
923
  #define BLUESHAREDDEMODATA_INIT_ZERO {"", {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}}
921
- #define BLUEVERSIONINFO_INIT_ZERO {0, 0}
924
+ #define BLUEVERSIONINFO_INIT_ZERO {0, 0, 0}
922
925
  #define BLUELOCALTIMESTAMP_INIT_ZERO {0, 0, 0, 0, 0, 0}
923
926
  #define BLUELOCALTIMEPERIOD_INIT_ZERO {0, 0, 0, 0}
924
927
  #define BLUELOCALTIMESCHEDULE_INIT_ZERO {0, 0, 0, {0, 0, 0, 0, 0, 0, 0}, BLUELOCALTIMEPERIOD_INIT_ZERO}
@@ -982,6 +985,7 @@ extern "C" {
982
985
  #define BLUESHAREDDEMODATA_SIGNATUREPUBLICKEY_TAG 5
983
986
  #define BLUEVERSIONINFO_BUILDTIME_TAG 1
984
987
  #define BLUEVERSIONINFO_VERSION_TAG 2
988
+ #define BLUEVERSIONINFO_TESTVERSION_TAG 3
985
989
  #define BLUELOCALTIMESTAMP_YEAR_TAG 1
986
990
  #define BLUELOCALTIMESTAMP_MONTH_TAG 2
987
991
  #define BLUELOCALTIMESTAMP_DATE_TAG 3
@@ -1175,7 +1179,8 @@ X(a, STATIC, REQUIRED, BYTES, signaturePublicKey, 5)
1175
1179
 
1176
1180
  #define BLUEVERSIONINFO_FIELDLIST(X, a) \
1177
1181
  X(a, STATIC, REQUIRED, UINT32, buildTime, 1) \
1178
- X(a, STATIC, REQUIRED, UINT32, version, 2)
1182
+ X(a, STATIC, REQUIRED, UINT32, version, 2) \
1183
+ X(a, STATIC, REQUIRED, UINT32, testVersion, 3)
1179
1184
  #define BLUEVERSIONINFO_CALLBACK NULL
1180
1185
  #define BLUEVERSIONINFO_DEFAULT NULL
1181
1186
 
@@ -1793,7 +1798,7 @@ extern const pb_msgdesc_t _BlueTestEncodeDecode_t_msg;
1793
1798
  #define BLUESPRESULT_SIZE 1795
1794
1799
  #define BLUESPTOKENCOMMAND_SIZE 1861
1795
1800
  #define BLUESPTOKEN_SIZE 1940
1796
- #define BLUEVERSIONINFO_SIZE 10
1801
+ #define BLUEVERSIONINFO_SIZE 14
1797
1802
  #define _BLUETESTENCODEDECODE_SIZE 90
1798
1803
 
1799
1804
  #ifdef __cplusplus
@@ -110,6 +110,8 @@ typedef enum BlueReturnCode {
110
110
  BlueReturnCode_SdkGetBlacklistEntriesFailed = -419,
111
111
  BlueReturnCode_SdkGetSystemStatusFailed = -420,
112
112
  BlueReturnCode_SdkWaitDeviceToRestartFailed = -421,
113
+ BlueReturnCode_SdkUnzipError = -422,
114
+ BlueReturnCode_SdkInvalidFirmwareURL = -423,
113
115
  BlueReturnCode_OssMAReturnCodeStart = -1000,
114
116
  BlueReturnCode_OssMAReturnCodeEnd = -1100
115
117
  } BlueReturnCode_t;
@@ -287,6 +289,7 @@ typedef struct BlueSharedDemoData {
287
289
  typedef struct BlueVersionInfo {
288
290
  uint32_t buildTime;
289
291
  uint16_t version;
292
+ uint16_t testVersion;
290
293
  } BlueVersionInfo_t;
291
294
 
292
295
  typedef struct BlueLocalTimestamp {
@@ -862,7 +865,7 @@ extern "C" {
862
865
 
863
866
  /* Initializer values for message structs */
864
867
  #define BLUESHAREDDEMODATA_INIT_DEFAULT {"wa0y1YwS", {138, {0x30,0x81,0x87,0x02,0x01,0x00,0x30,0x13,0x06,0x07,0x2a,0x86,0x48,0xce,0x3d,0x02,0x01,0x06,0x08,0x2a,0x86,0x48,0xce,0x3d,0x03,0x01,0x07,0x04,0x6d,0x30,0x6b,0x02,0x01,0x01,0x04,0x20,0xa5,0xab,0x6d,0x14,0x11,0x30,0x47,0xa7,0xad,0x6c,0x10,0xe4,0x4d,0xe6,0x3c,0x05,0xb9,0x6b,0x84,0xb5,0x1f,0xe3,0x14,0xd6,0x87,0x5c,0x46,0x9e,0xb9,0xcd,0x69,0x2b,0xa1,0x44,0x03,0x42,0x00,0x04,0x3a,0x66,0x86,0x75,0xc9,0x29,0x29,0x07,0xc3,0x63,0x18,0x97,0x4d,0xd9,0x44,0x1c,0x71,0xf9,0xe4,0x45,0xe8,0x74,0x1a,0x3f,0xaf,0x6b,0xc5,0x8c,0x9c,0x69,0x13,0xbe,0x44,0x14,0x0b,0x60,0x45,0x4f,0x76,0x2f,0xc2,0xf1,0x98,0x41,0x98,0xec,0x6e,0x39,0x1b,0x53,0x36,0x8b,0x90,0x73,0xea,0x1d,0xe7,0x20,0xcf,0xa1,0xbe,0x2d,0xd4,0xf1}}, {91, {0x30,0x59,0x30,0x13,0x06,0x07,0x2a,0x86,0x48,0xce,0x3d,0x02,0x01,0x06,0x08,0x2a,0x86,0x48,0xce,0x3d,0x03,0x01,0x07,0x03,0x42,0x00,0x04,0x3a,0x66,0x86,0x75,0xc9,0x29,0x29,0x07,0xc3,0x63,0x18,0x97,0x4d,0xd9,0x44,0x1c,0x71,0xf9,0xe4,0x45,0xe8,0x74,0x1a,0x3f,0xaf,0x6b,0xc5,0x8c,0x9c,0x69,0x13,0xbe,0x44,0x14,0x0b,0x60,0x45,0x4f,0x76,0x2f,0xc2,0xf1,0x98,0x41,0x98,0xec,0x6e,0x39,0x1b,0x53,0x36,0x8b,0x90,0x73,0xea,0x1d,0xe7,0x20,0xcf,0xa1,0xbe,0x2d,0xd4,0xf1}}, {138, {0x30,0x81,0x87,0x02,0x01,0x00,0x30,0x13,0x06,0x07,0x2a,0x86,0x48,0xce,0x3d,0x02,0x01,0x06,0x08,0x2a,0x86,0x48,0xce,0x3d,0x03,0x01,0x07,0x04,0x6d,0x30,0x6b,0x02,0x01,0x01,0x04,0x20,0xef,0x36,0x55,0xc9,0x4d,0x80,0x1e,0xf4,0x92,0x56,0x75,0x0e,0x70,0xe1,0x51,0x0e,0xcc,0xe8,0xb4,0x6c,0x54,0x5e,0x55,0x1d,0xde,0xbb,0xfc,0x6f,0x22,0xa8,0x49,0x50,0xa1,0x44,0x03,0x42,0x00,0x04,0x5a,0x0d,0x6e,0x67,0x45,0xcc,0xd5,0xc1,0x8c,0xeb,0xd8,0xaf,0xf6,0xea,0x86,0xd8,0xc3,0xaf,0x43,0x3f,0xb7,0xa2,0xd2,0x5f,0x21,0x34,0x42,0xd4,0xcd,0x96,0x83,0xb4,0xe6,0x7d,0x2d,0xdc,0x25,0xeb,0x53,0xf9,0x12,0x76,0x1e,0x40,0xe6,0xc9,0x99,0x83,0xdd,0x90,0x90,0xfe,0xf0,0xb4,0x25,0x99,0xcd,0x16,0xae,0x39,0x2f,0xcf,0x96,0x43}}, {91, {0x30,0x59,0x30,0x13,0x06,0x07,0x2a,0x86,0x48,0xce,0x3d,0x02,0x01,0x06,0x08,0x2a,0x86,0x48,0xce,0x3d,0x03,0x01,0x07,0x03,0x42,0x00,0x04,0x5a,0x0d,0x6e,0x67,0x45,0xcc,0xd5,0xc1,0x8c,0xeb,0xd8,0xaf,0xf6,0xea,0x86,0xd8,0xc3,0xaf,0x43,0x3f,0xb7,0xa2,0xd2,0x5f,0x21,0x34,0x42,0xd4,0xcd,0x96,0x83,0xb4,0xe6,0x7d,0x2d,0xdc,0x25,0xeb,0x53,0xf9,0x12,0x76,0x1e,0x40,0xe6,0xc9,0x99,0x83,0xdd,0x90,0x90,0xfe,0xf0,0xb4,0x25,0x99,0xcd,0x16,0xae,0x39,0x2f,0xcf,0x96,0x43}}}
865
- #define BLUEVERSIONINFO_INIT_DEFAULT {0, 0}
868
+ #define BLUEVERSIONINFO_INIT_DEFAULT {0, 0, 0}
866
869
  #define BLUELOCALTIMESTAMP_INIT_DEFAULT {0, 0, 0, 0, 0, 0u}
867
870
  #define BLUELOCALTIMEPERIOD_INIT_DEFAULT {0, 0, 0, 0}
868
871
  #define BLUELOCALTIMESCHEDULE_INIT_DEFAULT {0, 0, 0, {0, 0, 0, 0, 0, 0, 0}, BLUELOCALTIMEPERIOD_INIT_DEFAULT}
@@ -918,7 +921,7 @@ extern "C" {
918
921
  #define BLUEOSSSOSETTINGS_INIT_DEFAULT {false, BLUEOSSSOMIFAREDESFIRECONFIGURATION_INIT_DEFAULT}
919
922
  #define _BLUETESTENCODEDECODE_INIT_DEFAULT {"", "", 0, 0}
920
923
  #define BLUESHAREDDEMODATA_INIT_ZERO {"", {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}}
921
- #define BLUEVERSIONINFO_INIT_ZERO {0, 0}
924
+ #define BLUEVERSIONINFO_INIT_ZERO {0, 0, 0}
922
925
  #define BLUELOCALTIMESTAMP_INIT_ZERO {0, 0, 0, 0, 0, 0}
923
926
  #define BLUELOCALTIMEPERIOD_INIT_ZERO {0, 0, 0, 0}
924
927
  #define BLUELOCALTIMESCHEDULE_INIT_ZERO {0, 0, 0, {0, 0, 0, 0, 0, 0, 0}, BLUELOCALTIMEPERIOD_INIT_ZERO}
@@ -982,6 +985,7 @@ extern "C" {
982
985
  #define BLUESHAREDDEMODATA_SIGNATUREPUBLICKEY_TAG 5
983
986
  #define BLUEVERSIONINFO_BUILDTIME_TAG 1
984
987
  #define BLUEVERSIONINFO_VERSION_TAG 2
988
+ #define BLUEVERSIONINFO_TESTVERSION_TAG 3
985
989
  #define BLUELOCALTIMESTAMP_YEAR_TAG 1
986
990
  #define BLUELOCALTIMESTAMP_MONTH_TAG 2
987
991
  #define BLUELOCALTIMESTAMP_DATE_TAG 3
@@ -1175,7 +1179,8 @@ X(a, STATIC, REQUIRED, BYTES, signaturePublicKey, 5)
1175
1179
 
1176
1180
  #define BLUEVERSIONINFO_FIELDLIST(X, a) \
1177
1181
  X(a, STATIC, REQUIRED, UINT32, buildTime, 1) \
1178
- X(a, STATIC, REQUIRED, UINT32, version, 2)
1182
+ X(a, STATIC, REQUIRED, UINT32, version, 2) \
1183
+ X(a, STATIC, REQUIRED, UINT32, testVersion, 3)
1179
1184
  #define BLUEVERSIONINFO_CALLBACK NULL
1180
1185
  #define BLUEVERSIONINFO_DEFAULT NULL
1181
1186
 
@@ -1793,7 +1798,7 @@ extern const pb_msgdesc_t _BlueTestEncodeDecode_t_msg;
1793
1798
  #define BLUESPRESULT_SIZE 1795
1794
1799
  #define BLUESPTOKENCOMMAND_SIZE 1861
1795
1800
  #define BLUESPTOKEN_SIZE 1940
1796
- #define BLUEVERSIONINFO_SIZE 10
1801
+ #define BLUEVERSIONINFO_SIZE 14
1797
1802
  #define _BLUETESTENCODEDECODE_SIZE 90
1798
1803
 
1799
1804
  #ifdef __cplusplus
@@ -100,6 +100,13 @@ class BlueAPI: BlueAPIProtocol {
100
100
  )
101
101
  }
102
102
 
103
+ func getLatestFirmware(deviceID: String, with tokenAuthentication: BlueTokenAuthentication) async throws -> BlueFetchResponse<BlueGetLatestFirmwareResult> {
104
+ return try await post(
105
+ endpoint: .AccessGetLatestFirmware,
106
+ request: BlueGetLatestFirmwareRequest(deviceId: deviceID, tokenAuthentication: tokenAuthentication)
107
+ )
108
+ }
109
+
103
110
  private func post<T>(endpoint: BlueAPIEndpoints, request: Encodable) async throws -> BlueFetchResponse<T> {
104
111
  guard #available(macOS 12.0, *) else {
105
112
  throw BlueError(.sdkUnsupportedPlatform)
@@ -18,6 +18,7 @@ public enum BlueAPIEndpoints: String {
18
18
  case AccessCredentials = "/access/credentials"
19
19
  case AccessSynchronizeOfflineAccess = "/access/synchronizeOfflineAccess"
20
20
  case AccessClaimCredential = "/access/cc"
21
+ case AccessGetLatestFirmware = "/access/getLatestFirmware"
21
22
 
22
23
  var url: URL {
23
24
  guard let url = URL(string: baseURL) else {
@@ -236,6 +237,24 @@ internal struct BlueAccessToken: Codable {
236
237
  var expiresAt: Int
237
238
  }
238
239
 
240
+ /// [POST] /access/getLatestFirmware request
241
+ internal struct BlueGetLatestFirmwareRequest: Encodable {
242
+ var deviceId: String
243
+ var tokenAuthentication: BlueTokenAuthentication
244
+ }
245
+
246
+ internal struct BlueLatestFirmwareInfo: Decodable {
247
+ let version: Int
248
+ let testVersion: Int?
249
+ let url: String
250
+ }
251
+
252
+ /// [POST] /access/getLatestFirmware response
253
+ internal struct BlueGetLatestFirmwareResult: Decodable {
254
+ let production: BlueLatestFirmwareInfo?
255
+ let test: BlueLatestFirmwareInfo?
256
+ }
257
+
239
258
  protocol BlueAPIProtocol {
240
259
  func getAccessToken(credentialId: String) async throws -> BlueFetchResponse<BlueAccessToken>
241
260
  func synchronizeMobileAccess(with tokenAuthentication: BlueTokenAuthentication, forceRefresh: Bool?) async throws -> BlueFetchResponse<BlueMobileAccessSynchronizationResult>
@@ -250,4 +269,5 @@ protocol BlueAPIProtocol {
250
269
  func claimDevice(deviceID: String, objectID: String, with tokenAuthentication: BlueTokenAuthentication) async throws -> BlueFetchResponse<BlueClaimDeviceResult>
251
270
  func claimAccessCredential(activationToken: String) async throws -> BlueFetchResponse<BlueClaimAccessCredentialResult>
252
271
  func getAccessCredentials(with tokenAuthentication: BlueTokenAuthentication) async throws -> BlueFetchResponse<BlueGetAccessCredentialsResult>
272
+ func getLatestFirmware(deviceID: String, with tokenAuthentication: BlueTokenAuthentication) async throws -> BlueFetchResponse<BlueGetLatestFirmwareResult>
253
273
  }
@@ -139,6 +139,7 @@ public class BlueSynchronizeAccessDeviceCommand: BlueSdkAsyncCommand {
139
139
  case deployBlacklistEntries
140
140
  case getSystemStatus
141
141
  case pushSystemStatus
142
+ case checkLatestFirmware
142
143
  }
143
144
 
144
145
  internal override func runAsync(arg0: Any? = nil, arg1: Any? = nil, arg2: Any? = nil) async throws -> Any? {
@@ -162,14 +163,14 @@ public class BlueSynchronizeAccessDeviceCommand: BlueSdkAsyncCommand {
162
163
  BlueTask(
163
164
  id: BlueSynchronizeAccessTaskId.getAuthenticationToken,
164
165
  label: blueI18n.syncDeviceGetAuthenticationTokenTaskLabel
165
- ) { _ in
166
+ ) { _, _ in
166
167
  .result(try await self.getAuthenticationToken(credential))
167
168
  },
168
169
 
169
170
  BlueTask(
170
171
  id: BlueSynchronizeAccessTaskId.getDeviceConfig,
171
172
  label: blueI18n.syncDeviceRetrieveDeviceConfigurationTaskLabel
172
- ) { runner in
173
+ ) { _, runner in
173
174
  let tokenAuthentication: BlueTokenAuthentication = try runner.getResult(BlueSynchronizeAccessTaskId.getAuthenticationToken)
174
175
 
175
176
  return .result(try await self.getBlueSystemConfig(deviceID: deviceID, with: tokenAuthentication))
@@ -178,7 +179,7 @@ public class BlueSynchronizeAccessDeviceCommand: BlueSdkAsyncCommand {
178
179
  BlueTask(
179
180
  id: BlueSynchronizeAccessTaskId.updateDeviceConfig,
180
181
  label: blueI18n.syncDeviceUpdateDeviceConfigurationTaskLabel
181
- ) { runner in
182
+ ) { _, runner in
182
183
  let config: BlueSystemConfig? = try runner.getResult(BlueSynchronizeAccessTaskId.getDeviceConfig)
183
184
 
184
185
  let status: BlueSystemStatus = try await self.updateDevice(deviceID, config)
@@ -191,7 +192,7 @@ public class BlueSynchronizeAccessDeviceCommand: BlueSdkAsyncCommand {
191
192
  BlueTask(
192
193
  id: BlueSynchronizeAccessTaskId.updateDeviceTime,
193
194
  label: blueI18n.syncDeviceUpdateDeviceTimeTaskLabel
194
- ) { runner in
195
+ ) { _, runner in
195
196
  let status: BlueSystemStatus = try runner.getResult(BlueSynchronizeAccessTaskId.updateDeviceConfig)
196
197
 
197
198
  return .resultWithStatus(nil, status.settings.timeWasSet == true ? .succeeded : .skipped)
@@ -200,7 +201,7 @@ public class BlueSynchronizeAccessDeviceCommand: BlueSdkAsyncCommand {
200
201
  BlueTask(
201
202
  id: BlueSynchronizeAccessTaskId.waitForRestart,
202
203
  label: blueI18n.syncDeviceWaitForDeviceToRestartTaskLabel
203
- ) { _ in
204
+ ) { _, _ in
204
205
  .result(try await self.waitUntilDeviceHasBeenRestarted(deviceID))
205
206
  },
206
207
 
@@ -208,7 +209,7 @@ public class BlueSynchronizeAccessDeviceCommand: BlueSdkAsyncCommand {
208
209
  id: BlueSynchronizeAccessTaskId.pushEventLogs,
209
210
  label: blueI18n.syncDevicePushEventLogsTaskLabel,
210
211
  failable: true
211
- ) { runner in
212
+ ) { _, runner in
212
213
  let tokenAuthentication: BlueTokenAuthentication = try runner.getResult(BlueSynchronizeAccessTaskId.getAuthenticationToken)
213
214
  let status: BlueSystemStatus = try runner.getResult(BlueSynchronizeAccessTaskId.updateDeviceConfig)
214
215
 
@@ -219,7 +220,7 @@ public class BlueSynchronizeAccessDeviceCommand: BlueSdkAsyncCommand {
219
220
  id: BlueSynchronizeAccessTaskId.pushSystemLogs,
220
221
  label: blueI18n.syncDevicePushSystemLogsTaskLabel,
221
222
  failable: true
222
- ) { runner in
223
+ ) { _, runner in
223
224
  let tokenAuthentication: BlueTokenAuthentication = try runner.getResult(BlueSynchronizeAccessTaskId.getAuthenticationToken)
224
225
  let status: BlueSystemStatus = try runner.getResult(BlueSynchronizeAccessTaskId.updateDeviceConfig)
225
226
 
@@ -230,7 +231,7 @@ public class BlueSynchronizeAccessDeviceCommand: BlueSdkAsyncCommand {
230
231
  id: BlueSynchronizeAccessTaskId.getBlacklistEntries,
231
232
  label: blueI18n.syncDeviceRetrieveBlacklistEntriesTaskLabel,
232
233
  failable: true
233
- ) { runner in
234
+ ) { _, runner in
234
235
  let tokenAuthentication: BlueTokenAuthentication = try runner.getResult(BlueSynchronizeAccessTaskId.getAuthenticationToken)
235
236
 
236
237
  return .result(try await self.getBlacklistEntries(deviceID, tokenAuthentication))
@@ -240,7 +241,7 @@ public class BlueSynchronizeAccessDeviceCommand: BlueSdkAsyncCommand {
240
241
  id: BlueSynchronizeAccessTaskId.deployBlacklistEntries,
241
242
  label: blueI18n.syncDeviceDeployBlacklistEntriesTaskLabel,
242
243
  failable: true
243
- ) { runner in
244
+ ) { _, runner in
244
245
  let entries: BlueBlacklistEntries? = try runner.getResult(BlueSynchronizeAccessTaskId.getBlacklistEntries)
245
246
 
246
247
  guard let entries = entries else {
@@ -253,19 +254,33 @@ public class BlueSynchronizeAccessDeviceCommand: BlueSdkAsyncCommand {
253
254
  BlueTask(
254
255
  id: BlueSynchronizeAccessTaskId.getSystemStatus,
255
256
  label: blueI18n.syncDeviceRetrieveSystemStatusTaskLabel
256
- ) { _ in
257
+ ) { _, _ in
257
258
  .result(try await self.getSystemStatus(deviceID))
258
259
  },
259
260
 
260
261
  BlueTask(
261
262
  id: BlueSynchronizeAccessTaskId.pushSystemStatus,
262
263
  label: blueI18n.syncDevicePushSystemStatusTaskLabel
263
- ) { runner in
264
+ ) { _, runner in
264
265
  let tokenAuthentication: BlueTokenAuthentication = try runner.getResult(BlueSynchronizeAccessTaskId.getAuthenticationToken)
265
266
  let status: BlueSystemStatus = try runner.getResult(BlueSynchronizeAccessTaskId.getSystemStatus)
266
267
 
267
268
  try await self.pushDeviceSystemStatus(status: status, with: tokenAuthentication)
268
269
 
270
+ return .result(status)
271
+ },
272
+
273
+ BlueTask(
274
+ id: BlueSynchronizeAccessTaskId.checkLatestFirmware,
275
+ label: blueI18n.syncDeviceCheckLatestFwlabel,
276
+ failable: true
277
+ ) {_, runner in
278
+ let tokenAuthentication: BlueTokenAuthentication = try runner.getResult(BlueSynchronizeAccessTaskId.getAuthenticationToken)
279
+ var status: BlueSystemStatus = try runner.getResult(BlueSynchronizeAccessTaskId.pushSystemStatus)
280
+ let latestFW = try await self.sdkService.apiService.getLatestFirmware(deviceID: deviceID, with: tokenAuthentication).getData()
281
+
282
+ self.updateFirmwareFlags(&status, latestFW)
283
+
269
284
  return .result(status)
270
285
  }
271
286
  ]
@@ -283,6 +298,11 @@ public class BlueSynchronizeAccessDeviceCommand: BlueSdkAsyncCommand {
283
298
  #endif
284
299
 
285
300
  if runner.isSuccessful() {
301
+ let status: BlueSystemStatus? = try runner.getResult(BlueSynchronizeAccessTaskId.checkLatestFirmware)
302
+ if let status = status {
303
+ return status
304
+ }
305
+
286
306
  return try runner.getResult(BlueSynchronizeAccessTaskId.pushSystemStatus)
287
307
  }
288
308
 
@@ -321,19 +341,7 @@ public class BlueSynchronizeAccessDeviceCommand: BlueSdkAsyncCommand {
321
341
 
322
342
  private func waitUntilDeviceHasBeenRestarted(_ deviceID: String) async throws {
323
343
  do {
324
- var attempts = 0
325
-
326
- while attempts <= 2 {
327
- try? await Task.sleep(nanoseconds: UInt64(blueSecondsToNanoseconds(10)))
328
-
329
- if blueGetDevice(deviceID) != nil {
330
- return
331
- }
332
-
333
- attempts += 1
334
- }
335
-
336
- throw BlueError(.sdkDeviceNotFound)
344
+ try await waitForDeviceAvailability(deviceID)
337
345
  } catch {
338
346
  throw BlueError(.sdkWaitDeviceToRestartFailed, cause: error)
339
347
  }
@@ -510,6 +518,24 @@ public class BlueSynchronizeAccessDeviceCommand: BlueSdkAsyncCommand {
510
518
 
511
519
  } while (sent < limit && offset < entriesCount)
512
520
  }
521
+
522
+ internal func updateFirmwareFlags(_ status: inout BlueSystemStatus, _ latestFW: BlueGetLatestFirmwareResult) {
523
+ if let testFW = latestFW.test {
524
+ if let testVersion = testFW.testVersion {
525
+ status.newTestFirmwareVersionAvailable = testVersion != status.applicationVersionTest || testFW.version != status.applicationVersion
526
+ }
527
+ }
528
+
529
+ if let productionFW = latestFW.production {
530
+ let isTestVersion = status.hasApplicationVersionTest && status.applicationVersionTest != 0
531
+
532
+ if isTestVersion {
533
+ status.newFirmwareVersionAvailable = true
534
+ } else {
535
+ status.newFirmwareVersionAvailable = productionFW.version != status.applicationVersion
536
+ }
537
+ }
538
+ }
513
539
  }
514
540
 
515
541
  public class BlueGetAccessObjectsCommand: BlueSdkAsyncCommand {
@@ -93,6 +93,9 @@ public struct BlueCommands {
93
93
 
94
94
  public let openAppSettings = BlueOpenAppSettingsCommand()
95
95
 
96
+ // MARK: - DFU commands
97
+ public let updateAccessDeviceFirmware = BlueUpdateAccessDeviceFirmwareCommand(defaultSdkService)
98
+
96
99
  // TODO: Make it available only for dev environment
97
100
  public let UNSAFE_clearData = BlueClearDataCommand()
98
101
 
@@ -129,6 +129,8 @@ public enum BlueReturnCode: SwiftProtobuf.Enum {
129
129
  case sdkGetBlacklistEntriesFailed // = -419
130
130
  case sdkGetSystemStatusFailed // = -420
131
131
  case sdkWaitDeviceToRestartFailed // = -421
132
+ case sdkUnzipError // = -422
133
+ case sdkInvalidFirmwareURL // = -423
132
134
  case ossMareturnCodeStart // = -1000
133
135
  case ossMareturnCodeEnd // = -1100
134
136
 
@@ -140,6 +142,8 @@ public enum BlueReturnCode: SwiftProtobuf.Enum {
140
142
  switch rawValue {
141
143
  case -1100: self = .ossMareturnCodeEnd
142
144
  case -1000: self = .ossMareturnCodeStart
145
+ case -423: self = .sdkInvalidFirmwareURL
146
+ case -422: self = .sdkUnzipError
143
147
  case -421: self = .sdkWaitDeviceToRestartFailed
144
148
  case -420: self = .sdkGetSystemStatusFailed
145
149
  case -419: self = .sdkGetBlacklistEntriesFailed
@@ -243,6 +247,8 @@ public enum BlueReturnCode: SwiftProtobuf.Enum {
243
247
  switch self {
244
248
  case .ossMareturnCodeEnd: return -1100
245
249
  case .ossMareturnCodeStart: return -1000
250
+ case .sdkInvalidFirmwareURL: return -423
251
+ case .sdkUnzipError: return -422
246
252
  case .sdkWaitDeviceToRestartFailed: return -421
247
253
  case .sdkGetSystemStatusFailed: return -420
248
254
  case .sdkGetBlacklistEntriesFailed: return -419
@@ -1159,12 +1165,22 @@ public struct BlueVersionInfo {
1159
1165
  /// Clears the value of `version`. Subsequent reads from it will return its default value.
1160
1166
  public mutating func clearVersion() {self._version = nil}
1161
1167
 
1168
+ public var testVersion: UInt32 {
1169
+ get {return _testVersion ?? 0}
1170
+ set {_testVersion = newValue}
1171
+ }
1172
+ /// Returns true if `testVersion` has been explicitly set.
1173
+ public var hasTestVersion: Bool {return self._testVersion != nil}
1174
+ /// Clears the value of `testVersion`. Subsequent reads from it will return its default value.
1175
+ public mutating func clearTestVersion() {self._testVersion = nil}
1176
+
1162
1177
  public var unknownFields = SwiftProtobuf.UnknownStorage()
1163
1178
 
1164
1179
  public init() {}
1165
1180
 
1166
1181
  fileprivate var _buildTime: UInt32? = nil
1167
1182
  fileprivate var _version: UInt32? = nil
1183
+ fileprivate var _testVersion: UInt32? = nil
1168
1184
  }
1169
1185
 
1170
1186
  public struct BlueLocalTimestamp {
@@ -3643,6 +3659,8 @@ extension BlueReturnCode: SwiftProtobuf._ProtoNameProviding {
3643
3659
  public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
3644
3660
  -1100: .same(proto: "OssMAReturnCodeEnd"),
3645
3661
  -1000: .same(proto: "OssMAReturnCodeStart"),
3662
+ -423: .same(proto: "SdkInvalidFirmwareURL"),
3663
+ -422: .same(proto: "SdkUnzipError"),
3646
3664
  -421: .same(proto: "SdkWaitDeviceToRestartFailed"),
3647
3665
  -420: .same(proto: "SdkGetSystemStatusFailed"),
3648
3666
  -419: .same(proto: "SdkGetBlacklistEntriesFailed"),
@@ -3972,11 +3990,13 @@ extension BlueVersionInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplemen
3972
3990
  public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
3973
3991
  1: .same(proto: "buildTime"),
3974
3992
  2: .same(proto: "version"),
3993
+ 3: .same(proto: "testVersion"),
3975
3994
  ]
3976
3995
 
3977
3996
  public var isInitialized: Bool {
3978
3997
  if self._buildTime == nil {return false}
3979
3998
  if self._version == nil {return false}
3999
+ if self._testVersion == nil {return false}
3980
4000
  return true
3981
4001
  }
3982
4002
 
@@ -3988,6 +4008,7 @@ extension BlueVersionInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplemen
3988
4008
  switch fieldNumber {
3989
4009
  case 1: try { try decoder.decodeSingularUInt32Field(value: &self._buildTime) }()
3990
4010
  case 2: try { try decoder.decodeSingularUInt32Field(value: &self._version) }()
4011
+ case 3: try { try decoder.decodeSingularUInt32Field(value: &self._testVersion) }()
3991
4012
  default: break
3992
4013
  }
3993
4014
  }
@@ -4004,12 +4025,16 @@ extension BlueVersionInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplemen
4004
4025
  try { if let v = self._version {
4005
4026
  try visitor.visitSingularUInt32Field(value: v, fieldNumber: 2)
4006
4027
  } }()
4028
+ try { if let v = self._testVersion {
4029
+ try visitor.visitSingularUInt32Field(value: v, fieldNumber: 3)
4030
+ } }()
4007
4031
  try unknownFields.traverse(visitor: &visitor)
4008
4032
  }
4009
4033
 
4010
4034
  public static func ==(lhs: BlueVersionInfo, rhs: BlueVersionInfo) -> Bool {
4011
4035
  if lhs._buildTime != rhs._buildTime {return false}
4012
4036
  if lhs._version != rhs._version {return false}
4037
+ if lhs._testVersion != rhs._testVersion {return false}
4013
4038
  if lhs.unknownFields != rhs.unknownFields {return false}
4014
4039
  return true
4015
4040
  }
@@ -0,0 +1,73 @@
1
+ import CoreBluetooth
2
+ import Foundation
3
+ import NordicDFU
4
+
5
+ /**
6
+ * @class BlueDFUPeripheralService
7
+ * A utility class for looking up peripherals that are advertising DFU service.
8
+ */
9
+ internal class BlueDFUPeripheralService: NSObject, CBCentralManagerDelegate {
10
+ private var centralManager: CBCentralManager? = nil
11
+ private var discoveredPeripheral: CBPeripheral?
12
+ private var continuation: CheckedContinuation<CBPeripheral, any Error>?
13
+
14
+ /// Finds a peripheral that is advertising DFU service asynchronously within the specified timeout period.
15
+ ///
16
+ /// - parameter timeout: The duration in seconds to wait for the peripheral to be discovered. Default value is 10.0 seconds.
17
+ /// - returns: A `CBPeripheral` object representing the DFU peripheral if found.
18
+ /// - throws: An error of type `BlueError` if the timeout period elapses without finding the peripheral.
19
+ func find(_ timeout: TimeInterval = 10.0) async throws -> CBPeripheral {
20
+ if self.centralManager != nil {
21
+ throw BlueError(.invalidState)
22
+ }
23
+
24
+ self.centralManager = CBCentralManager(delegate: self, queue: nil)
25
+
26
+ return try await withCheckedThrowingContinuation { continuation in
27
+ self.continuation = continuation
28
+
29
+ self.startScan()
30
+
31
+ DispatchQueue.main.asyncAfter(deadline: .now() + timeout) {
32
+ if self.discoveredPeripheral == nil {
33
+ continuation.resume(throwing: BlueError(.sdkTimeout))
34
+ }
35
+ }
36
+ }
37
+ }
38
+
39
+ /// Destroys the BlueDFUPeripheralService instance, releasing any resources it holds.
40
+ func destroy() {
41
+ if let centralManager = centralManager {
42
+ if centralManager.isScanning {
43
+ centralManager.stopScan()
44
+ }
45
+ centralManager.delegate = nil
46
+ }
47
+ }
48
+
49
+ /// Starts scanning for peripherals that are that are advertising DFU service.
50
+ private func startScan() {
51
+ if let centralManager = centralManager {
52
+ if (centralManager.isScanning) {
53
+ centralManager.stopScan()
54
+ }
55
+
56
+ if centralManager.state == .poweredOn {
57
+ centralManager.scanForPeripherals(withServices: [DFUUuidHelper().secureDFUService], options: [CBCentralManagerScanOptionAllowDuplicatesKey: true])
58
+ }
59
+ }
60
+ }
61
+
62
+ // MARK: - CBCentralManagerDelegate API
63
+
64
+ func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String : Any], rssi RSSI: NSNumber) {
65
+ self.discoveredPeripheral = peripheral
66
+ self.continuation?.resume(returning: peripheral)
67
+ self.destroy()
68
+ }
69
+
70
+ func centralManagerDidUpdateState(_ central: CBCentralManager) {
71
+ self.startScan()
72
+ }
73
+ }