Skip to content

Commit 230ae0e

Browse files
committed
Update library files for SDK
* Fix some header files * Add missing header file Signed-off-by: Ajay Bhargav <[email protected]>
1 parent bf774f3 commit 230ae0e

17 files changed

+240
-43
lines changed

include/command.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ enum command_src_e {
3535
CMD_SRC_DBG, /**< Command source Remote debug console */
3636
CMD_SRC_SMS, /**< Command source SMS */
3737
CMD_SRC_TCP, /**< Command source TCP */
38+
CMD_SRC_SYS, /**< Command source system() API */
3839
};
3940

4041
/**
@@ -43,15 +44,16 @@ enum command_src_e {
4344
*/
4445
enum command_type_e {
4546
CMD_TYPE_DEFAULT = 0, /**< Default command, executing allowed everywhere and can be executed by user and admin. */
46-
CMD_TYPE_HIDDEN = 1, /**< Hidden command, Only executed by admin user */
47+
CMD_TYPE_HIDDEN = 1, /**< Hidden command, Only executed by admin user; Unless allowed by allow flags */
4748
CMD_ALLOW_SMS = 2, /**< Command allowed over SMS */
4849
CMD_ALLOW_TCP = 4, /**< Command allowed over TCP */
4950
CMD_ALLOW_DBG = 8, /**< Command allowed over remote debug */
5051
CMD_ALLOW_CONSOLE = 0x10, /**< Command allowed over console */
5152
CMD_ALLOW_BT_CONSOLE = 0x20, /**< Command allowed over Bluetooth console */
52-
CMD_ALLOW_SYS = 0x40, /**< Command allowed to execute via system API */
53+
CMD_ALLOW_SYS = 0x40, /**< Command allowed to execute via system() API */
5354

5455
/* Combination Flags */
56+
CMD_ALLOW_ALL = 0x7F, /**< Command allowed from all sources */
5557
CMD_ALLOW_TCP_SMS = 0x6, /**< Command allowed over TCP and SMS */
5658
CMD_ALLOW_CONSOLE_ONLY = 0x38,/**< Command allowed over Console only */
5759
CMD_ALLOW_TCP_SMS_DBG = 0xE, /**< Command allowed over TCP, SMS and remote console */

include/fota.h

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,30 @@
1-
/*
2-
* lib.h
3-
*
4-
*/
5-
6-
#ifndef INCLUDE_LIB_H_
7-
#define INCLUDE_LIB_H_
8-
9-
#ifdef __cplusplus
10-
extern "C" {
11-
#endif
12-
13-
/**
14-
* Start Firmware Update
15-
* @param [in] HTTP URL to download firmware
16-
* @return 0 on success, negative value on error
17-
*/
18-
int fota_start(const char *in_url);
19-
20-
/**
21-
* Get OTA status
22-
* @return Return 1 if FOTA in progress, 0 otherwise
23-
*/
24-
int ota_in_progress(void);
25-
26-
#ifdef __cplusplus
27-
}
28-
#endif
1+
/*
2+
* fota.h
3+
*
4+
*/
5+
6+
#ifndef INCLUDE_FOTA_H_
7+
#define INCLUDE_FOTA_H_
8+
9+
#ifdef __cplusplus
10+
extern "C" {
11+
#endif
12+
13+
/**
14+
* Start Firmware Update
15+
* @param [in] HTTP URL to download firmware
16+
* @return 0 on success, negative value on error
17+
*/
18+
int fota_start(const char *in_url);
19+
20+
/**
21+
* Get OTA status
22+
* @return Return 1 if FOTA in progress, 0 otherwise
23+
*/
24+
int fota_in_progress(void);
25+
26+
#ifdef __cplusplus
27+
}
28+
#endif
29+
#endif /* INCLUDE_FOTA_H_ */
30+

include/hw/bluetooth.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
#define INC_HW_BLUETOOTH_H_
88

99
#ifndef PLATFORM_BC20
10+
/**
11+
* @note Bluetooth is only available on GSM platforms.
12+
*/
13+
1014
/**
1115
* Maximum length for BT device name
1216
*/

include/hw/gpio.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ enum gpioname_e {
8282
GPIO_24,
8383
GPIO_25,
8484
GPIO_26,
85+
GPIO_27,
86+
GPIO_28,
87+
GPIO_29,
8588
#endif
8689
#if defined (PLATFORM_MC60) || defined(PLATFORM_S20U) || defined(PLATFORM_M56)
8790
GPIO_24,

include/lib.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ const char *get_siwilib_version(void);
6565
* Set system time-zone in +/-HH:MM format (e.g. +5:30)
6666
* @param tz [in] Timezone value
6767
*/
68-
void system_settz(char *tz);
68+
void system_settz(const char *tz);
6969

7070
/**
7171
* Get current time-zone

include/libtime.h

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
/*
2+
* libtime.h
3+
*
4+
*/
5+
6+
#ifndef INC_LIBTIME_H_
7+
#define INC_LIBTIME_H_
8+
9+
#define CLKSYNC_SECONDS(x) x
10+
#define CLKSYNC_MINUTE(x) (x * 60)
11+
12+
/**
13+
* Clock status
14+
*/
15+
enum clkstatus_e {
16+
CLK_STATUS_NOTSYNCED,/**< System clock not synced */
17+
CLK_STATUS_SYNCED /**< System clock synced */
18+
};
19+
20+
/**
21+
* Clock Source priority, for multiple clock sources,
22+
* highest priority source is selected for sync
23+
*
24+
* Following are the library provided clock sources and their
25+
* priorities:
26+
* # Network Provider Clock : Low Priority
27+
* # NTP : Medium Priority
28+
* # GPS : High Priority
29+
*/
30+
enum clkprio_e {
31+
CLK_SRC_PRIO_VLOW, /**< Priority very low */
32+
CLK_SRC_PRIO_LOW, /**< Priority low */
33+
CLK_SRC_PRIO_MED, /**< Priority medium */
34+
CLK_SRC_PRIO_HIGH, /**< Priority high */
35+
CLK_SRC_PRIO_VHIGH, /**< Priority Very High */
36+
};
37+
38+
/**
39+
* Clock synchronization mode select
40+
*/
41+
enum clkmode_e {
42+
CLOCK_MODE_AUTO, /**< Auto Sync */
43+
CLOCK_MODE_MANUAL,/**< Manual Sync */
44+
};
45+
46+
/**
47+
* Clock Source Structure
48+
*/
49+
struct clocksrc_t {
50+
const char *name; /**< Clock Source name */
51+
int prio; /**< Clock source priority @a clockprio_e */
52+
int sync_duration; /**< Clock sync duration in seconds */
53+
int (*sync_cb)(void); /**< Clock source sync callback function */
54+
};
55+
56+
/**
57+
* Time structure for sync
58+
*/
59+
struct clocktm_t {
60+
int year; /**< Year from 0 */
61+
int month; /**< Month 1 to 12 */
62+
int day; /**< Day 1 to 31 */
63+
int hour; /**< Hour 0 to 23 */
64+
int minute; /**< Minute 0 to 59 */
65+
int second; /**< Second 0 to 59 */
66+
int reserved; /**< reserved must be 0 */
67+
};
68+
69+
/* Clock source API */
70+
/**
71+
* Register clock sync source, clock is considered invalid by default
72+
*
73+
* @param src [in] Clock source structure pointer @a clocksrc_t
74+
* @return 0 on success, negative value on error
75+
*/
76+
int clock_src_register(const struct clocksrc_t *src);
77+
78+
/**
79+
* Set clock source as valid, after clock source is marked valid
80+
* system will call @a clocksrc_t::sync_cb after 30s.
81+
* @param name [in] Clock source name
82+
* @param status [in] 1 for valid, 0 for invalid
83+
* @return 0 on success, negative on error
84+
*/
85+
int clock_src_setvalid(const char *name, int status);
86+
87+
/**
88+
* Get clock source valid status
89+
* @param name [in] Clock source name
90+
* @return returns 1 if valid, 0 if not valid
91+
*/
92+
int clock_src_getvalid(const char *name);
93+
94+
/**
95+
* Get currently used clock source name for system
96+
* clock synchronization
97+
* @return returns clock source name
98+
*/
99+
const char *clock_getsourcename(void);
100+
101+
/**
102+
* Get system clock sync status
103+
* @return returns @a clkstatus_e
104+
*/
105+
int clock_get_syncstatus(void);
106+
107+
/**
108+
* Set ntp server address, default is "siwi.in"
109+
* @param server [in] NTP server domain or IP
110+
* @return return 0 on success, negative on error
111+
*/
112+
int clock_set_ntpserver(const char *server);
113+
114+
/**
115+
* Get currently configured NTP server address
116+
* @return returns NTP server address
117+
*/
118+
const char *clock_get_ntpserver(void);
119+
120+
/**
121+
* Set clock synchronization mode
122+
* @param mode [in] Clock mode @a clkmode_e
123+
* @return 0 on success, negative on failure
124+
*/
125+
int clock_set_mode(int mode);
126+
127+
/**
128+
* Get current clock synchronization mode
129+
* @return returns @a clockmode_e
130+
*/
131+
int clock_get_mode(void);
132+
133+
/**
134+
* Update system clock, this function can be called from
135+
* clock source sync callback to update system time.
136+
* @param timeval [in] Time structure with current time information
137+
* @return return 0 on success, negative on failure
138+
*/
139+
int clock_sync(struct clocktm_t *timeval);
140+
141+
#endif /* INC_LIBTIME_H_ */

include/network.h

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,19 @@ int network_setdns(const char *pri, const char *sec);
100100
*/
101101
int network_resetdns(void);
102102

103+
/**
104+
* Get network status.
105+
* If socket descriptor is provided, extended network status will be provided with socket status
106+
* @param sockfd [in] Socket descriptor (optional, 0 if not used)
107+
* @return network status see @ref _net_state
108+
*/
109+
int network_getstatus(int sockfd);
110+
103111
#if defined(PLATFORM_BC20) || defined(_DOXYGEN_)
104112
/**
105113
* Get status of network, if its ready or not for data transaction
114+
* @note This API applies to NBIoT Platforms only.
115+
*
106116
* @return returns 1 if network ready, 0 otherwise
107117
*/
108118
int network_isready(void);
@@ -111,15 +121,9 @@ int network_isready(void);
111121
* Reset and restart network
112122
*/
113123
void network_reset(void);
114-
#else
115-
/**
116-
* Get network status.
117-
* If socket descriptor is provided, extended network status will be provided with socket status
118-
* @param sockfd [in] Socket descriptor (optional, 0 if not used)
119-
* @return network status see @ref _net_state
120-
*/
121-
int network_getstatus(int sockfd);
124+
#endif
122125

126+
#if !defined(PLATFORM_BC20) || defined(_DOXYGEN_)
123127
/**
124128
* Enable/Disable GPRS. GPRS is enabled by default
125129
* @param enable [in] 1 to enable, 0 to disable

include/opdatabase.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
22
* opdatabase.h
33
*
4+
* @note These APIs are only available on GSM Platforms
45
*/
56

67
#ifndef INCLUDE_OPDATABASE_H_

include/os_api.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,14 @@ int sys_get_coreversion(char *verbuf, int len);
7373
/**
7474
* Set sleep timeout. System will wake up as soon as timeout finishes
7575
* or an any event occurs.
76+
* @note only available on NBIoT Platforms
7677
* @param ms [in] Sleep timeout in miliseconds
7778
*/
7879
void sys_setsleep_timeout(uint32_t ms);
7980

8081
/**
8182
* Enter sleep mode
83+
* @note only available on NBIoT Platforms
8284
* @param type [in] Type of sleep @a sleeptype_e
8385
*/
8486
void sys_setsleep(int type);
@@ -212,6 +214,7 @@ int os_create_task(os_taskfn_f fn, void *arg, int suspend);
212214
#if defined(PLATFORM_BC20) || defined(_DOXYGEN_)
213215
/**
214216
* Create a new OS task, with extended parameters
217+
* @note only available on NBIoT Platforms
215218
* @param fn [in] Task function of type os_taskfn_f
216219
* @param stack [in] Task stack size in bytes
217220
* @param arg [in] Argument to task function
@@ -221,7 +224,8 @@ int os_create_task(os_taskfn_f fn, void *arg, int suspend);
221224
int os_create_taskex(os_taskfn_f fn, uint32_t stack, void *arg, int suspend);
222225

223226
/**
224-
* Start a task created by os_task_delete()
227+
* Start a task created by os_create_task()/os_create_taskex()
228+
* @note only available on NBIoT Platforms
225229
* @param taskid [in] Task ID
226230
* @return 0 on success, negative value on error
227231
*/

include/proto/ftpc.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
/*
22
* ftpc.h
33
*
4-
* Created on: Mar 11, 2017
5-
* Author: ajay_
4+
* @note FTP Client APIs are only available on GSM platform only
65
*/
76

87
#ifndef INC_FTPC_H_

0 commit comments

Comments
 (0)