@onekeyfe/hd-transport-react-native 1.1.27-alpha.34 → 1.1.27-alpha.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/dist/BleManager.d.ts.map +1 -1
- package/dist/BleTransport.d.ts +0 -2
- package/dist/BleTransport.d.ts.map +1 -1
- package/dist/constants.d.ts +0 -3
- package/dist/constants.d.ts.map +1 -1
- package/dist/index.d.ts +5 -53
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +69 -672
- package/dist/types.d.ts +0 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/BleManager.ts +2 -3
- package/src/BleTransport.ts +3 -8
- package/src/constants.ts +1 -24
- package/src/index.ts +55 -788
- package/src/types.ts +0 -3
- package/src/utils/validateNotify.ts +4 -4
- package/dist/logger.d.ts +0 -14
- package/dist/logger.d.ts.map +0 -1
- package/src/logger.ts +0 -19
package/src/types.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { ProtocolType } from '@onekeyfe/hd-transport';
|
|
2
|
-
|
|
3
1
|
export type { BleManager as BlePlxManager } from 'react-native-ble-plx';
|
|
4
2
|
|
|
5
3
|
export type TransportOptions = {
|
|
@@ -9,5 +7,4 @@ export type TransportOptions = {
|
|
|
9
7
|
export type BleAcquireInput = {
|
|
10
8
|
uuid: string;
|
|
11
9
|
forceCleanRunPromise?: boolean;
|
|
12
|
-
expectedProtocol?: ProtocolType;
|
|
13
10
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MESSAGE_HEADER_BYTE, MESSAGE_TOP_CHAR } from '@onekeyfe/hd-transport';
|
|
2
2
|
|
|
3
3
|
export const isHeaderChunk = (chunk: Buffer): boolean => {
|
|
4
4
|
if (chunk.length < 9) return false;
|
|
5
5
|
const [MagicQuestionMark, sharp1, sharp2] = chunk;
|
|
6
6
|
|
|
7
7
|
if (
|
|
8
|
-
String.fromCharCode(MagicQuestionMark) === String.fromCharCode(
|
|
9
|
-
String.fromCharCode(sharp1) === String.fromCharCode(
|
|
10
|
-
String.fromCharCode(sharp2) === String.fromCharCode(
|
|
8
|
+
String.fromCharCode(MagicQuestionMark) === String.fromCharCode(MESSAGE_TOP_CHAR) &&
|
|
9
|
+
String.fromCharCode(sharp1) === String.fromCharCode(MESSAGE_HEADER_BYTE) &&
|
|
10
|
+
String.fromCharCode(sharp2) === String.fromCharCode(MESSAGE_HEADER_BYTE)
|
|
11
11
|
) {
|
|
12
12
|
return true;
|
|
13
13
|
}
|
package/dist/logger.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
type LogMethod = (...args: unknown[]) => void;
|
|
2
|
-
type TransportLogger = {
|
|
3
|
-
debug?: LogMethod;
|
|
4
|
-
error?: LogMethod;
|
|
5
|
-
warn?: LogMethod;
|
|
6
|
-
};
|
|
7
|
-
export declare const setBleLogger: (logger?: TransportLogger) => void;
|
|
8
|
-
export declare const bleLogger: {
|
|
9
|
-
debug: (...args: unknown[]) => void | undefined;
|
|
10
|
-
error: (...args: unknown[]) => void | undefined;
|
|
11
|
-
warn: (...args: unknown[]) => void | undefined;
|
|
12
|
-
};
|
|
13
|
-
export {};
|
|
14
|
-
//# sourceMappingURL=logger.d.ts.map
|
package/dist/logger.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,KAAK,SAAS,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;AAE9C,KAAK,eAAe,GAAG;IACrB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB,CAAC;AAIF,eAAO,MAAM,YAAY,YAAa,eAAe,SAEpD,CAAC;AAEF,eAAO,MAAM,SAAS;qBACH,OAAO,EAAE;qBACT,OAAO,EAAE;oBACV,OAAO,EAAE;CAC1B,CAAC"}
|
package/src/logger.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
type LogMethod = (...args: unknown[]) => void;
|
|
2
|
-
|
|
3
|
-
type TransportLogger = {
|
|
4
|
-
debug?: LogMethod;
|
|
5
|
-
error?: LogMethod;
|
|
6
|
-
warn?: LogMethod;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
let activeLogger: TransportLogger | undefined;
|
|
10
|
-
|
|
11
|
-
export const setBleLogger = (logger?: TransportLogger) => {
|
|
12
|
-
activeLogger = logger;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export const bleLogger = {
|
|
16
|
-
debug: (...args: unknown[]) => activeLogger?.debug?.(...args),
|
|
17
|
-
error: (...args: unknown[]) => activeLogger?.error?.(...args),
|
|
18
|
-
warn: (...args: unknown[]) => activeLogger?.warn?.(...args),
|
|
19
|
-
};
|