@ray-js/lamp-schedule-core 1.0.0-beta-1

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.
Files changed (246) hide show
  1. package/README.md +565 -0
  2. package/lib/config/dpCodes.d.ts +27 -0
  3. package/lib/config/dpCodes.js +30 -0
  4. package/lib/config/index.d.ts +2 -0
  5. package/lib/config/index.js +2 -0
  6. package/lib/config/rhythms/defaultValue.d.ts +18 -0
  7. package/lib/config/rhythms/defaultValue.js +72 -0
  8. package/lib/config/rhythms/index.d.ts +10 -0
  9. package/lib/config/rhythms/index.js +35 -0
  10. package/lib/conflict/ConflictResolver.d.ts +2 -0
  11. package/lib/conflict/ConflictResolver.js +284 -0
  12. package/lib/conflict/__test__/ConflictResolver.test.d.ts +1 -0
  13. package/lib/conflict/__test__/ConflictResolver.test.js +183 -0
  14. package/lib/conflict/__test__/index.test.d.ts +1 -0
  15. package/lib/conflict/__test__/index.test.js +385 -0
  16. package/lib/conflict/__test__/scheduleDataManager.test.d.ts +1 -0
  17. package/lib/conflict/__test__/scheduleDataManager.test.js +170 -0
  18. package/lib/conflict/__test__/transform.test.d.ts +1 -0
  19. package/lib/conflict/__test__/transform.test.js +454 -0
  20. package/lib/conflict/__test__/updateDeviceDp.d.ts +1 -0
  21. package/lib/conflict/__test__/updateDeviceDp.js +114 -0
  22. package/lib/conflict/index.d.ts +42 -0
  23. package/lib/conflict/index.js +103 -0
  24. package/lib/conflict/scheduleDataManager.d.ts +12 -0
  25. package/lib/conflict/scheduleDataManager.js +79 -0
  26. package/lib/conflict/transform.d.ts +71 -0
  27. package/lib/conflict/transform.js +251 -0
  28. package/lib/conflict/type.d.ts +55 -0
  29. package/lib/conflict/type.js +17 -0
  30. package/lib/conflict/updateDeviceDp.d.ts +1 -0
  31. package/lib/conflict/updateDeviceDp.js +41 -0
  32. package/lib/constant/index.d.ts +5 -0
  33. package/lib/constant/index.js +5 -0
  34. package/lib/context/index.d.ts +3 -0
  35. package/lib/context/index.js +3 -0
  36. package/lib/context/rhythms/actions.d.ts +20 -0
  37. package/lib/context/rhythms/actions.js +52 -0
  38. package/lib/context/rhythms/index.d.ts +5 -0
  39. package/lib/context/rhythms/index.js +51 -0
  40. package/lib/context/rhythms/reducer.d.ts +24 -0
  41. package/lib/context/rhythms/reducer.js +38 -0
  42. package/lib/context/schedule/actions.d.ts +7 -0
  43. package/lib/context/schedule/actions.js +51 -0
  44. package/lib/context/schedule/context.d.ts +6 -0
  45. package/lib/context/schedule/context.js +52 -0
  46. package/lib/context/schedule/index.d.ts +1 -0
  47. package/lib/context/schedule/index.js +1 -0
  48. package/lib/context/schedule/reducer.d.ts +16 -0
  49. package/lib/context/schedule/reducer.js +104 -0
  50. package/lib/context/schedule/type.d.ts +41 -0
  51. package/lib/context/schedule/type.js +11 -0
  52. package/lib/context/timer/actions.d.ts +8 -0
  53. package/lib/context/timer/actions.js +52 -0
  54. package/lib/context/timer/context.d.ts +10 -0
  55. package/lib/context/timer/context.js +53 -0
  56. package/lib/context/timer/index.d.ts +1 -0
  57. package/lib/context/timer/index.js +1 -0
  58. package/lib/context/timer/reducer.d.ts +15 -0
  59. package/lib/context/timer/reducer.js +70 -0
  60. package/lib/context/timer/type.d.ts +46 -0
  61. package/lib/context/timer/type.js +24 -0
  62. package/lib/dpParser/README.md +63 -0
  63. package/lib/dpParser/__test__/cycle.test.d.ts +1 -0
  64. package/lib/dpParser/__test__/cycle.test.js +258 -0
  65. package/lib/dpParser/__test__/random.test.d.ts +1 -0
  66. package/lib/dpParser/__test__/random.test.js +211 -0
  67. package/lib/dpParser/__test__/rhythms.test.d.ts +1 -0
  68. package/lib/dpParser/__test__/rhythms.test.js +71 -0
  69. package/lib/dpParser/__test__/rtcTimer.test.d.ts +1 -0
  70. package/lib/dpParser/__test__/rtcTimer.test.js +235 -0
  71. package/lib/dpParser/__test__/sleep.test.d.ts +1 -0
  72. package/lib/dpParser/__test__/sleep.test.js +71 -0
  73. package/lib/dpParser/__test__/sleepCommon.test.d.ts +1 -0
  74. package/lib/dpParser/__test__/sleepCommon.test.js +197 -0
  75. package/lib/dpParser/__test__/timerReport.test.d.ts +1 -0
  76. package/lib/dpParser/__test__/timerReport.test.js +100 -0
  77. package/lib/dpParser/__test__/wakeup.test.d.ts +1 -0
  78. package/lib/dpParser/__test__/wakeup.test.js +69 -0
  79. package/lib/dpParser/__test__/wakeupCommon.test.d.ts +1 -0
  80. package/lib/dpParser/__test__/wakeupCommon.test.js +131 -0
  81. package/lib/dpParser/cycle/index.d.ts +15 -0
  82. package/lib/dpParser/cycle/index.js +134 -0
  83. package/lib/dpParser/index.d.ts +23 -0
  84. package/lib/dpParser/index.js +43 -0
  85. package/lib/dpParser/random/index.d.ts +15 -0
  86. package/lib/dpParser/random/index.js +127 -0
  87. package/lib/dpParser/rhythms.d.ts +41 -0
  88. package/lib/dpParser/rhythms.js +116 -0
  89. package/lib/dpParser/rtcTimer.d.ts +17 -0
  90. package/lib/dpParser/rtcTimer.js +300 -0
  91. package/lib/dpParser/sleep/index.d.ts +9 -0
  92. package/lib/dpParser/sleep/index.js +29 -0
  93. package/lib/dpParser/sleep/sleepCommon.d.ts +11 -0
  94. package/lib/dpParser/sleep/sleepCommon.js +117 -0
  95. package/lib/dpParser/sleep/sleepSigmesh.d.ts +0 -0
  96. package/lib/dpParser/sleep/sleepSigmesh.js +101 -0
  97. package/lib/dpParser/timerReport.d.ts +11 -0
  98. package/lib/dpParser/timerReport.js +43 -0
  99. package/lib/dpParser/utils.d.ts +27 -0
  100. package/lib/dpParser/utils.js +53 -0
  101. package/lib/dpParser/wakeup/index.d.ts +10 -0
  102. package/lib/dpParser/wakeup/index.js +34 -0
  103. package/lib/dpParser/wakeup/wakeupCommon.d.ts +11 -0
  104. package/lib/dpParser/wakeup/wakeupCommon.js +106 -0
  105. package/lib/dpParser/wakeup/wakeupSigmesh.d.ts +15 -0
  106. package/lib/dpParser/wakeup/wakeupSigmesh.js +86 -0
  107. package/lib/hooks/__test__/useCommon.test.d.ts +1 -0
  108. package/lib/hooks/__test__/useCommon.test.js +72 -0
  109. package/lib/hooks/__test__/useCountdownDp.test.d.ts +1 -0
  110. package/lib/hooks/__test__/useCountdownDp.test.js +82 -0
  111. package/lib/hooks/__test__/useCycleDp.test.d.ts +1 -0
  112. package/lib/hooks/__test__/useCycleDp.test.js +92 -0
  113. package/lib/hooks/__test__/useRandomDp.test.d.ts +1 -0
  114. package/lib/hooks/__test__/useRandomDp.test.js +88 -0
  115. package/lib/hooks/__test__/useRhythmsDp.test.d.ts +1 -0
  116. package/lib/hooks/__test__/useRhythmsDp.test.js +81 -0
  117. package/lib/hooks/__test__/useSleepDp.test.d.ts +1 -0
  118. package/lib/hooks/__test__/useSleepDp.test.js +127 -0
  119. package/lib/hooks/__test__/useTimeFlush.test.d.ts +1 -0
  120. package/lib/hooks/__test__/useTimeFlush.test.js +109 -0
  121. package/lib/hooks/__test__/useTimerDp.test.d.ts +1 -0
  122. package/lib/hooks/__test__/useTimerDp.test.js +79 -0
  123. package/lib/hooks/__test__/useTimerOperate.test.d.ts +1 -0
  124. package/lib/hooks/__test__/useTimerOperate.test.js +286 -0
  125. package/lib/hooks/__test__/useTimerOperateCloud.test.d.ts +1 -0
  126. package/lib/hooks/__test__/useTimerOperateCloud.test.js +190 -0
  127. package/lib/hooks/__test__/useTimerOperateLocal.test.d.ts +1 -0
  128. package/lib/hooks/__test__/useTimerOperateLocal.test.js +216 -0
  129. package/lib/hooks/__test__/useTimerReportDp.test.d.ts +1 -0
  130. package/lib/hooks/__test__/useTimerReportDp.test.js +93 -0
  131. package/lib/hooks/__test__/useTimerSupport.test.d.ts +1 -0
  132. package/lib/hooks/__test__/useTimerSupport.test.js +110 -0
  133. package/lib/hooks/__test__/useWakeUpDp.test.d.ts +1 -0
  134. package/lib/hooks/__test__/useWakeUpDp.test.js +129 -0
  135. package/lib/hooks/useBaseLightDp.d.ts +21 -0
  136. package/lib/hooks/useBaseLightDp.js +165 -0
  137. package/lib/hooks/useCommon.d.ts +29 -0
  138. package/lib/hooks/useCommon.js +59 -0
  139. package/lib/hooks/useCommonSupport.d.ts +25 -0
  140. package/lib/hooks/useCommonSupport.js +241 -0
  141. package/lib/hooks/useCountdownDp.d.ts +13 -0
  142. package/lib/hooks/useCountdownDp.js +28 -0
  143. package/lib/hooks/useCountdownSupport.d.ts +9 -0
  144. package/lib/hooks/useCountdownSupport.js +13 -0
  145. package/lib/hooks/useCycleDp.d.ts +7 -0
  146. package/lib/hooks/useCycleDp.js +21 -0
  147. package/lib/hooks/useCycleSupport.d.ts +12 -0
  148. package/lib/hooks/useCycleSupport.js +16 -0
  149. package/lib/hooks/useRandomDp.d.ts +7 -0
  150. package/lib/hooks/useRandomDp.js +21 -0
  151. package/lib/hooks/useRandomSupport.d.ts +12 -0
  152. package/lib/hooks/useRandomSupport.js +16 -0
  153. package/lib/hooks/useRhythmsDp.d.ts +7 -0
  154. package/lib/hooks/useRhythmsDp.js +23 -0
  155. package/lib/hooks/useSleepDp.d.ts +6 -0
  156. package/lib/hooks/useSleepDp.js +21 -0
  157. package/lib/hooks/useSleepSupport.d.ts +8 -0
  158. package/lib/hooks/useSleepSupport.js +13 -0
  159. package/lib/hooks/useTimeFlush.d.ts +8 -0
  160. package/lib/hooks/useTimeFlush.js +31 -0
  161. package/lib/hooks/useTimerDp.d.ts +5 -0
  162. package/lib/hooks/useTimerDp.js +25 -0
  163. package/lib/hooks/useTimerFlushList.d.ts +11 -0
  164. package/lib/hooks/useTimerFlushList.js +53 -0
  165. package/lib/hooks/useTimerOperate.d.ts +68 -0
  166. package/lib/hooks/useTimerOperate.js +403 -0
  167. package/lib/hooks/useTimerOperateCloud.d.ts +31 -0
  168. package/lib/hooks/useTimerOperateCloud.js +233 -0
  169. package/lib/hooks/useTimerOperateLocal.d.ts +40 -0
  170. package/lib/hooks/useTimerOperateLocal.js +310 -0
  171. package/lib/hooks/useTimerReportDp.d.ts +15 -0
  172. package/lib/hooks/useTimerReportDp.js +48 -0
  173. package/lib/hooks/useTimerSupport.d.ts +13 -0
  174. package/lib/hooks/useTimerSupport.js +38 -0
  175. package/lib/hooks/useWakeUpDp.d.ts +6 -0
  176. package/lib/hooks/useWakeUpDp.js +21 -0
  177. package/lib/hooks/useWakeUpSupport.d.ts +8 -0
  178. package/lib/hooks/useWakeUpSupport.js +13 -0
  179. package/lib/hooks/useWakeupDp.d.ts +6 -0
  180. package/lib/hooks/useWakeupDp.js +21 -0
  181. package/lib/hooks/useWakeupSupport.d.ts +8 -0
  182. package/lib/hooks/useWakeupSupport.js +13 -0
  183. package/lib/i18n/index.d.ts +142 -0
  184. package/lib/i18n/index.js +7 -0
  185. package/lib/i18n/rhythms.d.ts +73 -0
  186. package/lib/i18n/rhythms.js +72 -0
  187. package/lib/i18n/strings.d.ts +73 -0
  188. package/lib/i18n/strings.js +6 -0
  189. package/lib/index.d.ts +51 -0
  190. package/lib/index.js +64 -0
  191. package/lib/types/countdown.d.ts +3 -0
  192. package/lib/types/countdown.js +1 -0
  193. package/lib/types/cycle.d.ts +22 -0
  194. package/lib/types/cycle.js +1 -0
  195. package/lib/types/global.d.ts +9 -0
  196. package/lib/types/index.d.ts +331 -0
  197. package/lib/types/index.js +76 -0
  198. package/lib/types/random.d.ts +20 -0
  199. package/lib/types/random.js +1 -0
  200. package/lib/types/rhythms.d.ts +79 -0
  201. package/lib/types/rhythms.js +15 -0
  202. package/lib/types/sleep.d.ts +36 -0
  203. package/lib/types/sleep.js +1 -0
  204. package/lib/types/timer.d.ts +107 -0
  205. package/lib/types/timer.js +1 -0
  206. package/lib/types/wakeup.d.ts +38 -0
  207. package/lib/types/wakeup.js +1 -0
  208. package/lib/utils/ScheduleCache.d.ts +19 -0
  209. package/lib/utils/ScheduleCache.js +39 -0
  210. package/lib/utils/ScheduleCloudProperty.d.ts +75 -0
  211. package/lib/utils/ScheduleCloudProperty.js +220 -0
  212. package/lib/utils/ScheduleDataSync.d.ts +82 -0
  213. package/lib/utils/ScheduleDataSync.js +127 -0
  214. package/lib/utils/ScheduleEmit.d.ts +67 -0
  215. package/lib/utils/ScheduleEmit.js +61 -0
  216. package/lib/utils/ScheduleLogger.d.ts +19 -0
  217. package/lib/utils/ScheduleLogger.js +71 -0
  218. package/lib/utils/ScheduleSupport.d.ts +131 -0
  219. package/lib/utils/ScheduleSupport.js +373 -0
  220. package/lib/utils/ScheduleUtils.d.ts +12 -0
  221. package/lib/utils/ScheduleUtils.js +51 -0
  222. package/lib/utils/__test__/ScheduleCloudProperty.test.d.ts +1 -0
  223. package/lib/utils/__test__/ScheduleCloudProperty.test.js +320 -0
  224. package/lib/utils/__test__/ScheduleSupport.test.d.ts +1 -0
  225. package/lib/utils/__test__/ScheduleSupport.test.js +211 -0
  226. package/lib/utils/__test__/ScheduleUtils.test.d.ts +1 -0
  227. package/lib/utils/__test__/ScheduleUtils.test.js +119 -0
  228. package/lib/utils/__test__/common.test.d.ts +1 -0
  229. package/lib/utils/__test__/common.test.js +147 -0
  230. package/lib/utils/__test__/storage.test.d.ts +1 -0
  231. package/lib/utils/__test__/storage.test.js +98 -0
  232. package/lib/utils/__test__/time.test.d.ts +1 -0
  233. package/lib/utils/__test__/time.test.js +146 -0
  234. package/lib/utils/common.d.ts +23 -0
  235. package/lib/utils/common.js +109 -0
  236. package/lib/utils/dpState.d.ts +5 -0
  237. package/lib/utils/dpState.js +27 -0
  238. package/lib/utils/getCachedSystemInfo.d.ts +39 -0
  239. package/lib/utils/getCachedSystemInfo.js +20 -0
  240. package/lib/utils/isInIDE.d.ts +1 -0
  241. package/lib/utils/isInIDE.js +5 -0
  242. package/lib/utils/storage.d.ts +5 -0
  243. package/lib/utils/storage.js +32 -0
  244. package/lib/utils/time.d.ts +40 -0
  245. package/lib/utils/time.js +84 -0
  246. package/package.json +78 -0
@@ -0,0 +1,331 @@
1
+ /**
2
+ * 计划模块整体的类型定义
3
+ */
4
+ export declare enum EScheduleFunctionType {
5
+ /** 定时 */
6
+ TIMER = "timer",
7
+ /** 倒计时 */
8
+ COUNTDOWN = "countdown",
9
+ /** 灯光看家 */
10
+ RANDOM = "random",
11
+ /** 生物节律 */
12
+ RHYTHM = "rhythm",
13
+ /** 灯光助眠 */
14
+ SLEEP = "sleep",
15
+ /** 灯光唤醒 */
16
+ WAKEUP = "wakeup",
17
+ /** 循环定时 */
18
+ CYCLE = "cycle"
19
+ }
20
+ export declare enum EScheduleType {
21
+ SWITCH_LED = "SWITCH_LED",
22
+ /** 倒计时 */
23
+ COUNTDOWN = "COUNTDOWN",
24
+ /** 灯光看家 */
25
+ WATCH_HOME = "WATCH_HOME",
26
+ /** 随机定时 */
27
+ RANDOM_TIMING = "RANDOM_TIMING",
28
+ /** 生物节律 */
29
+ RHYTHM_MODE = "RHYTHM_MODE",
30
+ /** 灯光助眠 */
31
+ SLEEP_MODE = "SLEEP_MODE",
32
+ /** 灯光唤醒 */
33
+ WAKE_UP_MODE = "WAKE_UP_MODE",
34
+ /** 循环定时 */
35
+ CYCLE_TIMING = "CYCLE_TIMING",
36
+ /** 通用本地定时 */
37
+ LOCAL_TIMER = "LOCAL_TIMER",
38
+ /** Rtc 定时 */
39
+ RTC_TIMER = "RTC_TIMER",
40
+ /** 定时状态上报 */
41
+ TIMER_REPORT = "TIMER_REPORT",
42
+ /** 灯带本地定时 */
43
+ STRIP_LOCAL_TIMER = "STRIP_LOCAL_TIMER",
44
+ /** 云定时 */
45
+ CLOUD_TIMER = "CLOUD_TIMER",
46
+ /** 定时同步 */
47
+ TIMER_SYNC = "TIMER_SYNC"
48
+ }
49
+ /**
50
+ * 存在冲突的计划能力
51
+ *
52
+ */
53
+ export interface Schedule {
54
+ id: string;
55
+ type: EScheduleFunctionType;
56
+ startTime: number;
57
+ endTime: number;
58
+ repeat?: {
59
+ days: number[];
60
+ interval: number;
61
+ };
62
+ enabled: boolean;
63
+ extra?: Record<string, any>;
64
+ }
65
+ export interface ScheduleConflict {
66
+ schedule: Schedule;
67
+ conflictingSchedules: Schedule[];
68
+ }
69
+ export type ScheduleType = Schedule['type'];
70
+ export type DpValue = string | number | boolean | {
71
+ [key: string]: any;
72
+ };
73
+ export interface GeoLocation {
74
+ latitude: number;
75
+ longitude: number;
76
+ }
77
+ export interface DeviceCapabilities {
78
+ deviceType: EDeviceType;
79
+ scheduleTypeSupport: Record<EScheduleFunctionType, boolean>;
80
+ }
81
+ export interface DevInfo {
82
+ /** 产品信息,schema,功能定义都在里面 */
83
+ schema: any[];
84
+ /**
85
+ * dps
86
+ * 设备的功能点状态,可以根据对应的 dpid 拿到具体的状态值去做业务逻辑
87
+ */
88
+ dps: Record<string, any>;
89
+ /**
90
+ * attribute
91
+ * 产品属性定义,在 backend-ng 平台上可查到对应配置,使用二进制位运算的方式进行管理
92
+ */
93
+ attribute: number;
94
+ /**
95
+ * capability
96
+ * 产品能力值,在 backend-ng 平台上可以查询对应的勾选项,整体业务逻辑会根据该数据进行划分
97
+ * 区分设备类型也可以根据该属性进行调整,按二进制位运算的方式进行管理
98
+ */
99
+ capability: number;
100
+ /**
101
+ * dpName
102
+ * 自定义 dp 的名字,通常在面板里会使用到
103
+ */
104
+ dpName: Record<string, string>;
105
+ /**
106
+ * ability
107
+ * 目前业务很少使用,用于区分特殊类型的设备
108
+ */
109
+ ability: number;
110
+ /**
111
+ * icon
112
+ * 设备的 icon url
113
+ */
114
+ icon: string;
115
+ /**
116
+ * devId
117
+ * 设备的唯一 id
118
+ */
119
+ devId: string;
120
+ /**
121
+ * verSw
122
+ * 设备固件版本号
123
+ */
124
+ verSw: string;
125
+ /**
126
+ * isShare
127
+ * 是否为分享设备,true 则是分享设备
128
+ */
129
+ isShare: boolean;
130
+ /**
131
+ * bv
132
+ * 设备的基线版本号
133
+ */
134
+ bv: string;
135
+ /**
136
+ * uuid
137
+ * 设备的固件唯一标识
138
+ */
139
+ uuid: string;
140
+ /**
141
+ * panelConfig
142
+ * 产品面板里的配置项,通常在 IoT 平台上可以查看到对应的配置
143
+ */
144
+ panelConfig: Record<string, any>;
145
+ /**
146
+ * activeTime
147
+ * 设备激活时间,时间戳
148
+ */
149
+ activeTime: number;
150
+ /**
151
+ * devAttribute
152
+ * 设备的业务能力拓展,二进制位的方式进行运算
153
+ */
154
+ devAttribute: number;
155
+ /**
156
+ * pcc
157
+ * Thing自研蓝牙 mesh 产品的分类标识
158
+ */
159
+ pcc: string;
160
+ /**
161
+ * nodeId
162
+ * 子设备的短地址
163
+ */
164
+ nodeId: string;
165
+ /**
166
+ * parentId
167
+ * 上级节点 id,子设备/或蓝牙 mesh 设备通常会有该字段,用于内部寻找相关的网关或上级模型来进行业务处理
168
+ */
169
+ parentId: string;
170
+ /**
171
+ * category
172
+ * 产品的分类
173
+ */
174
+ category: string;
175
+ /**
176
+ * standSchemaModel
177
+ * 标准产品功能集定义模型
178
+ */
179
+ standSchemaModel: any;
180
+ /**
181
+ * productId
182
+ * 设备对应的产品 id
183
+ */
184
+ productId: string;
185
+ /**
186
+ * bizAttribute
187
+ * 设备自主上报的能力位
188
+ */
189
+ bizAttribute: number;
190
+ /**
191
+ * meshId
192
+ * Thing自研的蓝牙 mesh id
193
+ */
194
+ meshId: string;
195
+ /**
196
+ * sigmeshId
197
+ * 当前设备所属行业属性对应的蓝牙 mesh id
198
+ */
199
+ sigmeshId: string;
200
+ /**
201
+ * meta
202
+ * 设备自定义配置元属性,用于存放业务数据
203
+ */
204
+ meta: Record<string, any>;
205
+ /**
206
+ * isLocalOnline
207
+ * 本地局域网是否在线
208
+ */
209
+ isLocalOnline: boolean;
210
+ /** 设备云端在线情况 */
211
+ isCloudOnline: boolean;
212
+ /**
213
+ * isOnline
214
+ * 设备总的在线情况,只要一个情况在线,就是在线,复合在线情况
215
+ */
216
+ isOnline: boolean;
217
+ /**
218
+ * name
219
+ * 设备名称
220
+ */
221
+ name: string;
222
+ /** groupId */
223
+ groupId: string;
224
+ /**
225
+ * dpCodes
226
+ * 标准功能集 code
227
+ */
228
+ dpCodes: Record<string, any>;
229
+ /** 时区信息 */
230
+ devTimezoneId: string;
231
+ /** 设备的功能点执行的时间 */
232
+ dpsTime: Record<string, any>;
233
+ /** 设备纬度 */
234
+ latitude: string;
235
+ /** 设备经度 */
236
+ longitude: string;
237
+ /** 设备ip地址 */
238
+ ip: string;
239
+ /** 是否为虚拟设备 */
240
+ isVirtualDevice: boolean;
241
+ /** zigbeeInstallCode to the cloud to mark the gateway with installation code ability */
242
+ isZigbeeInstallCode: boolean;
243
+ }
244
+ export interface GroupDevInfo {
245
+ /**
246
+ * groupId
247
+ * The group ID.
248
+ */
249
+ groupId: string;
250
+ /**
251
+ * productId
252
+ * The product ID.
253
+ */
254
+ productId: string;
255
+ /**
256
+ * name
257
+ * The name of the group.
258
+ */
259
+ name: string;
260
+ /**
261
+ * time
262
+ * The time when the group was created.
263
+ */
264
+ time: number;
265
+ /**
266
+ * iconUrl
267
+ * The URL of the icon.
268
+ */
269
+ iconUrl: string;
270
+ /**
271
+ * type
272
+ * The type of group.
273
+ * Wifi = 0, Mesh = 1, Zigbee = 2, SIGMesh = 3, Beacon = 4,
274
+ */
275
+ type: number;
276
+ /** isShare */
277
+ isShare: boolean;
278
+ /** dps */
279
+ dps: {
280
+ [key: string]: any;
281
+ };
282
+ /** dpCodes */
283
+ dpCodes: {
284
+ [key: string]: any;
285
+ };
286
+ /**
287
+ * deviceNum
288
+ * The number of devices,
289
+ */
290
+ deviceNum: number;
291
+ /**
292
+ * localKey
293
+ * The local key.
294
+ */
295
+ localKey: string;
296
+ /** The protocol version. */
297
+ pv: number;
298
+ /** The product information. */
299
+ productInfo: any;
300
+ /** The custom DP name. */
301
+ dpName: any;
302
+ /** The device list. */
303
+ deviceList: DevInfo[];
304
+ /** The local short address of groups. */
305
+ localId: string;
306
+ /** The subclass. */
307
+ pcc: string;
308
+ /** The mesh ID or gateway ID. */
309
+ meshId: string;
310
+ /** Add the beacon beaconKey. */
311
+ groupKey: string;
312
+ /** The schema array. */
313
+ schema: any[];
314
+ }
315
+ /** 设备协议类型 */
316
+ export declare enum EDeviceType {
317
+ 'wifi' = "wifi",
318
+ 'zigbee' = "zigbee",
319
+ 'sigmesh' = "sigmesh",
320
+ 'beacon' = "beacon",
321
+ 'matter' = "matter",
322
+ 'ble' = "ble"
323
+ }
324
+ export * from './timer';
325
+ export * from './rhythms';
326
+ export * from './random';
327
+ export * from './sleep';
328
+ export * from './timer';
329
+ export * from './wakeup';
330
+ export * from './countdown';
331
+ export * from './cycle';
@@ -0,0 +1,76 @@
1
+ /**
2
+ * 计划模块整体的类型定义
3
+ */
4
+ export let EScheduleFunctionType = /*#__PURE__*/function (EScheduleFunctionType) {
5
+ /** 定时 */
6
+ EScheduleFunctionType["TIMER"] = "timer";
7
+ /** 倒计时 */
8
+ EScheduleFunctionType["COUNTDOWN"] = "countdown";
9
+ /** 灯光看家 */
10
+ EScheduleFunctionType["RANDOM"] = "random";
11
+ /** 生物节律 */
12
+ EScheduleFunctionType["RHYTHM"] = "rhythm";
13
+ /** 灯光助眠 */
14
+ EScheduleFunctionType["SLEEP"] = "sleep";
15
+ /** 灯光唤醒 */
16
+ EScheduleFunctionType["WAKEUP"] = "wakeup";
17
+ /** 循环定时 */
18
+ EScheduleFunctionType["CYCLE"] = "cycle";
19
+ return EScheduleFunctionType;
20
+ }({});
21
+
22
+ // 计划模块细化的类型定义,比如将 定时分类细化
23
+ export let EScheduleType = /*#__PURE__*/function (EScheduleType) {
24
+ EScheduleType["SWITCH_LED"] = "SWITCH_LED";
25
+ /** 倒计时 */
26
+ EScheduleType["COUNTDOWN"] = "COUNTDOWN";
27
+ /** 灯光看家 */
28
+ EScheduleType["WATCH_HOME"] = "WATCH_HOME";
29
+ /** 随机定时 */
30
+ EScheduleType["RANDOM_TIMING"] = "RANDOM_TIMING";
31
+ /** 生物节律 */
32
+ EScheduleType["RHYTHM_MODE"] = "RHYTHM_MODE";
33
+ /** 灯光助眠 */
34
+ EScheduleType["SLEEP_MODE"] = "SLEEP_MODE";
35
+ /** 灯光唤醒 */
36
+ EScheduleType["WAKE_UP_MODE"] = "WAKE_UP_MODE";
37
+ /** 循环定时 */
38
+ EScheduleType["CYCLE_TIMING"] = "CYCLE_TIMING";
39
+ /** 通用本地定时 */
40
+ EScheduleType["LOCAL_TIMER"] = "LOCAL_TIMER";
41
+ /** Rtc 定时 */
42
+ EScheduleType["RTC_TIMER"] = "RTC_TIMER";
43
+ /** 定时状态上报 */
44
+ EScheduleType["TIMER_REPORT"] = "TIMER_REPORT";
45
+ /** 灯带本地定时 */
46
+ EScheduleType["STRIP_LOCAL_TIMER"] = "STRIP_LOCAL_TIMER";
47
+ /** 云定时 */
48
+ EScheduleType["CLOUD_TIMER"] = "CLOUD_TIMER";
49
+ /** 定时同步 */
50
+ EScheduleType["TIMER_SYNC"] = "TIMER_SYNC";
51
+ return EScheduleType;
52
+ }({});
53
+
54
+ /**
55
+ * 存在冲突的计划能力
56
+ *
57
+ */
58
+
59
+ /** 设备协议类型 */
60
+ export let EDeviceType = /*#__PURE__*/function (EDeviceType) {
61
+ EDeviceType["wifi"] = "wifi";
62
+ EDeviceType["zigbee"] = "zigbee";
63
+ EDeviceType["sigmesh"] = "sigmesh";
64
+ EDeviceType["beacon"] = "beacon";
65
+ EDeviceType["matter"] = "matter";
66
+ EDeviceType["ble"] = "ble";
67
+ return EDeviceType;
68
+ }({});
69
+ export * from './timer';
70
+ export * from './rhythms';
71
+ export * from './random';
72
+ export * from './sleep';
73
+ export * from './timer';
74
+ export * from './wakeup';
75
+ export * from './countdown';
76
+ export * from './cycle';
@@ -0,0 +1,20 @@
1
+ export type TRandomData = {
2
+ version: number;
3
+ length: number;
4
+ nodes: TRandomNode[];
5
+ };
6
+ export type TRandomNode = {
7
+ onOff: boolean;
8
+ channel: number;
9
+ loops: string;
10
+ startTime: number;
11
+ endTime: number;
12
+ index: number;
13
+ color: {
14
+ hue: number;
15
+ saturation: number;
16
+ value: number;
17
+ brightness: number;
18
+ temperature: number;
19
+ };
20
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,79 @@
1
+ import { Dispatch } from 'react';
2
+ export declare enum ERhythm {
3
+ UPDATE_RHYTHMS_MESSAGE = "UPDATE_RHYTHMS_MESSAGE",
4
+ UPDATE_RHYTHMS = "UPDATE_RHYTHMS",
5
+ UPDATE_LOCAL_MESSAGE = "UPDATE_LOCAL_MESSAGE",
6
+ UPDATE_UI = "UPDATE_UI",
7
+ INIT_SYSTEM_INFO = "INIT_SYSTEM_INFO",
8
+ UPDATE_DP = "UPDATE_DP"
9
+ }
10
+ export type TRhythmItem = {
11
+ power: boolean;
12
+ hour: number;
13
+ minute: number;
14
+ hue: number;
15
+ saturation: number;
16
+ value: number;
17
+ brightness: number;
18
+ temperature: number;
19
+ icon?: string;
20
+ name?: string;
21
+ };
22
+ export interface TRhythmData {
23
+ key?: number;
24
+ version: number;
25
+ power: boolean;
26
+ mode: number;
27
+ weeks: number[];
28
+ number: number;
29
+ rhythms: TRhythmItem[];
30
+ }
31
+ export interface LocalMessage {
32
+ name: string;
33
+ latitude: number;
34
+ longitude: number;
35
+ }
36
+ export interface RhythmMessage {
37
+ power: boolean;
38
+ mode: number;
39
+ isEnable: boolean;
40
+ }
41
+ interface IProps {
42
+ devId: string;
43
+ autoShowTip: boolean;
44
+ needPutControlData: boolean;
45
+ onSave: (data: Record<string, any>[]) => void;
46
+ onCancel: (data: Record<string, any>[]) => void;
47
+ }
48
+ interface IReturn {
49
+ type: ERhythm;
50
+ payload: any;
51
+ }
52
+ export interface IContext {
53
+ state: IState;
54
+ dispatch: Dispatch<{
55
+ type: string;
56
+ payload?: Partial<IState>;
57
+ }>;
58
+ props: IProps;
59
+ actions?: {
60
+ updateRhythmsMessage: (data: RhythmMessage) => IReturn;
61
+ updateRhythms: (data: TRhythmData[]) => IReturn;
62
+ updateLocalMessage: (data: LocalMessage) => IReturn;
63
+ updateUI: (data: any[]) => IReturn;
64
+ initSystemInfo: (data: any) => IReturn;
65
+ updateDp: (data: any) => IReturn;
66
+ };
67
+ }
68
+ export interface IState {
69
+ localMessage: LocalMessage;
70
+ rhythms: TRhythmData[] | [];
71
+ rhythmsMessage: RhythmMessage;
72
+ systemInfo: any;
73
+ dpState: Record<string, any>;
74
+ }
75
+ export declare enum ERhythmsType {
76
+ 'Normal' = 1,
77
+ 'NoNature' = 2
78
+ }
79
+ export {};
@@ -0,0 +1,15 @@
1
+ export let ERhythm = /*#__PURE__*/function (ERhythm) {
2
+ ERhythm["UPDATE_RHYTHMS_MESSAGE"] = "UPDATE_RHYTHMS_MESSAGE";
3
+ ERhythm["UPDATE_RHYTHMS"] = "UPDATE_RHYTHMS";
4
+ ERhythm["UPDATE_LOCAL_MESSAGE"] = "UPDATE_LOCAL_MESSAGE";
5
+ ERhythm["UPDATE_UI"] = "UPDATE_UI";
6
+ ERhythm["INIT_SYSTEM_INFO"] = "INIT_SYSTEM_INFO";
7
+ ERhythm["UPDATE_DP"] = "UPDATE_DP";
8
+ return ERhythm;
9
+ }({});
10
+ export let ERhythmsType = /*#__PURE__*/function (ERhythmsType) {
11
+ ERhythmsType[ERhythmsType["Normal"] = 1] = "Normal";
12
+ // 常规的生物节律
13
+ ERhythmsType[ERhythmsType["NoNature"] = 2] = "NoNature"; // 生物节律: 1. 没有自然模式的 2. 选择模式卡片在上方 3. 保存按钮在下方 4. 有同步逻辑
14
+ return ERhythmsType;
15
+ }({});
@@ -0,0 +1,36 @@
1
+ export interface TSleepNodeSigmesh {
2
+ onOff: boolean;
3
+ loops: string;
4
+ step: number;
5
+ hour: number;
6
+ minute: number;
7
+ brightness: number;
8
+ temperature: number;
9
+ index: number;
10
+ time?: string;
11
+ }
12
+ export interface TSleepDataSigmesh {
13
+ version: number;
14
+ dataMode: '01' | '02' | '03';
15
+ length: number;
16
+ nodes: TSleepNodeSigmesh[];
17
+ }
18
+ export interface TSleepNode {
19
+ onOff: boolean;
20
+ loops: string;
21
+ step: number;
22
+ hour: number;
23
+ minute: number;
24
+ hue: number;
25
+ saturation: number;
26
+ value: number;
27
+ brightness: number;
28
+ temperature: number;
29
+ index: number;
30
+ time?: string;
31
+ }
32
+ export interface TSleepData {
33
+ version: number;
34
+ length: 0 | 1 | 2 | 3 | 4;
35
+ nodes: TSleepNode[];
36
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,107 @@
1
+ export type TTimerDataAdd = {
2
+ /**
3
+ * timerId
4
+ * 定时器ID
5
+ * 本地定时需要手动生成,云定时接口会自动生成
6
+ */
7
+ timerId?: string;
8
+ /**
9
+ * time
10
+ * 定时器运行的时间
11
+ */
12
+ time: string;
13
+ /**
14
+ * loops
15
+ * 七位数字字符串,"1000000" 代表周日,"0100000" 代表周一
16
+ */
17
+ loops: string;
18
+ /**
19
+ * dps
20
+ * dp 点数据,示例:
21
+ * {
22
+ * "1": true,
23
+ * "2": false
24
+ * }
25
+ */
26
+ dps: Record<string, any>;
27
+ /**
28
+ * aliasName
29
+ * 别名
30
+ */
31
+ aliasName: string;
32
+ /**
33
+ * isAppPush
34
+ * 是否发送执行通知
35
+ */
36
+ isAppPush: boolean;
37
+ };
38
+ export type TTimerDataUpdate = TTimerDataAdd & {
39
+ timerId: string;
40
+ status?: boolean;
41
+ };
42
+ /** 云定时类型 类型 Start */
43
+ export type TCloudTimerParamsAdd = {
44
+ deviceId?: string;
45
+ groupId?: string;
46
+ category: string;
47
+ timer: TTimerDataAdd;
48
+ };
49
+ export type TCloudTimerParamsUpdate = Omit<TCloudTimerParamsAdd, 'category'> & Omit<TCloudTimerParamsAdd, 'timer'> & {
50
+ timer: TTimerDataUpdate;
51
+ };
52
+ export type TCloudTimerParamsRemove = {
53
+ timerId: string;
54
+ groupId?: string;
55
+ deviceId?: string;
56
+ };
57
+ /** 云定时类型 End */
58
+ /** 本地定时类型 Start */
59
+ export type TLocalTimerParamsAdd = {
60
+ deviceId?: string;
61
+ groupId?: string;
62
+ category?: string;
63
+ timer: TTimerDataAdd;
64
+ };
65
+ export type TLocalTimerParamsUpdate = Omit<Omit<TLocalTimerParamsAdd, 'timer'>, 'category'> & {
66
+ timer: TTimerDataUpdate;
67
+ };
68
+ export type TLocalTimerParamsRemove = {
69
+ timerId: string;
70
+ groupId?: string;
71
+ deviceId?: string;
72
+ };
73
+ export type TLocalTimerParamsList = {
74
+ deviceId?: string;
75
+ groupId?: string;
76
+ category: string;
77
+ };
78
+ export type TLocalTimerParamsUpdateStatus = {
79
+ timerId: string;
80
+ status: boolean;
81
+ groupId?: string;
82
+ deviceId?: string;
83
+ };
84
+ /** 本地定时类型 End */
85
+ export type TTimerData = TTimerDataUpdate;
86
+ export type TRtcTimerDp = {
87
+ switch_led?: boolean;
88
+ colour_data?: {
89
+ hue?: number;
90
+ saturation?: number;
91
+ value?: number;
92
+ };
93
+ bright_value?: number;
94
+ temp_value?: number;
95
+ };
96
+ export type TRtcTimer = {
97
+ timerId?: string;
98
+ status?: boolean;
99
+ loops?: string;
100
+ time?: string;
101
+ deviceAction?: number;
102
+ dps?: TRtcTimerDp;
103
+ };
104
+ export type TTimerReport = {
105
+ id: string | number;
106
+ status: boolean;
107
+ };
@@ -0,0 +1 @@
1
+ export {};