Skip to content

Commit

Permalink
init repo
Browse files Browse the repository at this point in the history
  • Loading branch information
luyang14 committed Jul 5, 2021
1 parent 7fb4107 commit 1ae1c39
Show file tree
Hide file tree
Showing 8 changed files with 875 additions and 1 deletion.
475 changes: 475 additions & 0 deletions EC20xlib.cpp

Large diffs are not rendered by default.

57 changes: 57 additions & 0 deletions EC20xlib.h
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
21 changes: 21 additions & 0 deletions LICENSE.md
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.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# EC20x_lib
# EC20x_lib

35 changes: 35 additions & 0 deletions keywords.txt
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)
#######################################
14 changes: 14 additions & 0 deletions library.json
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": "*"
}
9 changes: 9 additions & 0 deletions library.properties
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=*
Loading

0 comments on commit 1ae1c39

Please sign in to comment.