react-native-beidou 1.1.2 → 1.1.4
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.
- package/BeiDouAIDLTestPage.tsx +19 -505
- package/android/.gradle/8.9/checksums/checksums.lock +0 -0
- package/android/.gradle/8.9/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +1 -1
- package/android/.idea/caches/deviceStreaming.xml +339 -26
- package/android/build.gradle +9 -9
- package/android/src/main/java/com/fxzs.rnbeidou/BeiDouBluetoothModule.java +248 -38
- package/android/src/main/java/com/fxzs.rnbeidou/BeidouAidlHelper.java +11 -3
- package/index.ts +30 -195
- package/ios/BeidouBluetooth.framework/BeidouBluetooth +0 -0
- package/ios/BeidouBluetooth.framework/FMDB.bundle/Info.plist +0 -0
- package/ios/BeidouBluetooth.framework/FMDB.bundle/PrivacyInfo.xcprivacy +0 -14
- package/ios/BeidouBluetooth.framework/Info.plist +0 -0
- package/ios/BeidouBluetooth.framework/_CodeSignature/CodeDirectory +0 -0
- package/ios/BeidouBluetooth.framework/_CodeSignature/CodeRequirements-1 +0 -0
- package/ios/BeidouBluetooth.framework/_CodeSignature/CodeResources +8 -8
- package/ios/BeidouBluetooth.framework/_CodeSignature/CodeSignature +0 -0
- package/package.json +1 -1
- package/react-native-beidou.podspec +6 -3
package/BeiDouAIDLTestPage.tsx
CHANGED
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
import { BeiDouModule } from './index';
|
|
14
14
|
import type {
|
|
15
15
|
BDStatusResponse,
|
|
16
|
-
BDAuthResult,
|
|
17
16
|
BDMsgEncryptResponse,
|
|
18
17
|
BDMsgDecryptResponse,
|
|
19
18
|
BDMsgEphemerisFileDLResponse,
|
|
@@ -40,34 +39,11 @@ const BeiDouAIDLTestPage: React.FC = () => {
|
|
|
40
39
|
const [ephemerisType, setEphemerisType] = useState('GPS');
|
|
41
40
|
const [ephemerisVersion, setEphemerisVersion] = useState('1.0.0');
|
|
42
41
|
const [decryptMsg, setDecryptMsg] = useState('1,2,3,4,5');
|
|
43
|
-
const [slotId, setSlotId] = useState('0');
|
|
44
|
-
const [speedType, setSpeedType] = useState('0');
|
|
45
|
-
const [msgType, setMsgType] = useState('00');
|
|
46
|
-
const [richMediaData, setRichMediaData] = useState('1,2,3,4');
|
|
47
|
-
const [richMediaText, setRichMediaText] = useState('富媒体文本示例');
|
|
48
|
-
const [replyMobile, setReplyMobile] = useState('13800138000');
|
|
49
42
|
|
|
50
43
|
// 服务配置参数
|
|
51
44
|
const [packageName, setPackageName] = useState('com.test.aidlsetvicetest');
|
|
52
45
|
const [actionName, setActionName] = useState('com.samsung.beidoupackage.BeidouMsgAidlService');
|
|
53
46
|
|
|
54
|
-
const parseSlotId = () => {
|
|
55
|
-
const parsed = parseInt(slotId, 10);
|
|
56
|
-
return 0;
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
const parseReceiveList = () =>
|
|
60
|
-
receiveList
|
|
61
|
-
.split(',')
|
|
62
|
-
.map(s => s.trim())
|
|
63
|
-
.filter(Boolean);
|
|
64
|
-
|
|
65
|
-
const parseRichMediaDataInput = () =>
|
|
66
|
-
richMediaData
|
|
67
|
-
.split(',')
|
|
68
|
-
.map(s => parseInt(s.trim(), 10))
|
|
69
|
-
.filter(n => Number.isInteger(n) && n >= 0);
|
|
70
|
-
|
|
71
47
|
const addTestResult = (method: string, success: boolean, result?: any, error?: string) => {
|
|
72
48
|
const newResult: TestResult = {
|
|
73
49
|
method,
|
|
@@ -130,12 +106,9 @@ const BeiDouAIDLTestPage: React.FC = () => {
|
|
|
130
106
|
const testAuthenticate = async () => {
|
|
131
107
|
setLoading(true);
|
|
132
108
|
try {
|
|
133
|
-
const result
|
|
134
|
-
addTestResult('authenticate',
|
|
135
|
-
Alert.alert(
|
|
136
|
-
'鉴权结果',
|
|
137
|
-
`Slot: ${result.slotId}\nCode: ${result.code}\n状态: ${result.statusMsg ?? ''}`
|
|
138
|
-
);
|
|
109
|
+
const result = await BeiDouModule.beidou.authenticate();
|
|
110
|
+
addTestResult('authenticate', result, result);
|
|
111
|
+
Alert.alert('鉴权结果', result ? '鉴权成功' : '鉴权失败');
|
|
139
112
|
} catch (error) {
|
|
140
113
|
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
141
114
|
addTestResult('authenticate', false, undefined, errorMsg);
|
|
@@ -149,12 +122,9 @@ const BeiDouAIDLTestPage: React.FC = () => {
|
|
|
149
122
|
const testGetStatus = async () => {
|
|
150
123
|
setLoading(true);
|
|
151
124
|
try {
|
|
152
|
-
const result: BDStatusResponse = await BeiDouModule.beidou.getStatus(
|
|
125
|
+
const result: BDStatusResponse = await BeiDouModule.beidou.getStatus();
|
|
153
126
|
addTestResult('getStatus', true, result);
|
|
154
|
-
Alert.alert(
|
|
155
|
-
'用户状态',
|
|
156
|
-
`Slot: ${result.slotId ?? parseSlotId()}\n代码: ${result.code}\n状态: ${result.statusMsg}\n剩余额度: ${result.msgQuotaRemain}\n用户开通状态: ${result.userOpenStatus}`
|
|
157
|
-
);
|
|
127
|
+
Alert.alert('用户状态', `代码: ${result.code}\n状态: ${result.statusMsg}\n剩余额度: ${result.msgQuotaRemain}`);
|
|
158
128
|
} catch (error) {
|
|
159
129
|
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
160
130
|
addTestResult('getStatus', false, undefined, errorMsg);
|
|
@@ -168,7 +138,7 @@ const BeiDouAIDLTestPage: React.FC = () => {
|
|
|
168
138
|
const testCheckKey = async () => {
|
|
169
139
|
setLoading(true);
|
|
170
140
|
try {
|
|
171
|
-
const result: number = await BeiDouModule.beidou.checkKey(
|
|
141
|
+
const result: number = await BeiDouModule.beidou.checkKey();
|
|
172
142
|
addTestResult('checkKey', true, result);
|
|
173
143
|
Alert.alert('密钥状态', `密钥状态代码: ${result}`);
|
|
174
144
|
} catch (error) {
|
|
@@ -184,21 +154,10 @@ const BeiDouAIDLTestPage: React.FC = () => {
|
|
|
184
154
|
const testCommonEncrypt = async () => {
|
|
185
155
|
setLoading(true);
|
|
186
156
|
try {
|
|
187
|
-
const receivers =
|
|
188
|
-
const result: BDMsgEncryptResponse
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
});
|
|
192
|
-
const first = result[0];
|
|
193
|
-
addTestResult('commonEncrypt', result.length > 0, result, result.length > 0 ? undefined : '无返回数据');
|
|
194
|
-
if (first) {
|
|
195
|
-
Alert.alert(
|
|
196
|
-
'加密成功',
|
|
197
|
-
`返回条数: ${result.length}\n代码: ${first.code}\n状态: ${first.statusMsg}\n发送方: ${first.sendMobile}\n数据长度: ${first.data.length}\nPayload Len: ${first.len}`
|
|
198
|
-
);
|
|
199
|
-
} else {
|
|
200
|
-
Alert.alert('提示', '调用成功但未返回任何加密结果');
|
|
201
|
-
}
|
|
157
|
+
const receivers = receiveList.split(',').map(s => s.trim()).filter(s => s);
|
|
158
|
+
const result: BDMsgEncryptResponse = await BeiDouModule.beidou.encryptCommonMessage(receivers, inputMsg);
|
|
159
|
+
addTestResult('commonEncrypt', true, result);
|
|
160
|
+
Alert.alert('加密成功', `代码: ${result.code}\n状态: ${result.statusMsg}\n发送方: ${result.sendMobile}\n数据长度: ${result.data.length}`);
|
|
202
161
|
} catch (error) {
|
|
203
162
|
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
204
163
|
addTestResult('commonEncrypt', false, undefined, errorMsg);
|
|
@@ -212,7 +171,7 @@ const BeiDouAIDLTestPage: React.FC = () => {
|
|
|
212
171
|
const testPositionEncrypt = async () => {
|
|
213
172
|
setLoading(true);
|
|
214
173
|
try {
|
|
215
|
-
const receivers =
|
|
174
|
+
const receivers = receiveList.split(',').map(s => s.trim()).filter(s => s);
|
|
216
175
|
const lng = parseFloat(longitude);
|
|
217
176
|
const lat = parseFloat(latitude);
|
|
218
177
|
|
|
@@ -221,26 +180,9 @@ const BeiDouAIDLTestPage: React.FC = () => {
|
|
|
221
180
|
return;
|
|
222
181
|
}
|
|
223
182
|
|
|
224
|
-
const result: BDMsgEncryptResponse
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
lng,
|
|
228
|
-
lat,
|
|
229
|
-
{
|
|
230
|
-
slotId: parseSlotId(),
|
|
231
|
-
speedType,
|
|
232
|
-
}
|
|
233
|
-
);
|
|
234
|
-
const first = result[0];
|
|
235
|
-
addTestResult('positionEncrypt', result.length > 0, result, result.length > 0 ? undefined : '无返回数据');
|
|
236
|
-
if (first) {
|
|
237
|
-
Alert.alert(
|
|
238
|
-
'位置加密成功',
|
|
239
|
-
`返回条数: ${result.length}\n代码: ${first.code}\n状态: ${first.statusMsg}\n发送方: ${first.sendMobile}\n数据长度: ${first.data.length}\nPayload Len: ${first.len}`
|
|
240
|
-
);
|
|
241
|
-
} else {
|
|
242
|
-
Alert.alert('提示', '调用成功但未返回任何加密结果');
|
|
243
|
-
}
|
|
183
|
+
const result: BDMsgEncryptResponse = await BeiDouModule.beidou.encryptPositionMessage(receivers, inputMsg, lng, lat);
|
|
184
|
+
addTestResult('positionEncrypt', true, result);
|
|
185
|
+
Alert.alert('位置加密成功', `代码: ${result.code}\n状态: ${result.statusMsg}\n发送方: ${result.sendMobile}\n数据长度: ${result.data.length}`);
|
|
244
186
|
} catch (error) {
|
|
245
187
|
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
246
188
|
addTestResult('positionEncrypt', false, undefined, errorMsg);
|
|
@@ -250,93 +192,13 @@ const BeiDouAIDLTestPage: React.FC = () => {
|
|
|
250
192
|
}
|
|
251
193
|
};
|
|
252
194
|
|
|
253
|
-
const testCommonEmergencyEncrypt = async () => {
|
|
254
|
-
setLoading(true);
|
|
255
|
-
try {
|
|
256
|
-
const receivers = parseReceiveList();
|
|
257
|
-
const result: BDMsgEncryptResponse[] = await BeiDouModule.beidou.encryptCommonEmergencyMessage(
|
|
258
|
-
receivers,
|
|
259
|
-
inputMsg,
|
|
260
|
-
{
|
|
261
|
-
slotId: parseSlotId(),
|
|
262
|
-
speedType,
|
|
263
|
-
}
|
|
264
|
-
);
|
|
265
|
-
const first = result[0];
|
|
266
|
-
addTestResult('commonEmergencyEncrypt', result.length > 0, result, result.length > 0 ? undefined : '无返回数据');
|
|
267
|
-
if (first) {
|
|
268
|
-
Alert.alert(
|
|
269
|
-
'应急通用加密成功',
|
|
270
|
-
`返回条数: ${result.length}\n代码: ${first.code}\n状态: ${first.statusMsg}\n发送方: ${first.sendMobile}\n数据长度: ${first.data.length}`
|
|
271
|
-
);
|
|
272
|
-
} else {
|
|
273
|
-
Alert.alert('提示', '调用成功但未返回任何加密结果');
|
|
274
|
-
}
|
|
275
|
-
} catch (error) {
|
|
276
|
-
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
277
|
-
addTestResult('commonEmergencyEncrypt', false, undefined, errorMsg);
|
|
278
|
-
Alert.alert('错误', `应急通用加密失败: ${errorMsg}`);
|
|
279
|
-
} finally {
|
|
280
|
-
setLoading(false);
|
|
281
|
-
}
|
|
282
|
-
};
|
|
283
|
-
|
|
284
|
-
const testPositionEmergencyEncrypt = async () => {
|
|
285
|
-
setLoading(true);
|
|
286
|
-
try {
|
|
287
|
-
const receivers = parseReceiveList();
|
|
288
|
-
const lng = parseFloat(longitude);
|
|
289
|
-
const lat = parseFloat(latitude);
|
|
290
|
-
|
|
291
|
-
if (isNaN(lng) || isNaN(lat)) {
|
|
292
|
-
Alert.alert('错误', '请输入有效的经纬度');
|
|
293
|
-
return;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
const result: BDMsgEncryptResponse[] = await BeiDouModule.beidou.encryptPositionEmergencyMessage(
|
|
297
|
-
receivers,
|
|
298
|
-
inputMsg,
|
|
299
|
-
lng,
|
|
300
|
-
lat,
|
|
301
|
-
{
|
|
302
|
-
slotId: parseSlotId(),
|
|
303
|
-
speedType,
|
|
304
|
-
}
|
|
305
|
-
);
|
|
306
|
-
const first = result[0];
|
|
307
|
-
addTestResult(
|
|
308
|
-
'positionEmergencyEncrypt',
|
|
309
|
-
result.length > 0,
|
|
310
|
-
result,
|
|
311
|
-
result.length > 0 ? undefined : '无返回数据'
|
|
312
|
-
);
|
|
313
|
-
if (first) {
|
|
314
|
-
Alert.alert(
|
|
315
|
-
'应急位置加密成功',
|
|
316
|
-
`返回条数: ${result.length}\n代码: ${first.code}\n状态: ${first.statusMsg}\n发送方: ${first.sendMobile}\n数据长度: ${first.data.length}`
|
|
317
|
-
);
|
|
318
|
-
} else {
|
|
319
|
-
Alert.alert('提示', '调用成功但未返回任何加密结果');
|
|
320
|
-
}
|
|
321
|
-
} catch (error) {
|
|
322
|
-
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
323
|
-
addTestResult('positionEmergencyEncrypt', false, undefined, errorMsg);
|
|
324
|
-
Alert.alert('错误', `应急位置加密失败: ${errorMsg}`);
|
|
325
|
-
} finally {
|
|
326
|
-
setLoading(false);
|
|
327
|
-
}
|
|
328
|
-
};
|
|
329
|
-
|
|
330
195
|
// 信箱查询加密测试
|
|
331
196
|
const testMailboxQuery = async () => {
|
|
332
197
|
setLoading(true);
|
|
333
198
|
try {
|
|
334
|
-
const result: BDMsgEncryptResponse = await BeiDouModule.beidou.encryptMailboxQuery(
|
|
199
|
+
const result: BDMsgEncryptResponse = await BeiDouModule.beidou.encryptMailboxQuery();
|
|
335
200
|
addTestResult('mailboxQuery', true, result);
|
|
336
|
-
Alert.alert(
|
|
337
|
-
'信箱查询成功',
|
|
338
|
-
`代码: ${result.code}\n状态: ${result.statusMsg}\n发送方: ${result.sendMobile}\n数据长度: ${result.data.length}\nPayload Len: ${result.len}`
|
|
339
|
-
);
|
|
201
|
+
Alert.alert('信箱查询成功', `代码: ${result.code}\n状态: ${result.statusMsg}\n发送方: ${result.sendMobile}\n数据长度: ${result.data.length}`);
|
|
340
202
|
} catch (error) {
|
|
341
203
|
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
342
204
|
addTestResult('mailboxQuery', false, undefined, errorMsg);
|
|
@@ -346,216 +208,6 @@ const BeiDouAIDLTestPage: React.FC = () => {
|
|
|
346
208
|
}
|
|
347
209
|
};
|
|
348
210
|
|
|
349
|
-
const testEmergencyMailboxQuery = async () => {
|
|
350
|
-
setLoading(true);
|
|
351
|
-
try {
|
|
352
|
-
const result: BDMsgEncryptResponse = await BeiDouModule.beidou.encryptEmergencyMailboxQuery(
|
|
353
|
-
replyMobile,
|
|
354
|
-
parseSlotId()
|
|
355
|
-
);
|
|
356
|
-
addTestResult('emergencyMailboxQuery', true, result);
|
|
357
|
-
Alert.alert(
|
|
358
|
-
'应急信箱查询成功',
|
|
359
|
-
`代码: ${result.code}\n状态: ${result.statusMsg}\n发送方: ${result.sendMobile}\n数据长度: ${result.data.length}\nPayload Len: ${result.len}`
|
|
360
|
-
);
|
|
361
|
-
} catch (error) {
|
|
362
|
-
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
363
|
-
addTestResult('emergencyMailboxQuery', false, undefined, errorMsg);
|
|
364
|
-
Alert.alert('错误', `应急信箱查询失败: ${errorMsg}`);
|
|
365
|
-
} finally {
|
|
366
|
-
setLoading(false);
|
|
367
|
-
}
|
|
368
|
-
};
|
|
369
|
-
|
|
370
|
-
const testCommonRichMediaEncrypt = async () => {
|
|
371
|
-
setLoading(true);
|
|
372
|
-
try {
|
|
373
|
-
const receivers = parseReceiveList();
|
|
374
|
-
const dataBytes = parseRichMediaDataInput();
|
|
375
|
-
if (dataBytes.length === 0) {
|
|
376
|
-
Alert.alert('错误', '请填写有效的富媒体数据(逗号分隔的数字)');
|
|
377
|
-
return;
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
const result: BDMsgEncryptResponse[] = await BeiDouModule.beidou.encryptCommonRichMediaMessage(
|
|
381
|
-
receivers,
|
|
382
|
-
msgType,
|
|
383
|
-
dataBytes,
|
|
384
|
-
{
|
|
385
|
-
slotId: parseSlotId(),
|
|
386
|
-
speedType,
|
|
387
|
-
}
|
|
388
|
-
);
|
|
389
|
-
const first = result[0];
|
|
390
|
-
addTestResult('commonRichMediaEncrypt', result.length > 0, result, result.length > 0 ? undefined : '无返回数据');
|
|
391
|
-
if (first) {
|
|
392
|
-
Alert.alert(
|
|
393
|
-
'富媒体通用加密成功',
|
|
394
|
-
`返回条数: ${result.length}\n代码: ${first.code}\n状态: ${first.statusMsg}\n发送方: ${first.sendMobile}`
|
|
395
|
-
);
|
|
396
|
-
} else {
|
|
397
|
-
Alert.alert('提示', '调用成功但未返回任何加密结果');
|
|
398
|
-
}
|
|
399
|
-
} catch (error) {
|
|
400
|
-
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
401
|
-
addTestResult('commonRichMediaEncrypt', false, undefined, errorMsg);
|
|
402
|
-
Alert.alert('错误', `富媒体通用加密失败: ${errorMsg}`);
|
|
403
|
-
} finally {
|
|
404
|
-
setLoading(false);
|
|
405
|
-
}
|
|
406
|
-
};
|
|
407
|
-
|
|
408
|
-
const testPositionRichMediaEncrypt = async () => {
|
|
409
|
-
setLoading(true);
|
|
410
|
-
try {
|
|
411
|
-
const receivers = parseReceiveList();
|
|
412
|
-
const dataBytes = parseRichMediaDataInput();
|
|
413
|
-
if (dataBytes.length === 0) {
|
|
414
|
-
Alert.alert('错误', '请填写有效的富媒体数据(逗号分隔的数字)');
|
|
415
|
-
return;
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
const lng = parseFloat(longitude);
|
|
419
|
-
const lat = parseFloat(latitude);
|
|
420
|
-
|
|
421
|
-
if (isNaN(lng) || isNaN(lat)) {
|
|
422
|
-
Alert.alert('错误', '请输入有效的经纬度');
|
|
423
|
-
return;
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
const result: BDMsgEncryptResponse[] = await BeiDouModule.beidou.encryptPositionRichMediaMessage(
|
|
427
|
-
receivers,
|
|
428
|
-
msgType,
|
|
429
|
-
dataBytes,
|
|
430
|
-
lng,
|
|
431
|
-
lat,
|
|
432
|
-
{
|
|
433
|
-
slotId: parseSlotId(),
|
|
434
|
-
speedType,
|
|
435
|
-
}
|
|
436
|
-
);
|
|
437
|
-
const first = result[0];
|
|
438
|
-
addTestResult(
|
|
439
|
-
'positionRichMediaEncrypt',
|
|
440
|
-
result.length > 0,
|
|
441
|
-
result,
|
|
442
|
-
result.length > 0 ? undefined : '无返回数据'
|
|
443
|
-
);
|
|
444
|
-
if (first) {
|
|
445
|
-
Alert.alert(
|
|
446
|
-
'富媒体位置加密成功',
|
|
447
|
-
`返回条数: ${result.length}\n代码: ${first.code}\n状态: ${first.statusMsg}\n发送方: ${first.sendMobile}`
|
|
448
|
-
);
|
|
449
|
-
} else {
|
|
450
|
-
Alert.alert('提示', '调用成功但未返回任何加密结果');
|
|
451
|
-
}
|
|
452
|
-
} catch (error) {
|
|
453
|
-
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
454
|
-
addTestResult('positionRichMediaEncrypt', false, undefined, errorMsg);
|
|
455
|
-
Alert.alert('错误', `富媒体位置加密失败: ${errorMsg}`);
|
|
456
|
-
} finally {
|
|
457
|
-
setLoading(false);
|
|
458
|
-
}
|
|
459
|
-
};
|
|
460
|
-
|
|
461
|
-
const testCommonRichMediaTextEncrypt = async () => {
|
|
462
|
-
setLoading(true);
|
|
463
|
-
try {
|
|
464
|
-
const receivers = parseReceiveList();
|
|
465
|
-
const dataBytes = parseRichMediaDataInput();
|
|
466
|
-
if (dataBytes.length === 0) {
|
|
467
|
-
Alert.alert('错误', '请填写有效的富媒体数据(逗号分隔的数字)');
|
|
468
|
-
return;
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
const result: BDMsgEncryptResponse[] = await BeiDouModule.beidou.encryptCommonRichMediaAndTextMessage(
|
|
472
|
-
receivers,
|
|
473
|
-
richMediaText,
|
|
474
|
-
msgType,
|
|
475
|
-
dataBytes,
|
|
476
|
-
{
|
|
477
|
-
slotId: parseSlotId(),
|
|
478
|
-
speedType,
|
|
479
|
-
}
|
|
480
|
-
);
|
|
481
|
-
const first = result[0];
|
|
482
|
-
addTestResult(
|
|
483
|
-
'commonRichMediaTextEncrypt',
|
|
484
|
-
result.length > 0,
|
|
485
|
-
result,
|
|
486
|
-
result.length > 0 ? undefined : '无返回数据'
|
|
487
|
-
);
|
|
488
|
-
if (first) {
|
|
489
|
-
Alert.alert(
|
|
490
|
-
'图文通用加密成功',
|
|
491
|
-
`返回条数: ${result.length}\n代码: ${first.code}\n状态: ${first.statusMsg}\n发送方: ${first.sendMobile}`
|
|
492
|
-
);
|
|
493
|
-
} else {
|
|
494
|
-
Alert.alert('提示', '调用成功但未返回任何加密结果');
|
|
495
|
-
}
|
|
496
|
-
} catch (error) {
|
|
497
|
-
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
498
|
-
addTestResult('commonRichMediaTextEncrypt', false, undefined, errorMsg);
|
|
499
|
-
Alert.alert('错误', `图文通用加密失败: ${errorMsg}`);
|
|
500
|
-
} finally {
|
|
501
|
-
setLoading(false);
|
|
502
|
-
}
|
|
503
|
-
};
|
|
504
|
-
|
|
505
|
-
const testPositionRichMediaTextEncrypt = async () => {
|
|
506
|
-
setLoading(true);
|
|
507
|
-
try {
|
|
508
|
-
const receivers = parseReceiveList();
|
|
509
|
-
const dataBytes = parseRichMediaDataInput();
|
|
510
|
-
if (dataBytes.length === 0) {
|
|
511
|
-
Alert.alert('错误', '请填写有效的富媒体数据(逗号分隔的数字)');
|
|
512
|
-
return;
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
const lng = parseFloat(longitude);
|
|
516
|
-
const lat = parseFloat(latitude);
|
|
517
|
-
|
|
518
|
-
if (isNaN(lng) || isNaN(lat)) {
|
|
519
|
-
Alert.alert('错误', '请输入有效的经纬度');
|
|
520
|
-
return;
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
const result: BDMsgEncryptResponse[] = await BeiDouModule.beidou.encryptPositionRichMediaAndTextMessage(
|
|
524
|
-
receivers,
|
|
525
|
-
richMediaText,
|
|
526
|
-
msgType,
|
|
527
|
-
dataBytes,
|
|
528
|
-
lng,
|
|
529
|
-
lat,
|
|
530
|
-
{
|
|
531
|
-
slotId: parseSlotId(),
|
|
532
|
-
speedType,
|
|
533
|
-
}
|
|
534
|
-
);
|
|
535
|
-
const first = result[0];
|
|
536
|
-
addTestResult(
|
|
537
|
-
'positionRichMediaTextEncrypt',
|
|
538
|
-
result.length > 0,
|
|
539
|
-
result,
|
|
540
|
-
result.length > 0 ? undefined : '无返回数据'
|
|
541
|
-
);
|
|
542
|
-
if (first) {
|
|
543
|
-
Alert.alert(
|
|
544
|
-
'图文位置加密成功',
|
|
545
|
-
`返回条数: ${result.length}\n代码: ${first.code}\n状态: ${first.statusMsg}\n发送方: ${first.sendMobile}`
|
|
546
|
-
);
|
|
547
|
-
} else {
|
|
548
|
-
Alert.alert('提示', '调用成功但未返回任何加密结果');
|
|
549
|
-
}
|
|
550
|
-
} catch (error) {
|
|
551
|
-
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
552
|
-
addTestResult('positionRichMediaTextEncrypt', false, undefined, errorMsg);
|
|
553
|
-
Alert.alert('错误', `图文位置加密失败: ${errorMsg}`);
|
|
554
|
-
} finally {
|
|
555
|
-
setLoading(false);
|
|
556
|
-
}
|
|
557
|
-
};
|
|
558
|
-
|
|
559
211
|
// 报文解密测试
|
|
560
212
|
const testDecryptMessage = async () => {
|
|
561
213
|
setLoading(true);
|
|
@@ -566,11 +218,7 @@ const BeiDouAIDLTestPage: React.FC = () => {
|
|
|
566
218
|
return;
|
|
567
219
|
}
|
|
568
220
|
|
|
569
|
-
const result: BDMsgDecryptResponse = await BeiDouModule.beidou.decryptMessage(
|
|
570
|
-
msgBytes,
|
|
571
|
-
msgBytes.length,
|
|
572
|
-
parseSlotId()
|
|
573
|
-
);
|
|
221
|
+
const result: BDMsgDecryptResponse = await BeiDouModule.beidou.decryptMessage(msgBytes, msgBytes.length);
|
|
574
222
|
addTestResult('decryptMessage', true, result);
|
|
575
223
|
Alert.alert('解密成功', `状态: ${result.statusMsg}\n是否还有消息: ${result.isRemainMsg}\n发送方: ${result.rcvMobile}\n内容: ${result.data}`);
|
|
576
224
|
} catch (error) {
|
|
@@ -586,18 +234,9 @@ const BeiDouAIDLTestPage: React.FC = () => {
|
|
|
586
234
|
const testDownloadEphemeris = async () => {
|
|
587
235
|
setLoading(true);
|
|
588
236
|
try {
|
|
589
|
-
const result: BDMsgEphemerisFileDLResponse = await BeiDouModule.beidou.downloadEphemeris(
|
|
590
|
-
ephemerisType,
|
|
591
|
-
ephemerisVersion,
|
|
592
|
-
parseSlotId()
|
|
593
|
-
);
|
|
237
|
+
const result: BDMsgEphemerisFileDLResponse = await BeiDouModule.beidou.downloadEphemeris(ephemerisType, ephemerisVersion);
|
|
594
238
|
addTestResult('downloadEphemeris', true, result);
|
|
595
|
-
Alert.alert(
|
|
596
|
-
'下载成功',
|
|
597
|
-
`Slot: ${result.slotId}\n代码: ${result.code}\n状态: ${result.statusMsg}\n版本: ${result.version}\n文件名: ${result.ephemerisZipFileName ?? '未知'}\n文件大小: ${
|
|
598
|
-
result.ephemerisZipFile.length
|
|
599
|
-
} 字节`
|
|
600
|
-
);
|
|
239
|
+
Alert.alert('下载成功', `代码: ${result.code}\n状态: ${result.statusMsg}\n版本: ${result.version}\n文件大小: ${result.ephemerisZipFile.length} 字节`);
|
|
601
240
|
} catch (error) {
|
|
602
241
|
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
603
242
|
addTestResult('downloadEphemeris', false, undefined, errorMsg);
|
|
@@ -620,14 +259,7 @@ const BeiDouAIDLTestPage: React.FC = () => {
|
|
|
620
259
|
testCheckKey,
|
|
621
260
|
testCommonEncrypt,
|
|
622
261
|
testPositionEncrypt,
|
|
623
|
-
testCommonEmergencyEncrypt,
|
|
624
|
-
testPositionEmergencyEncrypt,
|
|
625
262
|
testMailboxQuery,
|
|
626
|
-
testEmergencyMailboxQuery,
|
|
627
|
-
testCommonRichMediaEncrypt,
|
|
628
|
-
testPositionRichMediaEncrypt,
|
|
629
|
-
testCommonRichMediaTextEncrypt,
|
|
630
|
-
testPositionRichMediaTextEncrypt,
|
|
631
263
|
testDecryptMessage,
|
|
632
264
|
testDownloadEphemeris,
|
|
633
265
|
];
|
|
@@ -700,28 +332,6 @@ const BeiDouAIDLTestPage: React.FC = () => {
|
|
|
700
332
|
<View style={styles.inputSection}>
|
|
701
333
|
<Text style={styles.sectionTitle}>测试参数</Text>
|
|
702
334
|
|
|
703
|
-
<View style={styles.row}>
|
|
704
|
-
<View style={styles.halfInput}>
|
|
705
|
-
<Text style={styles.inputLabel}>SIM Slot ID:</Text>
|
|
706
|
-
<TextInput
|
|
707
|
-
style={styles.textInput}
|
|
708
|
-
value={slotId}
|
|
709
|
-
onChangeText={setSlotId}
|
|
710
|
-
placeholder="0"
|
|
711
|
-
keyboardType="numeric"
|
|
712
|
-
/>
|
|
713
|
-
</View>
|
|
714
|
-
<View style={styles.halfInput}>
|
|
715
|
-
<Text style={styles.inputLabel}>Speed Type:</Text>
|
|
716
|
-
<TextInput
|
|
717
|
-
style={styles.textInput}
|
|
718
|
-
value={speedType}
|
|
719
|
-
onChangeText={setSpeedType}
|
|
720
|
-
placeholder="0"
|
|
721
|
-
/>
|
|
722
|
-
</View>
|
|
723
|
-
</View>
|
|
724
|
-
|
|
725
335
|
<View style={styles.inputGroup}>
|
|
726
336
|
<Text style={styles.inputLabel}>消息内容:</Text>
|
|
727
337
|
<TextInput
|
|
@@ -795,46 +405,6 @@ const BeiDouAIDLTestPage: React.FC = () => {
|
|
|
795
405
|
placeholder="1,2,3,4,5"
|
|
796
406
|
/>
|
|
797
407
|
</View>
|
|
798
|
-
|
|
799
|
-
<View style={styles.inputGroup}>
|
|
800
|
-
<Text style={styles.inputLabel}>消息类型 (msgType):</Text>
|
|
801
|
-
<TextInput
|
|
802
|
-
style={styles.textInput}
|
|
803
|
-
value={msgType}
|
|
804
|
-
onChangeText={setMsgType}
|
|
805
|
-
placeholder="00"
|
|
806
|
-
/>
|
|
807
|
-
</View>
|
|
808
|
-
|
|
809
|
-
<View style={styles.inputGroup}>
|
|
810
|
-
<Text style={styles.inputLabel}>富媒体数据 (逗号分隔的数字):</Text>
|
|
811
|
-
<TextInput
|
|
812
|
-
style={styles.textInput}
|
|
813
|
-
value={richMediaData}
|
|
814
|
-
onChangeText={setRichMediaData}
|
|
815
|
-
placeholder="1,2,3,4"
|
|
816
|
-
/>
|
|
817
|
-
</View>
|
|
818
|
-
|
|
819
|
-
<View style={styles.inputGroup}>
|
|
820
|
-
<Text style={styles.inputLabel}>图文混排文本:</Text>
|
|
821
|
-
<TextInput
|
|
822
|
-
style={styles.textInput}
|
|
823
|
-
value={richMediaText}
|
|
824
|
-
onChangeText={setRichMediaText}
|
|
825
|
-
placeholder="图文混排文本内容"
|
|
826
|
-
/>
|
|
827
|
-
</View>
|
|
828
|
-
|
|
829
|
-
<View style={styles.inputGroup}>
|
|
830
|
-
<Text style={styles.inputLabel}>应急回执手机号:</Text>
|
|
831
|
-
<TextInput
|
|
832
|
-
style={styles.textInput}
|
|
833
|
-
value={replyMobile}
|
|
834
|
-
onChangeText={setReplyMobile}
|
|
835
|
-
placeholder="13800138000"
|
|
836
|
-
/>
|
|
837
|
-
</View>
|
|
838
408
|
</View>
|
|
839
409
|
|
|
840
410
|
{/* 测试按钮区域 */}
|
|
@@ -890,22 +460,6 @@ const BeiDouAIDLTestPage: React.FC = () => {
|
|
|
890
460
|
<Text style={styles.testButtonText}>位置加密</Text>
|
|
891
461
|
</TouchableOpacity>
|
|
892
462
|
|
|
893
|
-
<TouchableOpacity
|
|
894
|
-
style={[styles.testButton, styles.primaryButton]}
|
|
895
|
-
onPress={testCommonEmergencyEncrypt}
|
|
896
|
-
disabled={loading || !isServiceBound}
|
|
897
|
-
>
|
|
898
|
-
<Text style={styles.testButtonText}>应急通用加密</Text>
|
|
899
|
-
</TouchableOpacity>
|
|
900
|
-
|
|
901
|
-
<TouchableOpacity
|
|
902
|
-
style={[styles.testButton, styles.primaryButton]}
|
|
903
|
-
onPress={testPositionEmergencyEncrypt}
|
|
904
|
-
disabled={loading || !isServiceBound}
|
|
905
|
-
>
|
|
906
|
-
<Text style={styles.testButtonText}>应急位置加密</Text>
|
|
907
|
-
</TouchableOpacity>
|
|
908
|
-
|
|
909
463
|
<TouchableOpacity
|
|
910
464
|
style={[styles.testButton, styles.primaryButton]}
|
|
911
465
|
onPress={testMailboxQuery}
|
|
@@ -914,46 +468,6 @@ const BeiDouAIDLTestPage: React.FC = () => {
|
|
|
914
468
|
<Text style={styles.testButtonText}>信箱查询</Text>
|
|
915
469
|
</TouchableOpacity>
|
|
916
470
|
|
|
917
|
-
<TouchableOpacity
|
|
918
|
-
style={[styles.testButton, styles.primaryButton]}
|
|
919
|
-
onPress={testEmergencyMailboxQuery}
|
|
920
|
-
disabled={loading || !isServiceBound}
|
|
921
|
-
>
|
|
922
|
-
<Text style={styles.testButtonText}>应急信箱查询</Text>
|
|
923
|
-
</TouchableOpacity>
|
|
924
|
-
|
|
925
|
-
<TouchableOpacity
|
|
926
|
-
style={[styles.testButton, styles.primaryButton]}
|
|
927
|
-
onPress={testCommonRichMediaEncrypt}
|
|
928
|
-
disabled={loading || !isServiceBound}
|
|
929
|
-
>
|
|
930
|
-
<Text style={styles.testButtonText}>富媒体通用加密</Text>
|
|
931
|
-
</TouchableOpacity>
|
|
932
|
-
|
|
933
|
-
<TouchableOpacity
|
|
934
|
-
style={[styles.testButton, styles.primaryButton]}
|
|
935
|
-
onPress={testPositionRichMediaEncrypt}
|
|
936
|
-
disabled={loading || !isServiceBound}
|
|
937
|
-
>
|
|
938
|
-
<Text style={styles.testButtonText}>富媒体位置加密</Text>
|
|
939
|
-
</TouchableOpacity>
|
|
940
|
-
|
|
941
|
-
<TouchableOpacity
|
|
942
|
-
style={[styles.testButton, styles.primaryButton]}
|
|
943
|
-
onPress={testCommonRichMediaTextEncrypt}
|
|
944
|
-
disabled={loading || !isServiceBound}
|
|
945
|
-
>
|
|
946
|
-
<Text style={styles.testButtonText}>图文通用加密</Text>
|
|
947
|
-
</TouchableOpacity>
|
|
948
|
-
|
|
949
|
-
<TouchableOpacity
|
|
950
|
-
style={[styles.testButton, styles.primaryButton]}
|
|
951
|
-
onPress={testPositionRichMediaTextEncrypt}
|
|
952
|
-
disabled={loading || !isServiceBound}
|
|
953
|
-
>
|
|
954
|
-
<Text style={styles.testButtonText}>图文位置加密</Text>
|
|
955
|
-
</TouchableOpacity>
|
|
956
|
-
|
|
957
471
|
<TouchableOpacity
|
|
958
472
|
style={[styles.testButton, styles.primaryButton]}
|
|
959
473
|
onPress={testDecryptMessage}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
#
|
|
1
|
+
#Thu Jan 29 18:20:18 CST 2026
|
|
2
2
|
gradle.version=8.9
|