react-native-gizwits-sdk-v5 1.1.1 → 1.1.2

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.
@@ -33,18 +33,18 @@ class RNGizSDKManagerModule: RCTEventEmitter, GizSdkEventHandlerDelegate {
33
33
 
34
34
  }
35
35
 
36
- func onDeviceData(device: GizwitsiOSSDK.GizBaseProfile, result: GizwitsiOSSDK.GizJSON, type: GizwitsiOSSDK.GizCapability) {
36
+ func onDeviceData(device: GizwitsiOSSDK.GizDevice, result: GizwitsiOSSDK.GizJSON, type: GizwitsiOSSDK.GizCapability) {
37
37
  let data = [
38
38
  "device": GizRNCallbackManager.convertToDictionary(object: device) ?? [:],
39
- "data": result,
39
+ "data": GizRNCallbackManager.convertToDictionary(object: result) ?? [:],
40
40
  "type": type.rawValue
41
41
  ] as [String : Any]
42
42
  sendEvent(withName: "DeviceDataListener", body: data)
43
43
  }
44
44
 
45
- func onDeviceState(device: GizwitsiOSSDK.GizBaseProfile, state: GizwitsiOSSDK.GizWifiDeviceNetStatus, type: GizwitsiOSSDK.GizCapability) {
45
+ func onDeviceState(device: GizwitsiOSSDK.GizDevice, state: GizwitsiOSSDK.GizWifiDeviceNetStatus, type: GizwitsiOSSDK.GizCapability) {
46
46
  let data = [
47
- "device": GizRNCallbackManager.convertToDictionary(object: device),
47
+ "device": GizRNCallbackManager.convertToDictionary(object: device) ?? [:],
48
48
  "state": state.rawValue,
49
49
  "type": type.rawValue
50
50
  ] as [String : Any]
package/lib/types.d.ts CHANGED
@@ -85,15 +85,25 @@ export interface GizConfigStruct {
85
85
  export declare type GizWifiDeviceNetStatus = 0 | 1 | 2 | 3;
86
86
  export declare type GizCapability = 'BLE' | 'LAN' | 'MQTT';
87
87
  export interface DeviceDataRes {
88
- device: GizBaseProfile;
89
- data: any;
88
+ device: IDevice;
89
+ data: GizDeviceData;
90
90
  type: GizCapability;
91
91
  }
92
92
  export interface DeviceStateRes {
93
- device: GizBaseProfile;
93
+ device: IDevice;
94
94
  state: GizWifiDeviceNetStatus;
95
95
  type: GizCapability;
96
96
  }
97
97
  export declare type DeviceDataCallback = (data: DeviceDataRes) => void;
98
98
  export declare type DeviceStateCallback = (data: DeviceStateRes) => void;
99
99
  export declare type DeviceListCallback = (data: IDevice[]) => void;
100
+ export interface GizDeviceDataItem {
101
+ [keyof: string]: number | Array<number> | boolean;
102
+ }
103
+ export interface GizDeviceData {
104
+ sn: number;
105
+ cmd: number;
106
+ data: GizDeviceDataItem;
107
+ alerts: GizDeviceDataItem;
108
+ faults: GizDeviceDataItem;
109
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-gizwits-sdk-v5",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "Gizwits",
5
5
  "homepage": "https://github.com/demchenkoalex/react-native-gizwits-sdk-v5#readme",
6
6
  "main": "lib/index.js",