1 #ifdef __INTERCONNECTION__
2 #ifndef __APP_INTERCONNECTION_CUSTOMER_REALIZE_H__
3 #define __APP_INTERCONNECTION_CUSTOMER_REALIZE_H__
4 
5 #ifdef __cplusplus
6 extern "C" {
7 #endif
8 
9 #include "app_interconnection.h"
10 // #define H2_FOR_TEST                 1
11 
12 #define BT_VERSION                  "NA"
13 #define DEVICE_HARDWARE_VERSION     "\x00\x00\x00\x00\x00\x00\x00\x00"
14 #define PHONE_NUMBER                "NA"
15 #define DEVICE_BT_MAC               "NA"
16 #define DEVICE_IMEI                 "NA"
17 #define SOFTWARE_VERSION            "1.0.1.223"
18 #define DEVICE_OPEN_SOURCE_VERSION  "NA"
19 #define DEVICE_SN                   "\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01"
20 #ifdef H2_FOR_TEST
21 #define DEVICE_MODEL_ID             "BTFCMH2S-000016"
22 #define DEVICE_NAME                 "CM-H2S"
23 #else
24 #define DEVICE_MODEL_ID             "BTFCM70-00001B"
25 #define DEVICE_NAME                 "CM-70"
26 #endif
27 #define DEVICE_EMMC                 "NA"
28 
29 #define CCMP_SUMMARY_VALUE          "\xe5\xef\xcb\x85\xeb\x43\x77\xa5\x18\x09\x0e\x9d\xcd\x77\xb9\xbf\xb4\x3e\xa0\xeb\xf4\xb8\x6a\x81\x1f\xd9\x46\x2a\x34\x92\x68\x12"
30 #define BUSINESS_TAG                "iconnect"
31 #define FIXED_IMAGE_INFO_HEADER     0x5A5A
32 #define OTA_COMPONENT_ID_HEAD_SET   1
33 #define FORCE_UPGRADE               1
34 
35 #define OTA_FLASH_SIZE              0x180000 // 1.5M flash
36 
37 
38 typedef struct
39 {
40     uint8_t serviceID;
41     uint8_t support;
42 } __attribute__((__packed__)) SUPPORT_SERVICE_T;
43 
44 #ifdef H2_FOR_TEST
45 // used for h2
46 typedef struct
47 {
48     uint16_t h_header;
49     uint16_t h_head_lens;
50     uint8_t  h_upgrade_mode;
51     uint8_t	 h_image_version[19];
52     uint8_t  h_headset_firmware_flag;
53     uint32_t h_headset_addr_offset;
54     uint32_t h_headset_data_lens;
55     uint8_t  h_headset_version[19];
56     uint8_t  h_headset_figure_signature[256];
57     uint32_t h_headset_crc;
58     uint8_t  h_hinttone_firmware_flag;
59     uint32_t h_hinttone_addr_offset;
60     uint32_t h_hinttone_data_lens;
61     uint8_t  h_hinttone_version[19];
62     uint8_t  h_hinttone_figure_signature[256];
63     uint32_t h_hinttone_crc;
64     uint8_t  h_charger_firmware_flag;
65     uint32_t h_charger_addr_offset;
66     uint32_t h_charger_data_lens;
67     uint8_t  h_charger_version[19];
68     uint8_t  h_charger_figure_signature[256];
69     uint32_t h_charger_crc;
70     uint32_t h_data_crc;
71 } __attribute__ ((__packed__)) REC_HEAD_PACKET_T;
72 #else
73 // used for amazon
74 typedef struct
75 {
76     uint16_t    h_header;
77     uint16_t    h_head_lens;
78     uint8_t     h_upgrade_mode;
79     uint8_t     h_image_version[19];
80     uint8_t     h_headset_firmware_flag;
81     uint32_t    h_headset_addr_offset;
82     uint32_t    h_headset_data_lens;
83     uint8_t     h_headset_version[19];
84     uint8_t     h_headset_figure_signature[256];
85     uint32_t    h_headset_crc;
86     uint32_t    h_data_crc;
87 } __attribute__ ((__packed__)) REC_HEAD_PACKET_T;
88 #endif
89 
90 #define IMAGE_INFO_SIZE                 sizeof(REC_HEAD_PACKET_T)
91 
92 uint32_t crc32_image(uint32_t crc_val, uint8_t *input, uint32_t len);
93 
94 uint8_t *get_link_param_protocol_version(void);
95 
96 bool is_service_support(uint8_t serviceID);
97 
98 char *get_bt_version_ptr(void);
99 
100 uint8_t *get_device_type_ptr(void);
101 
102 char *get_hardware_version_ptr(void);
103 
104 char *get_phone_number_ptr(void);
105 
106 char *get_device_bt_mac_ptr(void);
107 
108 char *get_device_imei_ptr(void);
109 
110 char *get_software_version_ptr(void);
111 
112 char *get_open_source_version_ptr(void);
113 
114 char *get_sn_ptr(void);
115 
116 char *get_model_id_ptr(void);
117 
118 char *get_device_emmc_ptr(void);
119 
120 char *get_device_name_ptr(void);
121 
122 char *get_summary_value_ptr(void);
123 
124 char *get_business_tag_ptr(void);
125 
126 uint32_t get_update_permission_error_code(void);
127 
128 uint8_t customer_realize_image_info_receive_finished_hook();
129 
130 #ifdef __cplusplus
131 }
132 #endif
133 #endif
134 #endif