react-native-beidou 1.0.5 → 1.0.7
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/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -2
- package/android/build.gradle +11 -3
- package/android/src/main/java/com/cmcc_rn_module/BeiDouBluetoothModule.java +1 -1
- package/index.ts +6 -6
- package/package.json +1 -1
- package/android/src/main/libs/bluetooth-sdk.aar +0 -0
|
Binary file
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
#
|
|
2
|
-
gradle.version=8.
|
|
1
|
+
#Fri Oct 24 11:21:51 CST 2025
|
|
2
|
+
gradle.version=8.10
|
package/android/build.gradle
CHANGED
|
@@ -46,12 +46,20 @@ repositories {
|
|
|
46
46
|
google()
|
|
47
47
|
mavenCentral()
|
|
48
48
|
maven { url 'https://www.jitpack.io' }
|
|
49
|
+
maven {
|
|
50
|
+
url "http://10.18.1.5:8081/repository/maven-releases/"
|
|
51
|
+
allowInsecureProtocol = true // 如果私服是HTTP而非HTTPS,需要此配置
|
|
52
|
+
credentials {
|
|
53
|
+
username = "admin" // 如果需要认证
|
|
54
|
+
password = "ZTUz-Yjg0OGRm"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
49
57
|
}
|
|
50
58
|
|
|
51
59
|
dependencies {
|
|
52
60
|
//noinspection GradleDynamicVersion
|
|
53
61
|
implementation "com.facebook.react:react-native:${_reactNativeVersion}"
|
|
54
|
-
|
|
62
|
+
implementation 'com.fxzs:beidousdk:1.0.0@aar' // 关键:添加 @aar 后缀
|
|
55
63
|
// Add local AAR files
|
|
56
|
-
|
|
57
|
-
}
|
|
64
|
+
// implementation fileTree(dir: "src/main/libs", include: ["*.jar", "*.aar"])
|
|
65
|
+
}
|
|
@@ -143,7 +143,7 @@ public class BeiDouBluetoothModule extends ReactContextBaseJavaModule {
|
|
|
143
143
|
|
|
144
144
|
// 开始扫描蓝牙设备
|
|
145
145
|
@ReactMethod
|
|
146
|
-
public void startScanForService() {
|
|
146
|
+
public void startScanForService(Callback callback) {
|
|
147
147
|
BluetoothSDK instance = BluetoothSDK.getInstance(reactContext);
|
|
148
148
|
Log.d("BluetoothSDK", "MyModule-> 开始扫描");
|
|
149
149
|
instance.startScan();
|
package/index.ts
CHANGED
|
@@ -80,7 +80,7 @@ export interface MessageInfo {
|
|
|
80
80
|
interface BeiDouBluetoothModuleType {
|
|
81
81
|
// 原有蓝牙相关方法
|
|
82
82
|
getAllConversations(): Promise<string>; // 更新为Promise版本
|
|
83
|
-
startScanForService(): void;
|
|
83
|
+
startScanForService(callback: (res: number) => void): void;
|
|
84
84
|
stopScanning(): void;
|
|
85
85
|
getDiscoveredDevices(): Promise<string>; // JSON string of BlueDeviceInfoEntity[]
|
|
86
86
|
connectToDeviceFromCloudDeviceNO(deviceNO: string, a: number): Promise<'ok' | 'fail'>;
|
|
@@ -89,7 +89,7 @@ interface BeiDouBluetoothModuleType {
|
|
|
89
89
|
shouldShowBlueToothPermissionRationale(params: string, callback: (status: BluetoothPermissionRationaleStatus) => void): void;
|
|
90
90
|
initializeBluetooth(callback: (status: BluetoothStatus) => void): void;
|
|
91
91
|
generateRandom16BytesString(): string;
|
|
92
|
-
writeData(randomString: string, deviceNo: string, command: number, attrType: number,
|
|
92
|
+
writeData(randomString: string, deviceNo: string, command: number, attrType: number, callback: (result: number) => void): void;
|
|
93
93
|
|
|
94
94
|
// 新增的iOS兼容方法
|
|
95
95
|
writeInfo(base64Payload: string | null, deviceNO: string, command: number, opCode: number, attrType: number, encrypted: boolean): Promise<WriteInfoResponse>;
|
|
@@ -355,14 +355,14 @@ export const setBeiDouBLEKey = async (bleKey: string): Promise<boolean> => {
|
|
|
355
355
|
export const BeiDouModule = {
|
|
356
356
|
// 蓝牙相关
|
|
357
357
|
bluetooth: {
|
|
358
|
-
startScan: () => BeiDouBluetoothModule.startScanForService(),
|
|
359
|
-
|
|
358
|
+
// startScan: () => BeiDouBluetoothModule.startScanForService(),
|
|
359
|
+
startScan: (callback: (result: number) => void) => BeiDouBluetoothModule.startScanForService(callback),
|
|
360
360
|
stopScan: () => BeiDouBluetoothModule.stopScanning(),
|
|
361
361
|
getDevices: getDiscoveredDevicesArray,
|
|
362
362
|
connect: (deviceNo: string) => BeiDouBluetoothModule.connectToDeviceFromCloudDeviceNO(deviceNo, 0),
|
|
363
363
|
disconnect: (deviceNo: string) => BeiDouBluetoothModule.disConnectWithDeviceUUID(deviceNo),
|
|
364
|
-
writeData: (randomString: string, deviceNo: string, command: number, attrType: number,
|
|
365
|
-
BeiDouBluetoothModule.writeData(randomString, deviceNo, command, attrType,
|
|
364
|
+
writeData: (randomString: string, deviceNo: string, command: number, attrType: number, callback: (result: number) => void) =>
|
|
365
|
+
BeiDouBluetoothModule.writeData(randomString, deviceNo, command, attrType, callback),
|
|
366
366
|
writeInfo: writeInfoToDevice,
|
|
367
367
|
generateRandomString: () => BeiDouBluetoothModule.generateRandom16BytesString(),
|
|
368
368
|
setBLEKey: setBeiDouBLEKey,
|
package/package.json
CHANGED
|
Binary file
|