66 #include "generated/settings.h"
70 #define GSM_LINK UART3100
73 #define GSM_MAX_PAYLOAD 160
75 #define GSMLinkDev (&(GSM_LINK).device)
77 #define GSMLinkChAvailable() GSMLinkDev->check_available(GSMLinkDev->periph)
78 #define GSMLinkTransmit(_c) GSMLinkDev->put_byte(GSMLinkDev->periph, 0, _c)
79 #define GSMLinkGetch() GSMLinkDev->get_byte(GSMLinkDev->periph)
80 #define ReadGSMBuffer() { while (GSMLinkChAvailable&&!gsm_line_received) gsm_parse(GSMLinkGetch()); }
84 #define GSM_ORIGIN_MAXLEN 32
85 #define DATA_MAXLEN 128
88 #define MAXLEN_CMTI_ANSWER 32
89 #define MAXLEN_SMS_CONTENT DATA_MAXLEN
104 #define STATUS_NONE 0
106 #define STATUS_REQUESTING_MESSAGE 2
107 #define STATUS_SEND_AT 3
108 #define STATUS_SEND_CMGF 4
109 #define STATUS_SEND_CNMI 5
110 #define STATUS_SEND_CPMS 6
111 #define STATUS_RECEPTION_SMS2 7
112 #define STATUS_WAITING_DATA 8
113 #define STATUS_IDLE 9
114 #define STATUS_WAITING_PROMPT 10
115 #define STATUS_DELETE_SMS 11
116 #define STATUS_POWERON 12
134 static void Send(
const char string[]);
175 gsm_gsm_init_report_status =
false;
253 gsm_gsm_send_report_status = MODULES_START;
274 char demande_lecture_SMS[16];
277 sprintf(demande_lecture_SMS,
"AT+CMGR=%d",
index_msg);
279 Send(demande_lecture_SMS);
301 || strncmp((
char *)GCS_NUMBER_1,
origin, strlen(GCS_NUMBER_1)) == 0
304 || strncmp((
char *)GCS_NUMBER_2,
origin, strlen(GCS_NUMBER_2)) == 0
306 #ifdef SAFETY_NUMBER_1
307 || strncmp((
char *)SAFETY_NUMBER_1,
origin, strlen(SAFETY_NUMBER_1)) == 0
309 #ifdef SAFETY_NUMBER_2
310 || strncmp((
char *)SAFETY_NUMBER_2,
origin, strlen(SAFETY_NUMBER_2)) == 0
319 if (block_index > 0) {
328 DlSetting(var_index, value);
343 char demande_suppression[20];
345 sprintf(demande_suppression,
"AT+CMGD=%d", index_);
348 Send(demande_suppression);
414 sprintf(buf,
"AT+CMGS=\"%s\"", GCS_NUMBER_1);
420 sprintf(buf,
"AT+CMGS=\"%s\"", GCS_NUMBER_2);
462 Send(
"AT+CNMI=1,1,0,0,0");
469 Send(
"AT+CPMS=\"SM\"");
476 case GSM_CMD_LINE_TERMINATION:
481 case GSM_RESPONSE_FORMATING:
498 static void Send(
const char string[])
503 GSMTransmit(
string[i++]);
505 GSMTransmit(GSM_CMD_LINE_TERMINATION);
514 while (n && (*
s != c)) {
518 return (n ?
s : NULL);
struct pprz_autopilot autopilot
Global autopilot structure.
Core autopilot interface common to all firmwares.
uint16_t flight_time
flight time in seconds
void nav_goto_block(uint8_t b)
Common code for AP and FBW telemetry.
struct Electrical electrical
Interface for electrical status: supply voltage, current, battery status, etc.
float vsupply
supply voltage in V
struct GpsState gps
global GPS state
Device independent GPS code (interface)
int32_t hmsl
height above mean sea level (MSL) in mm
struct UtmCoor_i utm_pos
position in UTM (north,east: cm; alt: mm over MSL)
struct NedCoor_i ned_vel
speed NED in cm/s
uint16_t gspeed
norm of 2d ground speed in cm/s
int32_t east
in centimeters
int32_t north
in centimeters
#define GSM_ORIGIN_MAXLEN
static void gsm_got_line(void)
static void parse_msg_header(void)
Message header in gsm_bug.
static void gsm_parse(uint8_t c)
static void request_for_msg(void)
void gsm_init_report(void)
static void gsm_receive_content(void)
Receiving a SMS, third step, content in gsm_buf Message can be Bdd where dd is a block index on two d...
static void Send_CMGF(void)
static bool waiting_for_reply
static uint8_t gsm_status
static void gsm_got_prompt(void)
static void Suppr_SMS(int)
#define STATUS_WAITING_PROMPT
static char gsm_buf[GSM_MAX_PAYLOAD]
#define STATUS_REQUESTING_MESSAGE
#define MAXLEN_CMTI_ANSWER
static void Send_CPMS(void)
static char origin[GSM_ORIGIN_MAXLEN]
static void Send(const char string[])
static void gsm_send_report_continue(void)
#define STATUS_WAITING_DATA
static char expected_ack[10]
#define STATUS_DELETE_SMS
static void Send_AT(void)
#define MAXLEN_SMS_CONTENT
static char data_to_send[DATA_MAXLEN]
static uint8_t gsm_buf_len
#define GSMLinkChAvailable()
static bool prompt_received
static char * indexn(char *, char, uint8_t)
static bool gsm_line_received
static uint8_t gsm_buf_idx
static uint8_t gcs_index_max
static void Send_CNMI(void)
static void Send_CSQ(void)
Communications through GSM.
arch independent LED (Light Emitting Diodes) API
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.