63 #include "autopilot.h"
65 #include "generated/settings.h"
68 #define GSM_LINK UART3100
71 #define GSM_MAX_PAYLOAD 160
73 #define GSMLinkDev (&(GSM_LINK).device)
75 #define GSMLinkChAvailable() GSMLinkDev->check_available(GSMLinkDev->periph)
76 #define GSMLinkTransmit(_c) GSMLinkDev->put_byte(GSMLinkDev->periph, _c)
77 #define GSMLinkGetch() GSMLinkDev->get_byte(GSMLinkDev->periph)
78 #define ReadGSMBuffer() { while (GSMLinkChAvailable&&!gsm_line_received) gsm_parse(GSMLinkGetch()); }
82 #define GSM_ORIGIN_MAXLEN 32
83 #define DATA_MAXLEN 128
86 #define MAXLEN_CMTI_ANSWER 32
87 #define MAXLEN_SMS_CONTENT DATA_MAXLEN
102 #define STATUS_NONE 0
104 #define STATUS_REQUESTING_MESSAGE 2
105 #define STATUS_SEND_AT 3
106 #define STATUS_SEND_CMGF 4
107 #define STATUS_SEND_CNMI 5
108 #define STATUS_SEND_CPMS 6
109 #define STATUS_RECEPTION_SMS2 7
110 #define STATUS_WAITING_DATA 8
111 #define STATUS_IDLE 9
112 #define STATUS_WAITING_PROMPT 10
113 #define STATUS_DELETE_SMS 11
114 #define STATUS_POWERON 12
132 static void Send(
const char string[]);
173 gsm_gsm_init_report_status =
FALSE;
208 index_msg = atoi(first_comma + 1);
219 switch (gsm_status) {
251 gsm_gsm_send_report_status = MODULES_START;
272 char demande_lecture_SMS[16];
275 sprintf(demande_lecture_SMS,
"AT+CMGR=%d", index_msg);
277 Send(demande_lecture_SMS);
299 || strncmp((
char *)GCS_NUMBER_1, origin, strlen(GCS_NUMBER_1)) == 0
302 || strncmp((
char *)GCS_NUMBER_2, origin, strlen(GCS_NUMBER_2)) == 0
304 #ifdef SAFETY_NUMBER_1
305 || strncmp((
char *)SAFETY_NUMBER_1, origin, strlen(SAFETY_NUMBER_1)) == 0
307 #ifdef SAFETY_NUMBER_2
308 || strncmp((
char *)SAFETY_NUMBER_2, origin, strlen(SAFETY_NUMBER_2)) == 0
317 if (block_index > 0) {
326 DlSetting(var_index, value);
341 char demande_suppression[20];
343 sprintf(demande_suppression,
"AT+CMGD=%d", index_);
346 Send(demande_suppression);
354 char string[strlen(data_to_send) + 3];
356 sprintf(
string,
"%s%c", data_to_send,
CTRLZ);
412 sprintf(buf,
"AT+CMGS=\"%s\"", GCS_NUMBER_1);
418 sprintf(buf,
"AT+CMGS=\"%s\"", GCS_NUMBER_2);
427 if (gcs_index == gcs_index_max) { gcs_index = 0; }
460 Send(
"AT+CNMI=1,1,0,0,0");
467 Send(
"AT+CPMS=\"SM\"");
474 case GSM_CMD_LINE_TERMINATION:
479 case GSM_RESPONSE_FORMATING:
496 static void Send(
const char string[])
501 GSMTransmit(
string[i++]);
503 GSMTransmit(GSM_CMD_LINE_TERMINATION);
512 while (n && (*s != c)) {
516 return (n ? s : NULL);
static bool gsm_line_received
int32_t north
in centimeters
static uint8_t gsm_buf_idx
uint16_t vsupply
Supply voltage in deciVolt.
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
static char data_to_send[DATA_MAXLEN]
uint16_t autopilot_flight_time
flight time in seconds.
static bool waiting_for_reply
#define STATUS_REQUESTING_MESSAGE
static void Suppr_SMS(int)
#define GSM_ORIGIN_MAXLEN
static void parse_msg_header(void)
Message header in gsm_bug.
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 ellipsoid)
#define MAXLEN_SMS_CONTENT
static void Send_CSQ(void)
#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 in mm
static void gsm_parse(uint8_t c)
#define GSMLinkChAvailable()
Device independent GPS code (interface)
static uint8_t gsm_status
static bool prompt_received
#define STATUS_WAITING_DATA
#define DefaultChannel
SITL.
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]
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)