ffc1efe36a0e8a9ed113a86a80cf7a4d660c8fcd
[mirrors/FD230.git] /
1 /*
2  * Copyright (c) CompanyNameMagicTag. 2025-2025. All rights reserved.
3  * Description: watchface JS intarface
4  * Author: Software Group
5  * Create: 2025-09-5
6  */
7  
8 #ifndef WATCHFACE_MODULE_H
9 #define WATCHFACE_MODULE_H
10  
11 #include <stdint.h>
12 #include <map>
13 #include "jsi.h"
14 #include "main/include/dial/WatchInterface.h"
15  
16 namespace OHOS {
17 namespace ACELite {
18
19 typedef enum {
20     WATCHFACE_SUCCESS          =  0,
21     WATCHFACE_PARAM_ERROR      =  401,
22     WATCHFACE_INSTALL_ERROR    =  2400001,
23     WATCHFACE_GETINFO_ERROR    =  2400002,
24     WATCHFACE_GETMSG_ERROR     =  2400003,
25 } WATCHFACE_ERRCODE;
26
27 typedef watch_dial_info WatchDialInfo;
28
29 struct DownloadStatus {
30     uint32_t receivedSize;
31     uint32_t totalSize;
32     uint32_t uuid;
33 };
34
35 struct WatchfaceParams{
36     JSIValue thisVal;
37     JSIValue callback;
38     double process;
39     uint8_t installState;
40 };
41
42 class WatchfaceModule final : public MemoryHeap {
43 public:
44     WatchfaceModule() = default;
45     ~WatchfaceModule() = default;
46     static JSIValue SetWatchFace(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize);
47     static JSIValue GetWatchFaceInfo(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize);
48     static JSIValue SetDownloadListener(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize);
49     static JSIValue Destroy(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize);
50     static void FailCallback(void *data);
51     static void SuccessCallback(void *data);
52     static bool isTerminate_;
53 private:
54     static bool GetDialInfo(uint32_t uuid, WatchDialInfo& watch, JSIValue& dialInfo);
55     static bool isListenerRunning_;
56 };
57 void InitWatchFaceModule(JSIValue exports);
58  
59 }  // namespace ACELite
60 }  // namespace OHOS
61  
62 #endif  // WATCHFACE_MODULE_H