66 #include "generated/settings.h"
69 #define GSM_LINK UART3100
72 #define GSM_MAX_PAYLOAD 160
74 #define GSMLinkDev (&(GSM_LINK).device)
76 #define GSMLinkChAvailable() GSMLinkDev->check_available(GSMLinkDev->periph)
77 #define GSMLinkTransmit(_c) GSMLinkDev->put_byte(GSMLinkDev->periph, 0, _c)
78 #define GSMLinkGetch() GSMLinkDev->get_byte(GSMLinkDev->periph)
79 #define ReadGSMBuffer() { while (GSMLinkChAvailable&&!gsm_line_received) gsm_parse(GSMLinkGetch()); }
83 #define GSM_ORIGIN_MAXLEN 32
84 #define DATA_MAXLEN 128
87 #define MAXLEN_CMTI_ANSWER 32
88 #define MAXLEN_SMS_CONTENT DATA_MAXLEN
103 #define STATUS_NONE 0
105 #define STATUS_REQUESTING_MESSAGE 2
106 #define STATUS_SEND_AT 3
107 #define STATUS_SEND_CMGF 4
108 #define STATUS_SEND_CNMI 5
109 #define STATUS_SEND_CPMS 6
110 #define STATUS_RECEPTION_SMS2 7
111 #define STATUS_WAITING_DATA 8
112 #define STATUS_IDLE 9
113 #define STATUS_WAITING_PROMPT 10
114 #define STATUS_DELETE_SMS 11
115 #define STATUS_POWERON 12
133 static void Send(
const char string[]);
174 gsm_gsm_init_report_status =
false;
209 index_msg = atoi(first_comma + 1);
220 switch (gsm_status) {
252 gsm_gsm_send_report_status = MODULES_START;
273 char demande_lecture_SMS[16];
276 sprintf(demande_lecture_SMS,
"AT+CMGR=%d", index_msg);
278 Send(demande_lecture_SMS);
300 || strncmp((
char *)GCS_NUMBER_1, origin, strlen(GCS_NUMBER_1)) == 0
303 || strncmp((
char *)GCS_NUMBER_2, origin, strlen(GCS_NUMBER_2)) == 0
305 #ifdef SAFETY_NUMBER_1
306 || strncmp((
char *)SAFETY_NUMBER_1, origin, strlen(SAFETY_NUMBER_1)) == 0
308 #ifdef SAFETY_NUMBER_2
309 || strncmp((
char *)SAFETY_NUMBER_2, origin, strlen(SAFETY_NUMBER_2)) == 0
318 if (block_index > 0) {
327 DlSetting(var_index, value);
342 char demande_suppression[20];
344 sprintf(demande_suppression,
"AT+CMGD=%d", index_);
347 Send(demande_suppression);
355 char string[strlen(data_to_send) + 3];
357 sprintf(
string,
"%s%c", data_to_send,
CTRLZ);
413 sprintf(buf,
"AT+CMGS=\"%s\"", GCS_NUMBER_1);
419 sprintf(buf,
"AT+CMGS=\"%s\"", GCS_NUMBER_2);
428 if (gcs_index == gcs_index_max) { gcs_index = 0; }
461 Send(
"AT+CNMI=1,1,0,0,0");
468 Send(
"AT+CPMS=\"SM\"");
475 case GSM_CMD_LINE_TERMINATION:
480 case GSM_RESPONSE_FORMATING:
497 static void Send(
const char string[])
502 GSMTransmit(
string[i++]);
504 GSMTransmit(GSM_CMD_LINE_TERMINATION);
513 while (n && (*s != c)) {
517 return (n ? s : NULL);
static bool gsm_line_received
int32_t north
in centimeters
static uint8_t gsm_buf_idx
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
static char data_to_send[DATA_MAXLEN]
static bool waiting_for_reply
#define STATUS_REQUESTING_MESSAGE
static void Suppr_SMS(int)
uint16_t flight_time
flight time in seconds
#define GSM_ORIGIN_MAXLEN
static void parse_msg_header(void)
Message header in gsm_bug.
float vsupply
supply voltage in V
static char * indexn(char *, char, uint8_t)
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 gsm_got_prompt(void)
int32_t east
in centimeters
static char origin[GSM_ORIGIN_MAXLEN]
struct UtmCoor_i utm_pos
position in UTM (north,east: cm; alt: mm over MSL)
#define MAXLEN_SMS_CONTENT
static void Send_CSQ(void)
struct pprz_autopilot autopilot
Global autopilot structure.
#define MAXLEN_CMTI_ANSWER
static uint8_t gsm_buf_len
static void Send(const char string[])
#define STATUS_WAITING_PROMPT
static uint8_t gcs_index_max
Communications through GSM.
int32_t hmsl
height above mean sea level (MSL) in mm
static void gsm_parse(uint8_t c)
Interface for electrical status: supply voltage, current, battery status, etc.
#define GSMLinkChAvailable()
Device independent GPS code (interface)
static uint8_t gsm_status
static bool prompt_received
#define STATUS_WAITING_DATA
Core autopilot interface common to all firmwares.
static void Send_CPMS(void)
static void gsm_got_line(void)
static char gsm_buf[GSM_MAX_PAYLOAD]
static void gsm_send_report_continue(void)
Common code for AP and FBW telemetry.
static void request_for_msg(void)
uint16_t gspeed
norm of 2d ground speed in cm/s
static char expected_ack[10]
struct Electrical electrical
static void Send_AT(void)
static void Send_CNMI(void)
#define STATUS_DELETE_SMS
void nav_goto_block(uint8_t b)
struct NedCoor_i ned_vel
speed NED in cm/s
struct GpsState gps
global GPS state
static void Send_CMGF(void)