1 Commits

Author SHA1 Message Date
eKa
e25e9fdcdb Old backup 2020-01-24 22:32:44 +05:00
5 changed files with 403 additions and 1304 deletions

View File

@@ -35,7 +35,8 @@
GPRS* GPRS::inst;
GPRS::GPRS(Stream& serial, uint8_t pkPin) {
GPRS::GPRS(Stream& serial, uint8_t pkPin)
{
_pkPin = pkPin;
inst = this;
@@ -44,13 +45,16 @@ GPRS::GPRS(Stream& serial, uint8_t pkPin) {
sim900_init(stream);
}
bool GPRS::init(void) {
bool GPRS::init(void)
{
if (!sim900_check_with_cmd("AT\r\n","OK\r\n",CMD))
return false;
if (!sim900_check_with_cmd("AT+CFUN=1\r\n","OK\r\n",CMD))
return false;
if (!checkSIMStatus())
return false;
@@ -101,7 +105,8 @@ void GPRS::reset() {
powerOn();
}
bool GPRS::checkSIMStatus(void) {
bool GPRS::checkSIMStatus(void)
{
char gprsBuffer[32];
byte count = 0;
sim900_clean_buffer(gprsBuffer,32);
@@ -120,7 +125,8 @@ bool GPRS::checkSIMStatus(void) {
return true;
}
bool GPRS::sendSMS(const char *number, const char *data) {
bool GPRS::sendSMS(char *number, char *data)
{
// Set message mode to ASCII
if(!sim900_check_with_cmd("AT+CMGF=1\r\n", "OK\r\n", CMD)) {
return false;
@@ -138,11 +144,11 @@ bool GPRS::sendSMS(const char *number, const char *data) {
sim900_send_cmd(data);
delay(500);
sim900_send_End_Mark();
return sim900_wait_for_resp("OK\r\n", CMD, 2);
return true;
}
char GPRS::isSMSunread() {
char GPRS::isSMSunread()
{
char gprsBuffer[48]; //48 is enough to see +CMGL:
char *s;
@@ -170,7 +176,7 @@ char GPRS::isSMSunread() {
*/
sim900_clean_buffer(gprsBuffer,31);
sim900_read_buffer(gprsBuffer, 30, DEFAULT_TIMEOUT);
sim900_read_buffer(gprsBuffer,30,DEFAULT_TIMEOUT);
//Serial.print("Buffer isSMSunread: ");Serial.println(gprsBuffer);
if(NULL != ( s = strstr(gprsBuffer,"OK"))) {
@@ -229,148 +235,22 @@ bool GPRS::readSMS(int messageIndex, char *message, byte length) {
return false;
}
byte GPRS::getEvent(char *message, char *phone, char *datetime, char *gprsBuffer, byte size, bool check) {
int len;
byte i = 0;
char *s, *p1, *p2;
// Read buffer
sim900_clean_buffer(gprsBuffer, size);
sim900_read_buffer(gprsBuffer, size - 1);
len = strlen(gprsBuffer);
// Get SMS
s = strstr(gprsBuffer,"+CMT: ");
if (s != NULL) {
// Extract phone number string
p1 = strstr(gprsBuffer, "\"+");
p2 = p1 + 1; //First phone number character
p1 = strstr((char *)(p2), "\"");
if (p1 != NULL) {
i = 0;
while (p2 < p1) {
phone[i++] = *(p2++);
}
phone[i] = '\0';
}
// Extract date time string
p1 = strstr((char *)(p2), ",");
p2 = p1 + 1;
p1 = strstr((char *)(p2), ",");
p2 = p1 + 2; //First date time character
p1 = strstr((char *)(p2), "\"");
if (p1 != NULL) {
i = 0;
while (p2 < p1) {
datetime[i++] = *(p2++);
}
datetime[i] = '\0';
}
// Extract message
p2 = strstr(gprsBuffer, "\r\n");
p2 = p2 + 2;
p1 = strstr(p2, "\r\n");
if (p1 != NULL) {
i = 0;
p1 = p1 + 2; //First message character
while((*p1 != '\r') && (i < len - 1)) {
message[i++] = *(p1++);
}
message[i] = '\0';
}
return SMS;
}
// Get Call
s = strstr(gprsBuffer,"+CLIP: ");
if (s != NULL) {
// Extract phone number string
p1 = strstr(gprsBuffer, "\"+");
p2 = p1 + 1; //First phone number character
p1 = strstr((char *)(p2), "\"");
if (p1 != NULL) {
i = 0;
while (p2 < p1) {
phone[i++] = *(p2++);
}
phone[i] = '\0';
}
return CALL;
}
// Get outgoing call
s = strstr(gprsBuffer,"+COLP: ");
if (s != NULL) {
// Extract phone number string
p1 = strstr(gprsBuffer, "\"+");
p2 = p1 + 1; //First phone number character
p1 = strstr((char *)(p2), "\"");
if (p1 != NULL) {
i = 0;
while (p2 < p1) {
phone[i++] = *(p2++);
}
phone[i] = '\0';
}
return ANSWER;
}
// Get BUSY
s = strstr(gprsBuffer,"BUSY");
if (s != NULL) {
return BUSY;
}
// Get NO CARRIER
s = strstr(gprsBuffer,"NO CARRIER");
if (s != NULL) {
return NO_CARRIER;
}
// Get NO ANSWER
s = strstr(gprsBuffer,"NO ANSWER");
if (s != NULL) {
return NO_ANSWER;
}
// Check modem
if (check) {
if (!sim900_check_with_cmd("AT\r\n","OK\r\n", CMD)) return ERR;
}
return NONE;
}
bool GPRS::getSMS(char *message, char *phone, char *datetime, char *gprsBuffer, byte size) {
bool GPRS::getSMS(char *message, char *phone, char *datetime) {
/* Response is like:
+CMT: "+79772941911","","15/12/15,01:51:24+12"
SMS text here
*/
//if(!sim900_check_with_cmd("","+CMT: ", CMD, 3)) return false;
if(!sim900_wait_for_resp("+CMT: ", CMD, 1)) return false;
if(!sim900_check_with_cmd("","+CMT: ",CMD)) return false;
byte i = 0;
//char gprsBuffer[80 + 160];
char gprsBuffer[80 + 160];
char *p1, *p2;
sim900_clean_buffer(gprsBuffer, size);//sizeof(gprsBuffer));
sim900_read_buffer(gprsBuffer, size - 1);//sizeof(gprsBuffer));
sim900_clean_buffer(gprsBuffer,sizeof(gprsBuffer));
sim900_read_buffer(gprsBuffer,sizeof(gprsBuffer));
int len = strlen(gprsBuffer);
//int len = sizeof(message);
//byte len = 160;
// Serial.print("Buff len: ");
// Serial.println(len);
// Serial.print("Buff: ");
// Serial.println(gprsBuffer);
// Serial.println("----- buffer -----");
// Serial.println(gprsBuffer);
@@ -443,9 +323,9 @@ void GPRS::answer(void)
sim900_send_cmd("ATA\r\n");
}
bool GPRS::ifcallNow(byte timeout)
bool GPRS::ifcallNow(void)
{
return sim900_check_with_cmd("","RING\r\n",CMD, timeout);
return sim900_check_with_cmd("","RING\r\n",CMD);
}
bool GPRS::ifcallEnd(void)
@@ -468,9 +348,9 @@ bool GPRS::disableCLIPring(void)
return sim900_check_with_cmd("AT+CLIP=0\r\n","OK\r\n",CMD);
}
bool GPRS::isCallActive(char *number, char *gprsBuffer)
bool GPRS::isCallActive(char *number)
{
//char gprsBuffer[46]; //46 is enough to see +CPAS: and CLCC:
char gprsBuffer[46]; //46 is enough to see +CPAS: and CLCC:
char *p, *s;
int i = 0;
@@ -490,12 +370,11 @@ bool GPRS::isCallActive(char *number, char *gprsBuffer)
OK
*/
sim900_clean_buffer(gprsBuffer, 46);
sim900_read_buffer(gprsBuffer, 45);
sim900_clean_buffer(gprsBuffer,29);
sim900_read_buffer(gprsBuffer,27);
//HACERR cuando haga lo de esperar a OK no me haría falta esto
//We are going to flush serial data until OK is recieved
//Serial.println("Wait OK");
//sim900_wait_for_resp("OK\r\n", CMD);
sim900_wait_for_resp("OK\r\n", CMD);
//Serial.print("Buffer isCallActive 1: ");Serial.println(gprsBuffer);
if(NULL != ( s = strstr(gprsBuffer,"+CPAS:"))) {
s = s + 7;
@@ -513,8 +392,8 @@ bool GPRS::isCallActive(char *number, char *gprsBuffer)
OK
*/
sim900_clean_buffer(gprsBuffer, 46);
sim900_read_buffer(gprsBuffer, 45);
sim900_clean_buffer(gprsBuffer,46);
sim900_read_buffer(gprsBuffer,45);
//Serial.print("Buffer isCallActive 2: ");Serial.println(gprsBuffer);
if(NULL != ( s = strstr(gprsBuffer,"+CLCC:"))) {
//There is at least one CALL ACTIVE, get number
@@ -565,9 +444,9 @@ bool GPRS::getDateTime(char *buffer) {
return sim900_wait_for_resp("OK\r\n", CMD);
}
return false;
}
}
byte GPRS::getSignalStrength() {
byte GPRS::getSignalStrength() {
//AT+CSQ: 00,00 --> 13 + CRLF = 15
// --> CRLF = 2
//OK --> 2 + CRLF = 4
@@ -588,7 +467,8 @@ byte GPRS::getSignalStrength() {
//Here is where we ask for APN configuration, with F() so we can save MEMORY
//bool GPRS::join(const __FlashStringHelper *apn, const __FlashStringHelper *userName, const __FlashStringHelper *passWord)
bool GPRS::join(char* apn, char* userName, char* passWord, int timeout) {
bool GPRS::join(char* apn, char* userName, char* passWord, int timeout)
{
byte i;
char *p, *s;
char ipAddr[32];
@@ -659,11 +539,13 @@ bool GPRS::join(char* apn, char* userName, char* passWord, int timeout) {
return false;
}
void GPRS::disconnect() {
void GPRS::disconnect()
{
sim900_send_cmd("AT+CIPSHUT\r\n");
}
bool GPRS::connect(Protocol ptl,const char * host, int port, int timeout) {
bool GPRS::connect(Protocol ptl,const char * host, int port, int timeout)
{
//char cmd[64];
char num[4];
char resp[96];
@@ -676,8 +558,8 @@ bool GPRS::connect(Protocol ptl,const char * host, int port, int timeout) {
itoa(port, num, 10);
sim900_send_cmd(num);
sim900_send_cmd("\r\n");
// sprintf(cmd, "AT+CIPSTART=\"TCP\",\"%s\",%d\r\n",host, port);
} else if(ptl == UDP) {
// sprintf(cmd, "AT+CIPSTART=\"TCP\",\"%s\",%d\r\n",host, port);
} else if(ptl == UDP) {
sim900_send_cmd("AT+CIPSTART=\"UDP\",\"");
sim900_send_cmd(host);
sim900_send_cmd("\",");
@@ -685,14 +567,14 @@ bool GPRS::connect(Protocol ptl,const char * host, int port, int timeout) {
sim900_send_cmd(num);
sim900_send_cmd("\r\n");
// sprintf(cmd, "AT+CIPSTART=\"UDP\",\"%s\",%d\r\n",host, port);
} else {
// sprintf(cmd, "AT+CIPSTART=\"UDP\",\"%s\",%d\r\n",host, port);
} else {
return false;
}
}
delay(2000);
delay(2000);
//sim900_send_cmd(cmd);
sim900_read_buffer(resp,96,timeout);
sim900_read_buffer(resp,96,timeout);
//Serial.print("Connect resp: "); Serial.println(resp);
if(NULL != strstr(resp,"CONNECT")) { //ALREADY CONNECT or CONNECT OK
@@ -702,7 +584,8 @@ bool GPRS::connect(Protocol ptl,const char * host, int port, int timeout) {
}
//Overload with F() macro to SAVE memory
bool GPRS::connect(Protocol ptl,const __FlashStringHelper *host, const __FlashStringHelper *port, int timeout) {
bool GPRS::connect(Protocol ptl,const __FlashStringHelper *host, const __FlashStringHelper *port, int timeout)
{
//char cmd[64];
char resp[96];
@@ -727,7 +610,8 @@ bool GPRS::connect(Protocol ptl,const __FlashStringHelper *host, const __FlashSt
return false;
}
bool GPRS::is_connected(void) {
bool GPRS::is_connected(void)
{
char resp[96];
sim900_send_cmd("AT+CIPSTATUS\r\n");
sim900_read_buffer(resp,sizeof(resp),DEFAULT_TIMEOUT);
@@ -741,7 +625,8 @@ bool GPRS::is_connected(void) {
}
}
bool GPRS::close() {
bool GPRS::close()
{
// if not connected, return
if (!is_connected()) {
return true;
@@ -749,19 +634,23 @@ bool GPRS::close() {
return sim900_check_with_cmd("AT+CIPCLOSE\r\n", "CLOSE OK\r\n", CMD);
}
int GPRS::readable(void) {
int GPRS::readable(void)
{
return sim900_check_readable();
}
int GPRS::wait_readable(int wait_time) {
int GPRS::wait_readable(int wait_time)
{
return sim900_wait_readable(wait_time);
}
int GPRS::wait_writeable(int req_size) {
int GPRS::wait_writeable(int req_size)
{
return req_size+1;
}
int GPRS::send(const char * str, int len) {
int GPRS::send(const char * str, int len)
{
//char cmd[32];
char num[4];
if(len > 0){
@@ -823,7 +712,8 @@ int GPRS::send(const char * str, int len) {
return strlen(buf);
}
uint32_t GPRS::str_to_ip(const char* str) {
uint32_t GPRS::str_to_ip(const char* str)
{
uint32_t ip = 0;
char* p = (char*)str;
for(int i = 0; i < 4; i++) {
@@ -839,17 +729,20 @@ uint32_t GPRS::str_to_ip(const char* str) {
return ip;
}
char* GPRS::getIPAddress() {
char* GPRS::getIPAddress()
{
//I have already a buffer with ip_string: snprintf(ip_string, sizeof(ip_string), "%d.%d.%d.%d", (_ip>>24)&0xff,(_ip>>16)&0xff,(_ip>>8)&0xff,_ip&0xff);
return ip_string;
}
unsigned long GPRS::getIPnumber() {
unsigned long GPRS::getIPnumber()
{
return _ip;
}
bool GPRS::controlGPIO(uint8_t index, uint8_t level) {
char num[4];
bool GPRS::controlGPIO(uint8_t index, uint8_t level)
{
char num[1];
sim900_send_cmd("AT+SGPIO=0,");
itoa(index, num, 10);

View File

@@ -32,18 +32,6 @@
#ifndef __GPRS_SHIELD_ARDUINO_H__
#define __GPRS_SHIELD_ARDUINO_H__
#define NONE 0
#define SMS 1
#define CALL 2
#define BUSY 3
#define NO_CARRIER 4
#define NO_ANSWER 5
#define ANSWER 6
#define ERR 7
#define CHECK true
#define NO_CHECK false
#include "sim900.h"
/** GPRS class.
@@ -56,8 +44,9 @@ enum Protocol {
UDP = 2,
};
class GPRS {
public:
class GPRS
{
public:
/** Create GPRS instance
*/
@@ -100,7 +89,7 @@ class GPRS {
* false on success
* true on error
*/
bool sendSMS(const char* number, const char* data);
bool sendSMS(char* number, char* data);
/** Check if there is any UNREAD SMS: this function DOESN'T change the UNREAD status of the SMS
* @returns
@@ -122,8 +111,6 @@ class GPRS {
bool readSMS(int messageIndex, char *message, byte length);
byte getEvent(char *message, char *phone, char *datetime, char *gprsBuffer, byte size, bool check = true);
/** get SMS on the fly, phone and date
* @param message buffer used to get SMS message
* @param phone buffer used to get SMS's sender phone number
@@ -133,7 +120,7 @@ class GPRS {
* false on error
*/
bool getSMS(char *message, char *phone, char *datetime, char *gprsBuffer, byte size);
bool getSMS(char *message, char *phone, char *datetime);
/** delete SMS message on SIM card
* @param index the index number which SMS message will be delete
@@ -170,7 +157,7 @@ class GPRS {
* true on success
* false on error
*/
bool ifcallNow(byte timeout = 1);
bool ifcallNow(void);
bool ifcallEnd(void);
@@ -183,7 +170,7 @@ class GPRS {
* true on success
* false on error
*/
bool isCallActive(char *number, char *gprsBuffer);
bool isCallActive(char *number);
/** get DateTime from SIM900 (see AT command: AT+CLTS=1) as string
* @param
@@ -291,7 +278,7 @@ class GPRS {
*/
bool controlGPIO(uint8_t num, uint8_t level);
private:
private:
bool checkSIMStatus(void);
uint8_t _pkPin = 9;

View File

@@ -60,15 +60,15 @@ int sim900_wait_readable (int wait_time)
return dataLen;
}
void sim900_flush_serial() {
while(sim900_check_readable()) {
void sim900_flush_serial()
{
while(sim900_check_readable()){
char c = serialSIM900->read();
}
}
void sim900_read_buffer(char *buffer, int count, unsigned int timeout, unsigned int chartimeout)
{
//Serial.println("Read buff");
int i = 0;
unsigned long timerStart, prevChar;
timerStart = millis();
@@ -76,12 +76,11 @@ void sim900_read_buffer(char *buffer, int count, unsigned int timeout, unsigned
while(1) {
while (sim900_check_readable()) {
char c = serialSIM900->read();
//Serial.print(c);
prevChar = millis();
buffer[i++] = c;
if(i >= count) break;
if(i >= count)break;
}
if(i >= count) break;
if(i >= count)break;
if ((unsigned long) (millis() - timerStart) > timeout * 1000UL) {
break;
}
@@ -94,7 +93,7 @@ void sim900_read_buffer(char *buffer, int count, unsigned int timeout, unsigned
void sim900_clean_buffer(char *buffer, int count)
{
for(int i = 0; i < count; i++) {
for(int i=0; i < count; i++) {
buffer[i] = '\0';
}
}
@@ -150,43 +149,30 @@ boolean sim900_wait_for_resp(const char* resp, DataType type, unsigned int timeo
int len = strlen(resp);
int sum = 0;
unsigned long timerStart, prevChar; //prevChar is the time when the previous Char has been read.
// Serial.println("Wait for resp");
// Serial.println(resp);
// Serial.print("with length: ");
// Serial.println(len);
timerStart = millis();
prevChar = 0;
//Serial.println("Received: ");
while(1) {
if(sim900_check_readable()) {
char c = serialSIM900->read();
//Serial.print(c);
prevChar = millis();
sum = (c==resp[sum]) ? sum+1 : 0;
if(sum == len - 1) {
//Serial.print("BREAK");
break;
}
if(sum == len)break;
}
if ((unsigned long) (millis() - timerStart) > timeout * 1000UL) {
//Serial.println("Timeout");
return false;
}
//If interchar Timeout => return FALSE. So we can return sooner from this function.
if (((unsigned long) (millis() - prevChar) > chartimeout) && (prevChar != 0)) {
//Serial.println("Interchar timeout");
return false;
}
}
//Serial.println("End wait cycle");
//If is a CMD, we will finish to read buffer.
if(type == CMD) sim900_flush_serial();
return true;
}
boolean sim900_check_with_cmd(const char* cmd, const char *resp, DataType type, unsigned int timeout, unsigned int chartimeout)
{
sim900_send_cmd(cmd);

File diff suppressed because it is too large Load Diff

View File

@@ -5,23 +5,18 @@
// ----------------------------------------------------------------------------------------------------
#include <EEPROM.h>
#include <avr/pgmspace.h>
#include "GPRS_Shield_Arduino.h"
#include <TroykaDHT11.h>
//#define INIT
#define MAIN
#include <TroykaDHT.h>
/*
* EEPROM mapping
* 1024 B
* 1024 Kb
* 10 x 16 = 160 - address book | first addr 0
* 16 x 1 = 16 - parameters | first addr 160
* 24 x 16 = 384 - commands | first addr 176
* 4 x 32 = 128 - short strings | first addr 560
* 4 x 64 = 256 - long strings | first addr 688
* -------------
* 944 bytes
* 80 bytes free
* 176 bytes
* 848 bytes free
*/
#define AB_ADDR 0
@@ -32,51 +27,40 @@
#define SMS_ON_INDEX 0
#define AUTH_ON_INDEX 1
#define FWD_ON_INDEX 2
#define EEPROM_INIT_INDEX 15
#define CMD_ADDR 176
#define CMD_MAX_INDEX 23
#define INIT_FLAG 0xAC
#define S_STRING_ADDR 560
#define S_STRING_MAX_INDEX 3
const char cmd_status[] PROGMEM = {"status"};
const char cmd_help[] PROGMEM = {"help"};
const char cmd_sms_on[] PROGMEM = {"sms on"};
const char cmd_sms_off[] PROGMEM = {"sms off"};
const char cmd_on[] PROGMEM = {"on"};
const char cmd_off[] PROGMEM = {"off"};
const char cmd_reset[] PROGMEM = {"reset"};
const char cmd_a[] PROGMEM = {"a"};
const char cmd_b[] PROGMEM = {"b"};
const char cmd_forward[] PROGMEM = {"forward"};
const char cmd_modem_reset[] PROGMEM = {"modem reset"};
const char cmd_modem_console[] PROGMEM = {"modem console"};
const char cmd_edit_ab[] PROGMEM = {"edit ab"};
const char cmd_show_ab[] PROGMEM = {"show ab"};
const char cmd_show[] PROGMEM = {"show"};
const char cmd_clear[] PROGMEM = {"clear"};
const char cmd_exit[] PROGMEM = {"exit"};
const char cmd_auth_on[] PROGMEM = {"auth on"};
const char cmd_auth_off[] PROGMEM = {"auth off"};
const char cmd_fwd_on[] PROGMEM = {"forward on"};
const char cmd_fwd_off[] PROGMEM = {"forward off"};
#define L_STRING_ADDR 688
#define L_STRING_MAX_INDEX 3
#define CMD_INDEX_STATUS 0
#define CMD_INDEX_HELP 1
#define CMD_INDEX_SMS_ON 2
#define CMD_INDEX_SMS_OFF 3
#define CMD_INDEX_ON 4
#define CMD_INDEX_OFF 5
#define CMD_INDEX_RESET 6
#define CMD_INDEX_A 7
#define CMD_INDEX_B 8
#define CMD_INDEX_FORWARD 9
#define CMD_INDEX_10 10
#define CMD_INDEX_MODEM_RESET 11
#define CMD_INDEX_MODEM_CONSOLE 12
#define CMD_INDEX_EDIT_AB 13
#define CMD_INDEX_SHOW_AB 14
#define CMD_INDEX_SHOW 15
#define CMD_INDEX_CLEAR 16
#define CMD_INDEX_EXIT 17
#define CMD_INDEX_AUTH_ON 18
#define CMD_INDEX_AUTH_OFF 19
#define CMD_INDEX_FWD_ON 20
#define CMD_INDEX_FWD_OFF 21
#define CMD_INDEX_22 22
#define CMD_INDEX_23 23
#define S_STRING_INDEX_1 0
#define S_STRING_INDEX_EAB_MODE 1
#define S_STRING_INDEX_MODEM_CONS_ON 2
#define S_STRING_INDEX_MODEM_CONS_OFF 3
#define L_STRING_INDEX_HELP_1 0
#define L_STRING_INDEX_HELP_AB 1
#define L_STRING_INDEX_FORMAT_AB 2
#define L_STRING_INDEX_HELP_2 3
const char str_init_eeprom[] PROGMEM = {"EEPROM init complete"};
const char str_eab[] PROGMEM = {"Edit address book mode"};
const char str_modem_cons_on[] PROGMEM = {"Modem console mode on"};
const char str_modem_cons_off[] PROGMEM = {"Modem console mode off"};
const char str_help[] PROGMEM = {"Usage: help/status/on/off/reset/a/b/modem reset|console/edit ab/show ab/sms on|off/auth on|off/fwd on|off"};
const char str_help_ab[] PROGMEM = {"Type \"show\" to view, \"clear\" to erase, \"exit\" to return"};
const char str_format_ab[] PROGMEM = {"Format: \"i:+xxxxxxxxxxx\" to update or \"i:delete\" to delete"};
// Всякое
#define TIMEOUT 60000
@@ -88,10 +72,10 @@
// Сенсоры
#define A_PIN A0
#define T_PIN A1
#define BAT_T_PIN A2
#define VOUT_PIN A2
#define VBAT_PIN A3
#define VUSB_PIN A4
#define VIN_PIN A5
#define V5_PIN A4
#define V12_PIN A5
#define LED_PIN 13
#define BTN_PIN 12
@@ -108,9 +92,8 @@
#define SMS_SIZE 160
#define PHONE_SIZE 16
#define DATE_SIZE 24
#define SHORT_BUFFER_SIZE 32
#define LONG_BUFFER_SIZE 64
#define VLONG_BUFFER_SIZE 240
#define BUFFER_SIZE 64
#define LONG_BUFFER_SIZE 240
// Флаги статуса
#define TEMP_WARN 0x01
@@ -154,22 +137,15 @@ void printHelp();
void printParams();
bool authOK(char *phone);
void sprint(const char * description, const byte data, const bool ln = true);
void sprint(const char * description, const char * data, const bool ln = true);
void sprint(const char * description, const int data, const bool ln = true);
void sprint(const char * description, const unsigned int data, const bool ln = true);
void sprint(const char * description, const long int data, const bool ln = true);
void sprint(const char * description, const long unsigned int data, const bool ln = true);
void sprint(const char * description, const float data, const bool ln = true);
void sprint(const char * description, const bool ln = true);
// EEPROM utils
bool setCommand(byte index, const char *command);
bool getCommand(byte index, char *command);
bool setShortString(byte index, const char *s_buffer);
bool getShortString(byte index, char *s_buffer);
bool setLongString(byte index, const char *l_buffer);
bool getLongString(byte index, char *l_buffer);
void sprint(const char *description, const byte data, const bool ln = true);
void sprint(const char *description, const char *data, const bool ln = true);
void sprint(const char *description, const int data, const bool ln = true);
void sprint(const char *description, const unsigned int data, const bool ln = true);
void sprint(const char *description, const long int data, const bool ln = true);
void sprint(const char *description, const long unsigned int data, const bool ln = true);
void sprint(const char *description, const float data, const bool ln = true);
void sprint(const char *description, const bool ln = true);
void sprint_P(const char *description, const bool ln = true);
bool smsOn();
void smsOn(bool temp);
@@ -189,3 +165,4 @@ float readvcc();
void getVs();
void printVs();
void getTH();
void initEEPROM();