-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
875 additions
and
1 deletion.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#ifndef EC20xlib_h | ||
#define EC20xlib_h | ||
|
||
#include <Arduino.h> | ||
|
||
#define DEBUG | ||
#ifdef DEBUG | ||
#define log(msg) Serial.print(msg) | ||
#define logln(msg) Serial.println(msg) | ||
#else | ||
#define log(msg) | ||
#define logln(msg) | ||
#endif | ||
|
||
#define countof(a) (sizeof(a) / sizeof(a[0])) | ||
|
||
#define EC20x_OK 0 | ||
#define EC20x_NOTOK 1 | ||
#define EC20x_TIMEOUT 2 | ||
#define EC20x_FAILURE 3 | ||
#define EC20x_DISCONNECT 4 | ||
|
||
#define EC20x_CMD_TIMEOUT 2000 | ||
|
||
//#define EC20xconn Serial2 | ||
|
||
class EC20xlib { | ||
public: | ||
EC20xlib(Stream &serial); | ||
~EC20xlib(); | ||
|
||
byte begin(); | ||
byte blockUntilReady(long baudRate); | ||
|
||
void powerCycle(int pin); | ||
void powerOn(int pin); | ||
void powerOff(int pin); | ||
|
||
int getSignalStrength(); | ||
String getRealTimeClock(); | ||
|
||
byte connectMqttServer(char *clientID,char *ip,char *port,char *username,char *password); | ||
byte SubTopic(char *topic,uint8_t qos1); | ||
byte PubTopic(char *topic,char* msg,uint8_t qos1); | ||
byte UnSubTopic(char *topic,uint8_t qos1); | ||
byte getMessage(char *topic,char* msg,uint8_t qos1); | ||
byte Read_CCID(char *DataBuf); | ||
byte Read_IMEI(char *DataBuf); | ||
private: | ||
Stream* EC20xconn; | ||
String read(); | ||
byte EC20xcommand(const char *command, const char *resp1, const char *resp2, int timeout, int repetitions, String *response); | ||
byte EC20xwaitFor(const char *resp1, const char *resp2, int timeout, String *response); | ||
long detectRate(); | ||
char setRate(long baudRate); | ||
}; | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2016 Stavros Korokithakis | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
# EC20x_lib | ||
# EC20x_lib | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
####################################### | ||
# A6 GSM communication module | ||
# (esp8266) | ||
####################################### | ||
|
||
####################################### | ||
# Datatypes (KEYWORD1) | ||
####################################### | ||
|
||
EC20xlib KEYWORD1 | ||
callInfo KEYWORD1 | ||
|
||
####################################### | ||
# Methods and Functions (KEYWORD2) | ||
####################################### | ||
|
||
begin KEYWORD2 | ||
powerCycle KEYWORD2 | ||
|
||
dial KEYWORD2 | ||
redial KEYWORD2 | ||
hangUp KEYWORD2 | ||
checkCallStatus KEYWORD2 | ||
getSignalStrength KEYWORD2 | ||
|
||
sendSMS KEYWORD2 | ||
|
||
setVol KEYWORD2 | ||
enableSpeaker KEYWORD2 | ||
|
||
EC20xconn KEYWORD2 | ||
|
||
####################################### | ||
# Constants (LITERAL1) | ||
####################################### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "EC20xlib", | ||
"keywords": [ | ||
"EC20", "GSM", "CAT1", "mobile" | ||
], | ||
"description": "An ESP8266/Arduino library for communicating with the EC20 cat1 module.", | ||
"repository": | ||
{ | ||
"type": "git", | ||
"url": "https://github.com/luyang14/EC20x_lib.git" | ||
}, | ||
"frameworks": "arduino", | ||
"platforms": "*" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
name=EC20xlib | ||
version=0.1.0 | ||
author=Stavros Korokithakis | ||
maintainer=iotts | ||
sentence=An ESP8266/ESP32/Arduino library for communicating with the EC20 CAT1 module. | ||
paragraph= | ||
category=Communication | ||
url=https://github.com/luyang14/EC20x_lib.git | ||
architectures=* |
Oops, something went wrong.