modem.h (820B) download
1#pragma once
2
3#include "config.h"
4
5struct sara_modem {
6 // -*- enums and structs -*-
7 enum command_status {
8 COMMAND_OK = 0, // command succeed
9 COMMAND_ERROR = 1, // command returned an error
10 COMMAND_TIMEOUT = 2 // command timed out
11 };
12
13 enum command_flags {
14 COMMAND_NONE, // none of them underneath
15 COMMAND_SILENT = 1 << 0, // no debug messages (for looped commands)
16 COMMAND_BLOCK = 1 << 1, // no time-out (for waiting commands)
17 COMMAND_IGNORE = 1 << 2, // don't wait for response, just wait $ignoreDelay secounds
18 COMMAND_EVENT = 1 << 3, // handle '+'-responses as event
19 };
20
21 // -*- declarations -*-
22 void init();
23 command_status send(const char* request, char* response, command_flags flags = COMMAND_NONE);
24 command_status send(const char* request, command_flags flags = COMMAND_NONE);
25};