react-native-beidou 1.1.4 → 1.1.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/Compass.android.tsx +4 -12
- package/Compass.ios.tsx +2 -3
- package/android/build.gradle +15 -2
- package/android/src/main/AndroidManifest.xml +1 -0
- package/android/src/main/java/com/fxzs.rnbeidou/BeiDouBluetoothModule.java +425 -185
- package/android/src/main/java/com/fxzs.rnbeidou/BeiDouBluetoothPackage.java +10 -13
- package/android/src/main/java/com/fxzs.rnbeidou/BeidouAidlHelper.java +45 -13
- package/android/src/main/java/com/fxzs.rnbeidou/SuperSimModule.java +301 -0
- package/android/src/main/java/com/fxzs.rnbeidou/view/CompassManager.java +15 -15
- package/android/src/main/java/com/fxzs.rnbeidou/view/CompassView.java +10 -4
- package/index.ts +100 -35
- package/ios/BeiDouBluetoothModule.m +147 -20
- 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 +14 -0
- package/ios/BeidouBluetooth.framework/Info.plist +0 -0
- package/ios/BeidouBluetooth.framework/_CodeSignature/CodeDirectory +0 -0
- package/ios/BeidouBluetooth.framework/_CodeSignature/CodeRequirements +0 -0
- package/ios/BeidouBluetooth.framework/_CodeSignature/CodeResources +11 -39
- package/ios/BeidouBluetooth.framework/_CodeSignature/CodeSignature +0 -0
- package/ios/CompassView.h +1 -0
- package/ios/CompassView.m +3 -0
- package/ios/CompassViewComponentView.h +11 -0
- package/ios/CompassViewComponentView.mm +64 -0
- package/package.json +3 -5
- package/react-native-beidou.podspec +2 -2
- package/src/CompassViewNativeComponent.ts +13 -0
- package/src/NativeBeiDouBluetooth.ts +57 -0
- package/src/NativeSuperSim.ts +21 -0
- package/BeiDouAIDLTestPage.tsx +0 -710
- package/LogManager.ts +0 -284
- package/TestPage.ts +0 -6
- package/android/.gradle/8.10/checksums/checksums.lock +0 -0
- package/android/.gradle/8.10/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/8.10/fileChanges/last-build.bin +0 -0
- package/android/.gradle/8.10/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/8.10/gc.properties +0 -0
- package/android/.gradle/8.9/checksums/checksums.lock +0 -0
- package/android/.gradle/8.9/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/8.9/fileChanges/last-build.bin +0 -0
- package/android/.gradle/8.9/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/8.9/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
- package/android/.gradle/config.properties +0 -2
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/.idea/AndroidProjectSystem.xml +0 -6
- package/android/.idea/caches/deviceStreaming.xml +0 -1306
- package/android/.idea/gradle.xml +0 -13
- package/android/.idea/migrations.xml +0 -10
- package/android/.idea/misc.xml +0 -9
- package/android/.idea/runConfigurations.xml +0 -17
- package/android/.idea/vcs.xml +0 -6
- package/android/local.properties +0 -8
- package/android/src/main/java/com/fxzs.rnbeidou/LogManager.java +0 -488
package/LogManager.ts
DELETED
|
@@ -1,284 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { NativeModules, Platform } from 'react-native';
|
|
3
|
-
|
|
4
|
-
const { BeiDouBluetoothModule } = NativeModules;
|
|
5
|
-
/**
|
|
6
|
-
* BeiDou SDK 日志管理器
|
|
7
|
-
* 提供统一的日志管理功能,支持Debug/Release模式切换
|
|
8
|
-
*/
|
|
9
|
-
export interface LogConfig {
|
|
10
|
-
enableFileLog: boolean; // 是否启用文件日志
|
|
11
|
-
enableConsoleLog: boolean; // 是否启用控制台日志
|
|
12
|
-
maxFileSize: number; // 最大文件大小(MB)
|
|
13
|
-
maxFileCount: number; // 最大文件数量
|
|
14
|
-
encryptionKey?: string; // 加密密钥(可选)
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export enum LogLevel {
|
|
18
|
-
VERBOSE = 'VERBOSE',
|
|
19
|
-
DEBUG = 'DEBUG',
|
|
20
|
-
INFO = 'INFO',
|
|
21
|
-
WARN = 'WARN',
|
|
22
|
-
ERROR = 'ERROR',
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* BeiDou SDK 日志管理器类
|
|
27
|
-
*/
|
|
28
|
-
export class BeiDouLogManager {
|
|
29
|
-
private static instance: BeiDouLogManager;
|
|
30
|
-
private isInitialized: boolean = false;
|
|
31
|
-
private currentConfig: LogConfig = {
|
|
32
|
-
enableFileLog: true,
|
|
33
|
-
enableConsoleLog: __DEV__,
|
|
34
|
-
maxFileSize: 10, // 10MB
|
|
35
|
-
maxFileCount: 5,
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
private constructor() {}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* 获取单例实例
|
|
42
|
-
*/
|
|
43
|
-
public static getInstance(): BeiDouLogManager {
|
|
44
|
-
if (!BeiDouLogManager.instance) {
|
|
45
|
-
BeiDouLogManager.instance = new BeiDouLogManager();
|
|
46
|
-
}
|
|
47
|
-
return BeiDouLogManager.instance;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* 初始化日志管理器
|
|
52
|
-
* @param config 日志配置
|
|
53
|
-
*/
|
|
54
|
-
public async initialize(config?: Partial<LogConfig>): Promise<void> {
|
|
55
|
-
if (this.isInitialized) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (config) {
|
|
60
|
-
this.currentConfig = { ...this.currentConfig, ...config };
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
try {
|
|
64
|
-
if (Platform.OS === 'android') {
|
|
65
|
-
await BeiDouBluetoothModule.configureLogger(
|
|
66
|
-
this.currentConfig.enableFileLog,
|
|
67
|
-
this.currentConfig.enableConsoleLog,
|
|
68
|
-
this.currentConfig.maxFileSize,
|
|
69
|
-
this.currentConfig.maxFileCount,
|
|
70
|
-
this.currentConfig.encryptionKey || null
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
this.isInitialized = true;
|
|
75
|
-
this.info('BeiDouLogManager', 'LogManager initialized successfully');
|
|
76
|
-
} catch (error) {
|
|
77
|
-
console.error('Failed to initialize BeiDou LogManager:', error);
|
|
78
|
-
throw error;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* 更新日志配置
|
|
84
|
-
* @param config 新的配置
|
|
85
|
-
*/
|
|
86
|
-
public async updateConfig(config: Partial<LogConfig>): Promise<void> {
|
|
87
|
-
this.currentConfig = { ...this.currentConfig, ...config };
|
|
88
|
-
|
|
89
|
-
try {
|
|
90
|
-
if (Platform.OS === 'android') {
|
|
91
|
-
await BeiDouBluetoothModule.configureLogger(
|
|
92
|
-
this.currentConfig.enableFileLog,
|
|
93
|
-
this.currentConfig.enableConsoleLog,
|
|
94
|
-
this.currentConfig.maxFileSize,
|
|
95
|
-
this.currentConfig.maxFileCount,
|
|
96
|
-
this.currentConfig.encryptionKey || null
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
this.info('BeiDouLogManager', 'LogManager config updated');
|
|
101
|
-
} catch (error) {
|
|
102
|
-
console.error('Failed to update BeiDou LogManager config:', error);
|
|
103
|
-
throw error;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Verbose日志
|
|
109
|
-
*/
|
|
110
|
-
public async verbose(tag: string, message: string): Promise<void> {
|
|
111
|
-
return this.writeLog(LogLevel.VERBOSE, tag, message);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Debug日志
|
|
116
|
-
*/
|
|
117
|
-
public async debug(tag: string, message: string): Promise<void> {
|
|
118
|
-
return this.writeLog(LogLevel.DEBUG, tag, message);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Info日志
|
|
123
|
-
*/
|
|
124
|
-
public async info(tag: string, message: string): Promise<void> {
|
|
125
|
-
return this.writeLog(LogLevel.INFO, tag, message);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Warning日志
|
|
130
|
-
*/
|
|
131
|
-
public async warn(tag: string, message: string): Promise<void> {
|
|
132
|
-
return this.writeLog(LogLevel.WARN, tag, message);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Error日志
|
|
137
|
-
*/
|
|
138
|
-
public async error(tag: string, message: string): Promise<void> {
|
|
139
|
-
return this.writeLog(LogLevel.ERROR, tag, message);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* 写入日志
|
|
144
|
-
* @param level 日志级别
|
|
145
|
-
* @param tag 标签
|
|
146
|
-
* @param message 消息
|
|
147
|
-
*/
|
|
148
|
-
private async writeLog(level: LogLevel, tag: string, message: string): Promise<void> {
|
|
149
|
-
try {
|
|
150
|
-
// 控制台输出(根据配置)
|
|
151
|
-
if (this.currentConfig.enableConsoleLog) {
|
|
152
|
-
const timestamp = new Date().toISOString();
|
|
153
|
-
const logMessage = `[${timestamp}] [${level}] [${tag}] ${message}`;
|
|
154
|
-
|
|
155
|
-
switch (level) {
|
|
156
|
-
case LogLevel.VERBOSE:
|
|
157
|
-
case LogLevel.DEBUG:
|
|
158
|
-
console.log(logMessage);
|
|
159
|
-
break;
|
|
160
|
-
case LogLevel.INFO:
|
|
161
|
-
console.info(logMessage);
|
|
162
|
-
break;
|
|
163
|
-
case LogLevel.WARN:
|
|
164
|
-
console.warn(logMessage);
|
|
165
|
-
break;
|
|
166
|
-
case LogLevel.ERROR:
|
|
167
|
-
console.error(logMessage);
|
|
168
|
-
break;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
// 文件输出(通过原生模块)
|
|
173
|
-
if (Platform.OS === 'android' && this.currentConfig.enableFileLog) {
|
|
174
|
-
await BeiDouBluetoothModule.writeLog(level, tag, message);
|
|
175
|
-
}
|
|
176
|
-
} catch (error) {
|
|
177
|
-
// 日志写入失败时使用console作为备选
|
|
178
|
-
console.error('Failed to write log:', error);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* 获取日志统计信息
|
|
184
|
-
*/
|
|
185
|
-
public async getLogStats(): Promise<string> {
|
|
186
|
-
try {
|
|
187
|
-
if (Platform.OS === 'android') {
|
|
188
|
-
return await BeiDouBluetoothModule.getLogStats();
|
|
189
|
-
}
|
|
190
|
-
return 'Log stats not available on this platform';
|
|
191
|
-
} catch (error) {
|
|
192
|
-
console.error('Failed to get log stats:', error);
|
|
193
|
-
return 'Failed to get log stats: ' + error;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* 清空所有日志文件
|
|
199
|
-
*/
|
|
200
|
-
public async clearAllLogs(): Promise<void> {
|
|
201
|
-
try {
|
|
202
|
-
if (Platform.OS === 'android') {
|
|
203
|
-
await BeiDouBluetoothModule.clearAllLogs();
|
|
204
|
-
}
|
|
205
|
-
this.info('BeiDouLogManager', 'All logs cleared');
|
|
206
|
-
} catch (error) {
|
|
207
|
-
console.error('Failed to clear logs:', error);
|
|
208
|
-
throw error;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
/**
|
|
213
|
-
* 获取当前配置
|
|
214
|
-
*/
|
|
215
|
-
public getConfig(): LogConfig {
|
|
216
|
-
return { ...this.currentConfig };
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* 检查是否已初始化
|
|
221
|
-
*/
|
|
222
|
-
public isReady(): boolean {
|
|
223
|
-
return this.isInitialized;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
// 导出单例实例
|
|
228
|
-
export const BeiDouLogger = BeiDouLogManager.getInstance();
|
|
229
|
-
|
|
230
|
-
// 导出便捷方法
|
|
231
|
-
export const logVerbose = (tag: string, message: string) => BeiDouLogger.verbose(tag, message);
|
|
232
|
-
export const logDebug = (tag: string, message: string) => BeiDouLogger.debug(tag, message);
|
|
233
|
-
export const logInfo = (tag: string, message: string) => BeiDouLogger.info(tag, message);
|
|
234
|
-
export const logWarn = (tag: string, message: string) => BeiDouLogger.warn(tag, message);
|
|
235
|
-
export const logError = (tag: string, message: string) => BeiDouLogger.error(tag, message);
|
|
236
|
-
|
|
237
|
-
/**
|
|
238
|
-
* 全局日志拦截器
|
|
239
|
-
* 在Release模式下拦截console日志并重定向到文件
|
|
240
|
-
*/
|
|
241
|
-
export const setupGlobalLogInterception = () => {
|
|
242
|
-
if (!__DEV__) {
|
|
243
|
-
// 保存原始console方法
|
|
244
|
-
const originalConsole = {
|
|
245
|
-
log: console.log,
|
|
246
|
-
info: console.info,
|
|
247
|
-
warn: console.warn,
|
|
248
|
-
error: console.error,
|
|
249
|
-
debug: console.debug,
|
|
250
|
-
};
|
|
251
|
-
|
|
252
|
-
// 重写console方法
|
|
253
|
-
console.log = (...args) => {
|
|
254
|
-
BeiDouLogger.info('Console', args.join(' '));
|
|
255
|
-
};
|
|
256
|
-
|
|
257
|
-
console.info = (...args) => {
|
|
258
|
-
BeiDouLogger.info('Console', args.join(' '));
|
|
259
|
-
};
|
|
260
|
-
|
|
261
|
-
console.warn = (...args) => {
|
|
262
|
-
BeiDouLogger.warn('Console', args.join(' '));
|
|
263
|
-
};
|
|
264
|
-
|
|
265
|
-
console.error = (...args) => {
|
|
266
|
-
BeiDouLogger.error('Console', args.join(' '));
|
|
267
|
-
};
|
|
268
|
-
|
|
269
|
-
console.debug = (...args) => {
|
|
270
|
-
BeiDouLogger.debug('Console', args.join(' '));
|
|
271
|
-
};
|
|
272
|
-
|
|
273
|
-
// 提供恢复原始console的方法(用于调试)
|
|
274
|
-
(global as any).__restoreConsole = () => {
|
|
275
|
-
Object.assign(console, originalConsole);
|
|
276
|
-
};
|
|
277
|
-
}
|
|
278
|
-
};
|
|
279
|
-
|
|
280
|
-
export default BeiDouLogManager;
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
package/TestPage.ts
DELETED
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
File without changes
|