GPS tracker code documentation
 All Classes Files Functions Variables Macros Pages
network_functions.h
Go to the documentation of this file.
1 
8 #ifndef NETWORK_FUNCTIONS_H
9 #define NETWORK_FUNCTIONS_H
10 
11 
12 #define DEBUG_MODE 1
13 /* TCP/GPRS error code*/
14 #define ERR_PHONE_FUNCTION 48
15 #define ERR_SIM_PRESENCE 49
16 #define ERR_PIN_WRONG 50
17 #define ERR_WEAK_SIGNAL 51
18 #define ERR_REGISTRATION 52
19 #define ERR_GPRS_ATTACH 52
20 #define ERR_PDP_DEACTIVATED 53
21 #define ERR_PDP_DEFINE 54
22 #define ERR_PDP_ACTIVATE 55
23 #define ERR_GET_IP 56
24 
25 /* MQTT error code*/
26 #define ERR_MQTT_EMPTY_PARAM 100
27 
28 /*GPRS definitions*/
29 #define APN "TM"
30 #define APN_LENGTH 2 /* Length of the APN string */
31 #define SIM_PIN ""
32 
33 /* MQTT packet variable definitions*/
34 #define MAX_LENGTH_MQTT_PACKET 128
35 #define MQTT_KEEP_ALIVE 15
36 
50 uint8_t enable_gprs();
51 
52 
57 uint8_t disable_gprs();
58 
59 
60 
68 uint8_t open_tcp_connection(char * ip_address, char * tcp_port);
69 
76 uint8_t send_tcp_data(uint8_t * data, uint8_t data_length);
77 
82 uint8_t close_tcp_connection();
83 
84 
94 uint8_t publish_mqtt_msg(char * ip_address, char * tcp_port, char * topic, char * client_id, char * message);
95 
96 
97 #endif
uint8_t enable_gprs()
gprs_enable() enables GPRS connection. GPRS must be enabled before trying to establish TCP connection...
Definition: network_functions.c:46
uint8_t send_tcp_data(uint8_t *data, uint8_t data_length)
sends data over an open TCP connection.
Definition: network_functions.c:594
uint8_t close_tcp_connection()
closes an open TCP connection.
Definition: network_functions.c:575
uint8_t disable_gprs()
disables the GPRS functionality and the whole radio module.
uint8_t publish_mqtt_msg(char *ip_address, char *tcp_port, char *topic, char *client_id, char *message)
publishes a message to an MQTT topic with QoS 1 by default.
Definition: network_functions.c:623
uint8_t open_tcp_connection(char *server_address, char *port)
opens a new TCP connection. if the function is called when there is already an open TCP connection th...
Definition: network_functions.c:465