Commit 3f393e23d5c4b6fbac2346d57811c118ebff35e1

Authored by Imanol-Mikel Barba Sabariego
1 parent 3576493b

--no commit message

Project/applications/smartcities/configServer.c
... ... @@ -348,13 +348,6 @@ int configServer_hex2bin(char *hex, char *buf, size_t hexLen)
348 348 {
349 349 size_t i, j = 0;
350 350 uint8_t byte;
351   - /*if( (hexLen%2) != 0){
352   - return -1;
353   - }*
354   -
355   - for (i = 0; i < hexLen; i += 2) {
356   - *opos++ = (ipos[i] << 4) | (ipos[i + 1]);
357   - }*/
358 351  
359 352 for(i = 0; i < strlen(hex); i += 2)
360 353 {
... ...
Project/applications/smartcities/include/adc.h
... ... @@ -77,23 +77,23 @@
77 77 #define ADCsound_GPIO_STR "PA2"
78 78  
79 79 //! Battery ADC initialization function
80   -/*! This function initializes the base HW to start battery ADC conversion */
  80 +/*! This function initializes the base HW to start battery ADC conversion. */
81 81 void adc_batt_init(void);
82 82 //! Battery ADC processing function
83   -/*! This function calls adc_batt_read and converts the raw digital value to the analog scale defined for the battery ADC */
  83 +/*! This function calls adc_batt_read and converts the raw digital value to the analog scale defined for the battery ADC. Returns the analog value. */
84 84 uint32_t adc_batt_process(void);
85 85 //! Battery ADC raw read function
86   -/*! This function starts an ADC conversion and returns the raw 12 bit digital value */
  86 +/*! This function starts an ADC conversion and returns the raw 12 bit digital value. */
87 87 uint16_t adc_batt_read(void);
88 88  
89 89 //! Battery ADC initialization function
90   -/*! This function initializes the base HW to start sound ADC conversion */
  90 +/*! This function initializes the base HW to start sound ADC conversion. */
91 91 void adc_sound_init(void);
92 92 //! Battery ADC processing function
93   -/*! This function calls adc_batt_read and converts the raw digital value to the analog scale defined for the sound ADC */
  93 +/*! This function calls adc_batt_read and converts the raw digital value to the analog scale defined for the sound ADC. Returns the analog value. */
94 94 uint32_t adc_sound_process(void);
95 95 //! Battery ADC raw read function
96   -/*! This function starts an ADC conversion and returns the raw 12 bit digital value */
  96 +/*! This function starts an ADC conversion and returns the raw 12 bit digital value. */
97 97 uint16_t adc_sound_read(void);
98 98  
99 99 #endif
100 100 \ No newline at end of file
... ...
Project/applications/smartcities/include/buffer.h
... ... @@ -37,15 +37,15 @@
37 37 char** put_message(char* info /*! Data to be stored */, char** buf /*! Old buffer */ ,uint32_t *index /*! Buffer index to store the data */, uint32_t *buf_len /*! Old buffer length */);
38 38  
39 39 //! Memory check function
40   -/*! This function checks the current used memory and returns the memory status definitions according to the amount of memory used. */
  40 +/*! This function checks the current used memory and returns the memory status definitions according to the amount of memory used. Returns one of the Memory Status codes. */
41 41 int check_memory(void);
42 42  
43 43 //! Buffer data send function
44   -/*! This function sends the data in a specified buffer to the server. If successful, it frees the memory used by it. */
  44 +/*! This function sends the data in a specified buffer to the server. If successful, it frees the memory used by it. Returns one of the JSON status codes (see json.h). */
45 45 int send(char** buf /*! Buffer to send */, uint32_t *index /*! Current buffer index */, uint32_t *size_buf /*! Buffer size */, char *provider_ID /*! Current module ID */, char *sensor_ID /*! Sensor ID for the data stored in that buffer */);
46 46  
47 47 //! Buffer join function
48   -/*! This function returns a copy of the buffer passed by argument with one more slot to store another piece of data from the sensors */
  48 +/*! This function returns a copy of the buffer passed by argument with one more slot to store another measurement from the sensors */
49 49 char** join_buf(char** buf /*! Old buffer */, uint32_t *buf_len /*! Old buffer length*/);
50 50  
51 51 #endif
52 52 \ No newline at end of file
... ...
Project/applications/smartcities/include/callbacks.h
... ... @@ -4,7 +4,7 @@
4 4 * @author Imanol Barba Sabariego, Maria Jorba Brosa
5 5 * @date 08/06/2014
6 6 *
7   - * The functions declared in this file are used as callbacks by the network functions in the libwismart library.
  7 + * The functions declared in this file are used as callbacks by the network functions in the libwismart library.
8 8 */
9 9  
10 10 #ifndef CALLBACKS_H
... ... @@ -14,22 +14,42 @@
14 14 #include "lwip/inet.h"
15 15 #include "configServer.h"
16 16  
  17 +//! Wi-Fi client mode definition
17 18 #define WIFI_MODE_CLIENT 1
  19 +//! Wi-Fi Host AP mode definition
18 20 #define WIFI_MODE_SOFTAP 2
19   -#define MAX_RETRIES 5
  21 +//! Maximum connection retries
  22 +/*! This defines how many Association or DHCP requests retries will take place before considering that network connectivity is not available at the moment. */
  23 +#define MAX_RETRIES 5
20 24  
  25 +//! Connection state definition (Connected in the past)
  26 +/*! This definition tells that the device had connectivity at some point in the past with the current Wi-Fi configuration. It doesn't define if it has or has not Wi-Fi connectivity at the moment. */
21 27 #define CONNECTED_PAST 0x02
  28 +//! Connection state definition (Connected)
  29 +/*! This definition tells that the device is currently connected to the Wi-Fi network. */
22 30 #define CONNECTED_NOW 0x01
  31 +//! Connection state definition (Connected in the past)
  32 +/*! This definition tells that the device is not connected to the Wi-Fi network. */
23 33 #define NOT_CONNECTED 0x00
24 34  
25   -void dhcp_connect_result_cb(int result);
26   -void wifi_connect_result_cb(int result);
27   -void wifi_connect_ap_result_cb(int result);
28   -void wifi_connect_result_cb(int result);
29   -void softapMode_clientIndicationCb(wismart_softap_cb_t reason, const uint8_t *mac, const libwismart_ip_addr_t *ip);
30   -void softapMode_apStartedCb(int result);
31   -void printWifiInfo(uint8_t wifiMode);
32   -
  35 +//! DHCP callback
  36 +/*! This function is called whenever the libwismart DHCP acquirement function returns a result, and prints if it has been successful, and if it was, which IP has obtained. */
  37 +void dhcp_connect_result_cb(int result /*! Callee function result */);
  38 +//! Wi-Fi connect callback
  39 +/*! This function is called whenever the libwismart Wi-Fi association function returns a result, and prints if it has been successful. */
  40 +void wifi_connect_result_cb(int result /*! Callee function result */);
  41 +//! AP client callback
  42 +/*! This function is called whenever the some client connects to the created AP, and prints which is its MAC address and if it which IP has the DHCP server assigned to it (if applicable). */
  43 +void softapMode_clientIndicationCb(wismart_softap_cb_t reason /*! Client disconnect reason (if applicable) */, const uint8_t *mac /*! Client MAC address */, const libwismart_ip_addr_t *ip /*! DHCP assigned IP address of the client */);
  44 +//! Host AP callback
  45 +/*! This function is called whenever the libwismart Host AP setup function returns a result, and prints if it has been successful and if it was, the parameters of the created AP. */
  46 +void softapMode_apStartedCb(int result /*! Callee function result */);
  47 +//! Print AP info
  48 +/*! This function prints information about the AP created by the device when this happens. */
  49 +void printWifiInfo(uint8_t wifiMode /*! Current Wi-Fi mode */);
  50 +
  51 +//! Debug printing definition
  52 +/*! This definition is used for debugging purposes, it is a shorthand for printing debug information */
33 53 #define DBG_CALLBACKS(fmt,...) printf("%c[1;35mcallbacks.c:%c[1;00m "fmt,0x1B,0x1B, ##__VA_ARGS__)
34 54 //#define DBG_CALLBACKS(fmt,...) printf("")
35 55  
... ...
Project/applications/smartcities/include/configServer.h
  1 +
  2 +/**@file
  3 + * @brief Declaration for the HTTP configuration server functions
  4 + * @author Imanol Barba Sabariego
  5 + * @date 08/06/2014
  6 + *
  7 + * The functions declared in this file are used to set up and manage the HTTP configuration server.
  8 + */
  9 +
1 10 #ifndef CONFIG_SERVER_H
2 11 #define CONFIG_SERVER_H
3 12  
... ... @@ -10,43 +19,76 @@
10 19 #include "ch.h"
11 20 #include "fsdata.c"
12 21  
  22 +//! Debug printing definition
  23 +/*! This definition is used for debugging purposes, it is a shorthand for printing debug information */
13 24 #define CONFIG_SERVER_DBG(fmt,...) printf("%c[1;35mconfigServer.c:%c[1;00m "fmt,0x1B,0x1B, ##__VA_ARGS__)
  25 +//! Debug printing definition
  26 +/*! This definition is used for debugging purposes, it is a shorthand for printing debug information */
14 27 #define CONFIG_SERVER_DBG_WARNING(fmt,...) printf("%c[1;35mconfigServer.c:%c[1;33m[WARNING] "fmt"%c[1;00m",0x1B,0x1B,0x1B, ##__VA_ARGS__)
15 28  
16 29 //#define CONFIG_SERVER_DBG(fmt,...) printf("")
17 30 //#define CONFIG_SERVER_DBG_WARNING(fmt,...) printf("")
18 31  
19   -void configServer_start(uint8_t enableApScan);
  32 +//! HTTP configuration server start function
  33 +/*! This function starts the HTTP server to configure the device. */
  34 +void configServer_start(uint8_t enableApScan /*! Wether or not to enable AP scan */);
  35 +//! HTTP server connection handler
  36 +/*! This function handles an incoming connection to the HTTP server. */
20 37 void configServer_connect(void);
21   -uint32_t condigServer_dynamicCb(char* varName, char** varValue, uint8_t* varAllocType);
  38 +//! HTTP resource building function
22 39 void configServer_buildResources(void);
  40 +//! HTTP client parameters function
  41 +/*! This function reads the parameters that the client POSTed to the HTTP server and writes them to the internal configuration register. */
23 42 void configServer_setClientParameters(void);
  43 +//! Device reboot function
24 44 void configServer_reboot(void);
  45 +//! Device reboot timer handler
25 46 void configServer_rebootTimerHandler(void *arg);
26   -int configServer_hex2bin(char *hex, char *buf, size_t hexLen);
27   -uint32_t configServer_dynamicCb(char* varName, char** varValue, uint8_t* varAllocType);
  47 +//! Hex to Binary conversion function
  48 +/*! This function converts a hexadecimal wep key to a binary string. Returns 0 if successful.*/
  49 +int configServer_hex2bin(char *hex /*! Input hex string */, char *buf /*! Output binary string */, size_t hexLen /*! Hex string length */);
  50 +//! HTTP Dynamic content callback function
  51 +/*! This function is called whenever a client requests dynamic content to the server, and sends the requested data through the socket. */
  52 +uint32_t configServer_dynamicCb(char* varName /*! Requested variable name */, char** varValue /*! Output pointer for the requested data */, uint8_t* varAllocType /*! Pointer to indicate wether the requested data was dynamically allocated or not */);
28 53  
  54 +//! Configuration registry parameters
29 55 typedef struct {
30   - char ssid[33]; // ssid clave red usuario contrasenya tipicript
  56 + //! Wi-Fi network SSID
  57 + char ssid[33];
  58 + //! Wi-Fi network WEP key
31 59 char wepkey[14];
  60 + //! Wi-Fi network WPA passphrase
32 61 char passphrase[64];
  62 + //! Wi-Fi network security
33 63 uint16_t security;
  64 + //! RADIUS user
34 65 char user[64];
  66 + //! RADIUS password
35 67 char password[64];
  68 + //! Geolocalization coordinates (i.e: 41.557255 2.096183)
36 69 char localization[32];
37 70 } config_params_t;
38 71  
39 72 extern wismart_registryKey_t geo;
40 73  
  74 +//! Wi-Fi Open network security definition
41 75 #define SECURITY_TYPE_OPEN "open"
  76 +//! Wi-Fi WPA network security definition
42 77 #define SECURITY_TYPE_WPA "wpa"
  78 +//! Wi-Fi WEP network security definition (Index 1)
43 79 #define SECURITY_TYPE_WEP1 "wep1"
  80 +//! Wi-Fi WEP network security definition (Index 2)
44 81 #define SECURITY_TYPE_WEP2 "wep2"
  82 +//! Wi-Fi WEP network security definition (Index 3)
45 83 #define SECURITY_TYPE_WEP3 "wep3"
  84 +//! Wi-Fi WEP network security definition (Index 4)
46 85 #define SECURITY_TYPE_WEP4 "wep4"
47 86  
  87 +//! HTTP server HTML MIME type string
48 88 #define CONFIG_SERVER_MIME_TYPE_HTML "text/html; charset=UTF-8"
  89 +//! HTTP server CSS MIME type string
49 90 #define CONFIG_SERVER_MIME_TYPE_CSS "text/css; charset=UTF-8"
  91 +//! HTTP server PNG MIME type string
50 92 #define CONFIG_SERVER_MIME_TYPE_PNG "image/png"
51 93  
52 94  
... ...
Project/applications/smartcities/include/globals.h
  1 +
  2 +/**@file
  3 + * @brief Definition of global parameters
  4 + * @author Imanol Barba Sabariego
  5 + * @date 08/06/2014
  6 + *
  7 + * Here are defined several parameters that affect the current device configuration
  8 + */
  9 +
1 10 #ifndef GLOBALS_H
2 11 #define GLOBALS_H
3 12  
  13 +//! SENTILO platform server IP
4 14 #define SERVER_IP "147.83.39.240"
  15 +//! SENTILO platform server hostname
5 16 #define SERVER_HOSTNAME SERVER_IP
  17 +//! Module ID length
6 18 #define MODULE_ID_LENGTH 6
7   -#define BUFFER_LENGTH 30
  19 +//! Maximum RAM available
8 20 #define MAX_RAM 34704
  21 +//! Current device module ID
9 22 #define MODULE_ID "000001"
  23 +//! Default Wi-Fi mode
10 24 #define WIFI_MODE WIFI_MODE_CLIENT
  25 +//! Hosted AP name
11 26 #define NETWORK_SSID_AP "modularsense"
  27 +//! Hosted AP encryption key
12 28 #define NETWORK_KEY_AP NULL
  29 +//! Hosted AP channel
13 30 #define NETWORK_CHANNEL_AP 1
  31 +//! Wait time for each retry when in hard limit
14 32 #define HARD_LIMIT_WAIT_TIME 10*1000 //5*60*1000
  33 +//! NTP remote server IP
15 34 #define SNTP_SERVER_ADDRESS ipaddr_addr("81.184.154.182") /* your ntp server */
16   -
  35 +//! Type of server used (lewis.upc.es)
17 36 #define SERVER_LEWIS
18   -#endif
19   -
20   -// printf("%c[1;31m[FREE] Freed bytes from %08x%c[1;00m\r\n",0x1B,p,0x1B);
21   -// printf("%c[1;31m[ALLOC] Allocated %d bytes to %08x%c[1;00m\r\n",0x1B,size,(hp),0x1B);
  37 +#endif
22 38 \ No newline at end of file
... ...
Project/applications/smartcities/include/i2c.h
... ... @@ -42,11 +42,11 @@ void I2C_stop(I2C_TypeDef* I2Cx /*! I2C device to use */);
42 42 void I2C_write(I2C_TypeDef* I2Cx /*! I2C device to use */, uint8_t data /*! Byte to write */);
43 43  
44 44 //! I2C read byte function (with master ACK)
45   -/*! This function fetches a byte from the I2C bus that has been stored into the internal register and sends and ACK afterwards. */
  45 +/*! This function returns a byte from the I2C bus that has been stored into the internal register and sends and ACK afterwards. */
46 46 uint8_t I2C_read_ack(I2C_TypeDef* I2Cx /*! I2C device to use */);
47 47  
48 48 //! I2C read byte function (without master ACK)
49   -/*! This function fetches a byte from the I2C bus that has been stored into the internal register without sending and ACK afterwards. */
  49 +/*! This function returns a byte from the I2C bus that has been stored into the internal register without sending and ACK afterwards. */
50 50 uint8_t I2C_read_nack(I2C_TypeDef* I2Cx /*! I2C device to use */);
51 51  
52 52 //! I2C bus scan function
... ...
Project/applications/smartcities/include/json.h
  1 +
  2 +/**@file
  3 + * @brief Declaration for the JSON related functions
  4 + * @author Imanol Barba Sabariego
  5 + * @date 08/06/2014
  6 + *
  7 + * The functions declared in this file are used to generate and send the different JSON-formatted strings to communicate with the SENTILO platform.
  8 + */
  9 +
1 10 #ifndef JSON_H
2 11 #define JSON_H
3 12  
... ... @@ -11,22 +20,44 @@
11 20 #include "libwismart.h"
12 21 #include "httpClient.h"
13 22  
  23 +//! JSON data send status definition (OK)
14 24 #define JSON_POST_OK 0
  25 +//! JSON data send status definition (Communication error occurred)
15 26 #define JSON_COMM_ERROR 1
  27 +//! JSON data send status definition (Undefined error occurred)
16 28 #define JSON_OTHER_ERROR 2
17 29  
  30 +//! Free memory from the strings to be joined in join_strings
18 31 #define JOIN_NO_FREE 0
  32 +//! Do not free memory from the strings to be joined in join_strings
19 33 #define JOIN_FREE_MEM 1
20 34  
  35 +//! Debug printing definition
  36 +/*! This definition is used for debugging purposes, it is a shorthand for printing debug information */
21 37 #define DBG_JSON(fmt,...) printf("%c[1;35mjson.c:%c[1;00m "fmt,0x1B,0x1B, ##__VA_ARGS__)
22 38 //#define DBG_JSON(fmt,...) printf("")
23 39  
24   -uint8_t register_sensor(sensor sens);
25   -char* prepare_json_observation_statement(char** data, uint32_t nObservations);
26   -char* prepare_json_register_statement(module mod, sensor sens, char *additional_info);
27   -char* prepare_observation(char* observation, uint32_t length);
28   -uint8_t send_json(char* statement, uint32_t length, char* provider_ID, char* sensor_ID);
29   -uint32_t find_next_index(char* string, uint32_t length, char delimiter);
30   -char* join_strings(char* str1, char* str2, uint32_t len1, uint32_t len2, uint8_t free_mem);
  40 +//! Sensor register function
  41 +/*! This function generates a JSON string and sends it to the SENTILO server to register the sensor in the platform. Returns one of the JSON status codes.*/
  42 +uint8_t register_sensor(sensor sens /*! Sensor to register */);
  43 +
  44 +//! Observation statement generation function.
  45 +/*! Returns the generated JSON string for the buffer passed by argument. */
  46 +char* prepare_json_observation_statement(char** data /*! Observation buffer */, uint32_t nObservations /*! Number of measurements inside the buffer */);
  47 +//! Register statement generation function.
  48 +/*! Returns the generated JSON string for the sensor passed by argument. */
  49 +char* prepare_json_register_statement(module mod /*! Current device module data */, sensor sens /*! Sensor for which the statement is generated */, char *additional_info /*! Additional registration information */);
  50 +//! Observation generation function
  51 +/*! Returns the generated JSON string for the observation passed by argument. */
  52 +char* prepare_observation(char* observation /*! Observation for which the statement is generated */, uint32_t length /*! Length of the observation string */);
  53 +//! JSON send function
  54 +/*! This function sends the JSON statement passed by argument to the SENTILO server. Returns one of the JSON status codes. */
  55 +uint8_t send_json(char* statement /*! Statement to send */, uint32_t length /*! Statement string length */, char* provider_ID /*! Current device module ID*/ , char* sensor_ID /*! Sensor ID of the current statement */);
  56 +//! String parsing function
  57 +/*! This function finds the next ocurrence of the character passed by argument and returns the index in which that ocurrence can be found. */
  58 +uint32_t find_next_index(char* string /*! String where to search for ocurrences */, uint32_t length /*! Length of the string */, char delimiter /*! Character to search in the string */);
  59 +//! Join two stings
  60 +/*! This function joins two strings passed by argument an returns the new string. Optionally, it may free the memory of the two original strings. */
  61 +char* join_strings(char* str1 /*! First string */, char* str2 /*! Second string */, uint32_t len1 /*! First string length */, uint32_t len2 /*! Second string length */, uint8_t free_mem /*! Wether to free the memory from the original strings or not. Possible values are: <br>JOIN_NO_FREE<br>JOIN_FREE_MEM */);
31 62  
32 63 #endif
... ...
Project/applications/smartcities/include/module.h
  1 +
  2 +/**@file
  3 + * @brief Definition for the module structure and current module
  4 + * @author Imanol Barba Sabariego
  5 + * @date 08/06/2014
  6 + *
  7 + * Here is the current module and the module information structure definitions
  8 + */
  9 +
1 10 #ifndef MODULE_H
2 11 #define MODULE_H
3 12  
4 13 #include "globals.h"
5 14  
  15 +//! Module definition struct
6 16 typedef struct {
  17 + //! Module ID string
7 18 char ID[MODULE_ID_LENGTH +1];
  19 + //! Module geolocalization coordinates string
8 20 char geoloc[20];
9 21 } module;
10 22  
... ...
Project/applications/smartcities/include/timer-loop.h
  1 +
  2 +/**@file
  3 + * @brief Declaration for the timing control functions
  4 + * @author Ferràn Quer i Guerrero
  5 + * @date 08/06/2014
  6 + *
  7 + * The functions declared in this file are used to synchronize the different actions taken by the device in a timely fashion.
  8 + */
1 9 #ifndef TIMER_LOOP_H
2 10 #define TIMER_LOOP_H
3 11  
4 12 #include "libwismart.h"
5 13 #include "lwip/inet.h"
6 14  
  15 +//! Half hour time definition
7 16 #define HALF_HOUR 60*30 // time in seconds
  17 +//! Five minutes time definition
8 18 #define FIVE_MIN 60*5 // time in seconds
9   -//#define LONG_PERIOD HALF_HOUR //60*3 // for testing
  19 +//#define LONG_PERIOD HALF_HOUR //60*3 // for testing
10 20 //#define SHORT_PERIOD FIVE_MIN //60*1 // for testing
  21 +//! Long period time definition
  22 +/*! This defines how often will the device try to send data to the server. */
11 23 #define LONG_PERIOD 60*3 //60*3 // for testing
  24 +//! Short period time definition
  25 +/*! This defines how often will the device try to fetch data from the sensors. */
12 26 #define SHORT_PERIOD 60*1 //60*1 // for testing
13 27  
  28 +//! Debug printing definition
  29 +/*! This definition is used for debugging purposes, it is a shorthand for printing debug information */
14 30 #define DBG_TIMER(fmt,...) printf("%c[1;35mtimer-loop.c:%c[1;00m "fmt,0x1B,0x1B, ##__VA_ARGS__)
15 31 //#define DBG_TIMER(fmt,...) printf("")
16 32  
  33 +//! Returns elapsed time since device startup in seconds
17 34 unsigned long getSystemTime(void);
18 35  
19   -unsigned long getElapsedTime(unsigned long t);
  36 +//! Returns elapsed time since the timestamp passed by argument
  37 +unsigned long getElapsedTime(unsigned long t /*! Time from which calculate the difference */);
20 38  
21   -void sleep_thread(unsigned long seconds);
  39 +//! Sleep thread function
  40 +void sleep_thread(unsigned long seconds /*! Seconds to sleep */);
22 41  
23 42 #endif
24 43 \ No newline at end of file
... ...
Project/applications/smartcities/timer-loop.c
... ... @@ -8,24 +8,12 @@
8 8  
9 9 #include "timer-loop.h"
10 10  
11   -
12   -/***************************************************
13   - ** CATALAN ****************************************
14   - * Agafem el temps des de l'NTP el primer cop. *
15   - * Mostres síncrones amb els altres nodes modsense *
16   - * Cada mitja hora (long period) asíncrona amb els *
17   - * altres nodes, NTP i enviament de mostres. *
18   - ** ENGLISH ****************************************
19   - * Get NTP time the first time. *
20   - * Values sync'd with other modularsense nodes *
21   - * Every half an hour (long period), async'd to *
22   - * other nodes, get NTP and send all data. *
23   - ***************************************************/
24 11 /*
25 12 * unsigned int representa:
26 13 * - segons: 2^32 -1 = 4.294.967.295 segons // 136.1 average Gregorian years
27 14 * - milisegons:ans/1000 = 4.294.967,295 segons // 49 days 17 hours 2 minutes 47.3 seconds
28 15 */
  16 +
29 17 unsigned long getSystemTime()
30 18 {
31 19 return (long)libwismart_GetTime()/1000;
... ...