BayEOSArduino Library
BaySIM800.h
1 #ifndef BaySIM800_h
2 #define BaySIM800_h
3 
4 #define BaySIM800_BUFFER 138
5 
6 
7 #define printP(x) printPGM(PSTR(x))
8 #define printlnP(x) printlnPGM(PSTR(x))
9 #define printlnP_OK(x,y) printlnPGM(PSTR(x),y)
10 #define wait_for(x,y) wait_forPGM(PSTR(x),y)
11 
12 
13 #include <BayEOS.h>
14 #include <Base64.h>
15 
16 class BaySIM800 : public BayEOS {
17 public:
18  BaySIM800(HardwareSerial& serial);
19 
25  void readConfigFromStringPGM(const char* string);
26 
27 
37  uint8_t sendMultiFromBuffer(uint16_t maxsize=5000,bool ack_payload=false);
38  uint8_t sendPayloadWithAck(bool ack_payload=true);
39  uint8_t sendPayload(void);
40 
54  uint8_t begin(long baud);
55  uint8_t init(void);
56 
57  /*
58  * Change the baud rate of the Modem
59  * 0 == OK
60  * 1 == Failed
61  */
62  uint8_t changeIPR(long baud);
63 
67  uint8_t isRegistered(void);
68 
72  uint8_t isAttached(void);
73 
77  uint8_t getRSSI(void);
78 
82  DateTime now(void);
83 
84 protected:
88  uint8_t postHeader(uint16_t size);
89  uint8_t post(void);
90  void readAck(void);
91 
92 
93 
94  HardwareSerial* _serial; //Pointer to existing serial object!!
95  long _baud;
96 
97  void skipChars(void);
98  uint8_t wait_forOK(uint16_t timeout);
99  uint8_t wait_forPGM(const char* str, uint16_t timeout,uint8_t bytes=0, char* buffer=NULL);
100  uint8_t wait_for_available(int bytes=1);
101  void printPGM(const char *str);
102  void printlnPGM(const char *str);
103  uint8_t printlnPGM(const char *str, uint16_t timeout);
104  void urlDecode(char *str);
105  uint8_t strlenURLencoded(const char *str);
106  void printURLencoded(const char *str);
107  uint8_t URLencoded(char c,bool print=true);
108 
109  uint8_t getConfig(const char * config,bool print=true,bool urlencoded=false);
110 
111  const char* _url; //0
112  const char* _user; //1
113  const char* _password; //2
114  const char* _sender; //3
115  const char* _apn; //4
116  const char* _prov_user; //5
117  const char* _prov_pw; //6
118  const char* _pin; //7
119  char _base64buffer[BaySIM800_BUFFER];
120  uint8_t _tx_error_count;
121  uint16_t _mtu;
122  uint16_t _timeout;
123  static const char* const _urlencodedChars;
124 
125 };
126 
127 
128 #endif
Definition: BayEOS.h:188
Definition: BaySIM800.h:16
uint8_t sendMultiFromBuffer(uint16_t maxsize=5000, bool ack_payload=false)
Definition: BaySIM800.cpp:267
DateTime now(void)
Definition: BaySIM800.cpp:139
uint8_t getRSSI(void)
Definition: BaySIM800.cpp:117
uint8_t isAttached(void)
Definition: BaySIM800.cpp:132
uint8_t sendPayload(void)
Definition: BaySIM800.cpp:239
uint8_t postHeader(uint16_t size)
Definition: BaySIM800.cpp:161
void readConfigFromStringPGM(const char *string)
Definition: BaySIM800.cpp:461
uint8_t begin(long baud)
Definition: BaySIM800.cpp:9
uint8_t isRegistered(void)
Definition: BaySIM800.cpp:124
Definition: BayEOSBuffer.h:33