@ray-js/api 1.7.39 → 1.7.41

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.
@@ -3,7 +3,160 @@
3
3
  *
4
4
  * @version 4.13.1
5
5
  */
6
+
7
+ interface WifiInfo {
8
+ ssid: string;
9
+ password: string;
10
+ }
11
+ interface NetworkInfo {
12
+ /* 网络类型, 0:wifi, 1:有线, 2:4G */
13
+ network: number;
14
+ ssid: string;
15
+ /* 信号强度 */
16
+ signal: number;
17
+ /* 设备 flags 标识 */
18
+ flags?: number;
19
+ /* ssid hash */
20
+ hashValue: string
21
+ }
22
+ interface NetworkBackupModel {
23
+ ssid: string;
24
+ password?: string;
25
+ /* ssid hash */
26
+ hashValue?: string;
27
+ }
28
+ interface BackupNetworkContext {
29
+ /** 是否支持备份网络 */
30
+ checkBackupNetworkAbility: (params: {
31
+ success?: (params: {
32
+ result: boolean
33
+ }) => void,
34
+ fail?: (params: {
35
+ /** 错误信息 */
36
+ errorMsg: string
37
+ /* 错误码 */
38
+ errorCode: string
39
+ }) => void,
40
+ complete?: (params: null) => void
41
+ }) => void;
42
+
43
+ /** 获取设备当前的网络信息 */
44
+ getCurrentNetworkInfo: (params: {
45
+ success?: (params: {
46
+ info: NetworkInfo
47
+ }) => void,
48
+ fail?: (params: {
49
+ /** 错误信息 */
50
+ errorMsg: string
51
+ /* 错误码 */
52
+ errorCode: string
53
+ }) => void,
54
+ complete?: (params: null) => void
55
+ }) => void;
56
+
57
+ /** 获取设备备份的网络信息 */
58
+ getBackupNetworkInfos: (params: {
59
+ success?: (params: {
60
+ infos: NetworkBackupModel[],
61
+ NetworkBackupModel: number
62
+ }) => void,
63
+ fail?: (params: {
64
+ /** 错误信息 */
65
+ errorMsg: string
66
+ /* 错误码 */
67
+ errorCode: string
68
+ }) => void,
69
+ complete?: (params: null) => void
70
+ }) => void;
71
+
72
+ /* 生成备用网络信息 */
73
+ generateBackupNetworkInfo: (params: {
74
+ wifiInfo: WifiInfo,
75
+ success?: (params: {
76
+ info: NetworkBackupModel
77
+ }) => void,
78
+ fail?: (params: {
79
+ /** 错误信息 */
80
+ errorMsg: string
81
+ /* 错误码 */
82
+ errorCode: string
83
+ }) => void,
84
+ complete?: (params: null) => void
85
+ }) => void;
86
+
87
+ /** 检查是否可以更新备用网络 */
88
+ checkWhetherCanUpdateBackupNetwork: (params: {
89
+ info: NetworkInfo,
90
+ success?: (params: {
91
+ result: boolean
92
+ }) => void,
93
+ fail?: (params: {
94
+ /** 错误信息 */
95
+ errorMsg: string
96
+ /* 错误码 */
97
+ errorCode: string
98
+ }) => void,
99
+ complete?: (params: null) => void
100
+ }) => void;
101
+
102
+ /** 更新备用网络 */
103
+ updateBackupNetwork: (params: {
104
+ networks: NetworkBackupModel[],
105
+ success?: (params: null) => void,
106
+ fail?: (params: {
107
+ /** 错误信息 */
108
+ errorMsg: string
109
+ /* 错误码 */
110
+ errorCode: string
111
+ }) => void,
112
+ complete?: (params: null) => void
113
+ }) => void;
114
+
115
+ /** 检查是否可以切换备用网络 */
116
+ checkWhetherCanSwitchBackupNetwork: (params: {
117
+ info: NetworkInfo,
118
+ success?: (params: {
119
+ result: boolean
120
+ }) => void,
121
+ fail?: (params: {
122
+ /** 错误信息 */
123
+ errorMsg: string
124
+ /* 错误码 */
125
+ errorCode: string
126
+ }) => void,
127
+ complete?: (params: null) => void
128
+ }) => void;
129
+
130
+ /** 切换备用网络 */
131
+ switchBackupNetwork: (params: {
132
+ /* 使用 ssid hash 进行切换 */
133
+ hashValue?: string,
134
+ /* 使用 wifi 信息进行切换 */
135
+ wifiInfo?: WifiInfo,
136
+ success?: (params: null) => void,
137
+ fail?: (params: {
138
+ /** 错误信息 */
139
+ errorMsg: string
140
+ /* 错误码 */
141
+ errorCode: string
142
+ }) => void,
143
+ complete?: (params: null) => void
144
+ }) => void;
145
+ }
6
146
  declare namespace ty.device {
147
+ /**
148
+ *@description 创建内部 DeviceNetworkManager 上下文*/
149
+ export function getDeviceNetworkManager(params: {
150
+ /** 设备模型 设备id */
151
+ deviceId: string
152
+ success?: (params: null) => void
153
+ fail?: (params: {
154
+ errorMsg: string
155
+ errorCode: string | number
156
+ }) => void
157
+ complete?: () => void
158
+ }): BackupNetworkContext
159
+
7
160
  /**
8
161
  *@description 注册监听远离beacon设备范围事件*/
9
162
  export function unregisterLeaveBeaconFenceEvent(params: {
@@ -244,3 +244,4 @@ export declare const subDeviceReplace: typeof ty.device.subDeviceReplace;
244
244
  export declare const fetchReplacementOutcomeJobModel: typeof ty.device.fetchReplacementOutcomeJobModel;
245
245
  export declare const getMeshDeviceIdHex: typeof ty.device.getMeshDeviceIdHex;
246
246
  export declare const onSubDeviceReplaceResult: typeof ty.device.onSubDeviceReplaceResult;
247
+ export declare const getDeviceNetworkManager: typeof ty.device.getDeviceNetworkManager;
@@ -755,4 +755,9 @@ export const getMeshDeviceIdHex = factory('getMeshDeviceIdHex', {
755
755
  });
756
756
  export const onSubDeviceReplaceResult = factory('onSubDeviceReplaceResult', {
757
757
  "namespace": "device"
758
+ });
759
+
760
+ // 4.20.7 新增
761
+ export const getDeviceNetworkManager = factory('getDeviceNetworkManager', {
762
+ "namespace": "device"
758
763
  });
@@ -82,9 +82,9 @@ type GetVehicleImgUrlResult = string;
82
82
  * @param {GetVehicleImgUrlParams} params
83
83
  * @returns {Promise<GetVehicleImgUrlResult>}
84
84
  */
85
- export declare const GetVehicleImgUrl: (params: GetVehicleImgUrlParams) => Promise<GetVehicleImgUrlResult>;
85
+ export declare const getVehicleImgUrl: (params: GetVehicleImgUrlParams) => Promise<GetVehicleImgUrlResult>;
86
86
  /**
87
- * 获取车辆详情图片地址参数
87
+ * 根据活动类型展示位置等获取活动信息参数
88
88
  */
89
89
  type GetActivityInfoParams = {
90
90
  activityTypes: string;
@@ -112,4 +112,48 @@ type GetActivityInfoResult = {
112
112
  * @returns {Promise<GetActivityInfoResult[]>}
113
113
  */
114
114
  export declare const getActivityInfo: (params: GetActivityInfoParams) => Promise<GetActivityInfoResult[]>;
115
+ /**
116
+ * 根据设备id和code查询设备属性信息参数
117
+ */
118
+ type GetDeviceBindInfoParams = {
119
+ deviceId: string;
120
+ codes: string;
121
+ coordinate?: string;
122
+ };
123
+ type GetDeviceBindInfoResult = Record<string, any>;
124
+ /**
125
+ * 根据设备id和code查询设备属性信息
126
+ * @param {GetDeviceBindInfoParams} params
127
+ * @returns {Promise<GetDeviceBindInfoResult>}
128
+ */
129
+ export declare const getDeviceBindInfo: (params: GetDeviceBindInfoParams) => Promise<GetDeviceBindInfoResult>;
130
+ /**
131
+ * 查询用户正在使用中的出行增值服务能力和导航增值服务能力参数
132
+ */
133
+ type GetRunningAbilityParams = {
134
+ devId: string;
135
+ uuid: string;
136
+ };
137
+ type GetRunningAbilityResult = Record<string, any>;
138
+ /**
139
+ * 查询用户正在使用中的出行增值服务能力和导航增值服务能力
140
+ * @param {GetRunningAbilityParams} params
141
+ * @returns {Promise<GetRunningAbilityResult>}
142
+ */
143
+ export declare const getRunningAbility: (params: GetRunningAbilityParams) => Promise<GetRunningAbilityResult>;
144
+ /**
145
+ * 根据设备id更新APP的弹窗状态(只弹窗一次)参数
146
+ */
147
+ type SetVasPopupParams = {
148
+ devId: string;
149
+ uuid: string;
150
+ hadPopup: boolean;
151
+ };
152
+ type SetVasPopupResult = boolean;
153
+ /**
154
+ * 根据设备id更新APP的弹窗状态(只弹窗一次)
155
+ * @param {SetVasPopupParams} params
156
+ * @returns {Promise<SetVasPopupResult>}
157
+ */
158
+ export declare const setVasPopup: (params: SetVasPopupParams) => Promise<SetVasPopupResult>;
115
159
  export {};
@@ -102,7 +102,7 @@ export const getVehicleDetail = params => {
102
102
  * @param {GetVehicleImgUrlParams} params
103
103
  * @returns {Promise<GetVehicleImgUrlResult>}
104
104
  */
105
- export const GetVehicleImgUrl = params => {
105
+ export const getVehicleImgUrl = params => {
106
106
  return requestCloud({
107
107
  api: `m.outdoors.device.vehicle.pic`,
108
108
  version: '1.0',
@@ -111,7 +111,7 @@ export const GetVehicleImgUrl = params => {
111
111
  };
112
112
 
113
113
  /**
114
- * 获取车辆详情图片地址参数
114
+ * 根据活动类型展示位置等获取活动信息参数
115
115
  */
116
116
 
117
117
  /**
@@ -129,4 +129,55 @@ export const getActivityInfo = params => {
129
129
  version: '1.0',
130
130
  data: params
131
131
  });
132
+ };
133
+
134
+ /**
135
+ * 根据设备id和code查询设备属性信息参数
136
+ */
137
+
138
+ /**
139
+ * 根据设备id和code查询设备属性信息
140
+ * @param {GetDeviceBindInfoParams} params
141
+ * @returns {Promise<GetDeviceBindInfoResult>}
142
+ */
143
+ export const getDeviceBindInfo = params => {
144
+ return requestCloud({
145
+ api: `${THING}.m.trip.outdoors.device.bind.info.get`,
146
+ version: '1.0',
147
+ data: params
148
+ });
149
+ };
150
+
151
+ /**
152
+ * 查询用户正在使用中的出行增值服务能力和导航增值服务能力参数
153
+ */
154
+
155
+ /**
156
+ * 查询用户正在使用中的出行增值服务能力和导航增值服务能力
157
+ * @param {GetRunningAbilityParams} params
158
+ * @returns {Promise<GetRunningAbilityResult>}
159
+ */
160
+ export const getRunningAbility = params => {
161
+ return requestCloud({
162
+ api: `m.outdoors.vas.running.ability.get`,
163
+ version: '3.0',
164
+ data: params
165
+ });
166
+ };
167
+
168
+ /**
169
+ * 根据设备id更新APP的弹窗状态(只弹窗一次)参数
170
+ */
171
+
172
+ /**
173
+ * 根据设备id更新APP的弹窗状态(只弹窗一次)
174
+ * @param {SetVasPopupParams} params
175
+ * @returns {Promise<SetVasPopupResult>}
176
+ */
177
+ export const setVasPopup = params => {
178
+ return requestCloud({
179
+ api: `m.outdoors.vas.popup.set`,
180
+ version: '1.0',
181
+ data: params
182
+ });
132
183
  };
@@ -61,7 +61,17 @@ export declare const initDevInfo: (option?: {
61
61
  deviceId?: string;
62
62
  groupId?: string;
63
63
  }) => Promise<DevInfo>;
64
- export declare const getDevInfo: () => DevInfo;
64
+ /**
65
+ * @deprecated
66
+ *
67
+ * 该方法已废弃,请使用@ray-js/ray 中的 device.getDeviceInfo 异步方法或@ray-js/panel-sdk 中的智能设备模型实例的 getDeviceInfo 同步方法获取。
68
+ *
69
+ * 若仍要使用,请确保在 await initDevInfo 方法后调用,此时设备信息已初始化完毕或在返回值为 null 时做好兼容处理。
70
+ */
71
+ export declare const getDevInfo: () => null | DevInfo;
72
+ /**
73
+ * @deprecated 该方法已废弃,请勿使用
74
+ */
65
75
  export declare const updateDevInfo: (devInfo: DevInfo) => void;
66
76
  /**
67
77
  * 绑定当前设备或群组基础事件
@@ -96,9 +96,21 @@ export const initDevInfo = option => {
96
96
  }
97
97
  });
98
98
  };
99
+
100
+ /**
101
+ * @deprecated
102
+ *
103
+ * 该方法已废弃,请使用@ray-js/ray 中的 device.getDeviceInfo 异步方法或@ray-js/panel-sdk 中的智能设备模型实例的 getDeviceInfo 同步方法获取。
104
+ *
105
+ * 若仍要使用,请确保在 await initDevInfo 方法后调用,此时设备信息已初始化完毕或在返回值为 null 时做好兼容处理。
106
+ */
99
107
  export const getDevInfo = () => {
100
108
  return __deviceInfo;
101
109
  };
110
+
111
+ /**
112
+ * @deprecated 该方法已废弃,请勿使用
113
+ */
102
114
  export const updateDevInfo = devInfo => {
103
115
  __deviceInfo = devInfo;
104
116
  };
@@ -2,6 +2,8 @@ import { publishDpsBase } from '../..';
2
2
  import { GetTTTAllParams, DpState } from './types';
3
3
  type PublishDpsOptions = Omit<GetTTTAllParams<typeof publishDpsBase>, 'deviceId' | 'dps'>;
4
4
  /**
5
+ * @deprecated 该方法已废弃,请使用@ray-js/ray中的 device.publishDps 替代
6
+ *
5
7
  * 下发 DP 点控制设备
6
8
  *
7
9
  * @param data - 当前要下发的 DP 数据,同时支持 key 为 dp code 或 dp id
@@ -14,7 +16,8 @@ type PublishDpsOptions = Omit<GetTTTAllParams<typeof publishDpsBase>, 'deviceId'
14
16
  */
15
17
  export declare function sendDps(data: DpState, options?: PublishDpsOptions): Promise<boolean>;
16
18
  /**
17
- * 兼容新旧 publishDps,可以使用原有小程序提供的调用方式,也可以使用 SDK 提供的调用方式。
19
+ * @deprecated 该方法已废弃,请使用@ray-js/ray中的 device.publishDps 替代
20
+ *
18
21
  * @param data ty.device.publishDps的参数 或 当前要下发的 DP 数据,同时支持 key 为 dp code 或 dp id
19
22
  * @param options publishDps 的高阶配置,默认值为 { mode: 2, options: {}, pipelines: [] } * @example
20
23
  *
@@ -10,6 +10,8 @@ const DEFAULT_OPTIONS = {
10
10
  };
11
11
 
12
12
  /**
13
+ * @deprecated 该方法已废弃,请使用@ray-js/ray中的 device.publishDps 替代
14
+ *
13
15
  * 下发 DP 点控制设备
14
16
  *
15
17
  * @param data - 当前要下发的 DP 数据,同时支持 key 为 dp code 或 dp id
@@ -47,7 +49,8 @@ export function sendDps(data) {
47
49
  }
48
50
 
49
51
  /**
50
- * 兼容新旧 publishDps,可以使用原有小程序提供的调用方式,也可以使用 SDK 提供的调用方式。
52
+ * @deprecated 该方法已废弃,请使用@ray-js/ray中的 device.publishDps 替代
53
+ *
51
54
  * @param data ty.device.publishDps的参数 或 当前要下发的 DP 数据,同时支持 key 为 dp code 或 dp id
52
55
  * @param options publishDps 的高阶配置,默认值为 { mode: 2, options: {}, pipelines: [] } * @example
53
56
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/api",
3
- "version": "1.7.39",
3
+ "version": "1.7.41",
4
4
  "description": "Ray universal api",
5
5
  "keywords": [
6
6
  "ray"
@@ -29,8 +29,8 @@
29
29
  "watch": "ray start --type=component"
30
30
  },
31
31
  "dependencies": {
32
- "@ray-js/framework": "1.7.39",
33
- "@ray-js/router": "1.7.39",
32
+ "@ray-js/framework": "1.7.41",
33
+ "@ray-js/router": "1.7.41",
34
34
  "base64-browser": "^1.0.1",
35
35
  "query-string": "^7.1.3"
36
36
  },
@@ -38,7 +38,7 @@
38
38
  "@ray-js/wechat": "^0.3.13"
39
39
  },
40
40
  "devDependencies": {
41
- "@ray-js/cli": "1.7.39",
41
+ "@ray-js/cli": "1.7.41",
42
42
  "art-template": "^4.13.4",
43
43
  "fs-extra": "^10.1.0",
44
44
  "miniprogram-api-typings": "^3.12.3",
@@ -48,5 +48,5 @@
48
48
  "access": "public",
49
49
  "registry": "https://registry.npmjs.org"
50
50
  },
51
- "gitHead": "29022302e7f940eed314d4deb15214fcfe389e2e"
51
+ "gitHead": "8d87c81bc22eb81e68c5ca8d0d76028cf9867a30"
52
52
  }