Skip to content

Commit

Permalink
Merge pull request #5 from AIS-DeviceInnovation/compatibleWithBC95G
Browse files Browse the repository at this point in the history
Fully compatible with DEVIO NB-SHIELD I Plus
  • Loading branch information
AIS-DeviceInnovation authored Aug 22, 2022
2 parents 9f55dba + a08901c commit 4aeabc6
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 31 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
![Library Version](https://img.shields.io/badge/Version-1.1.2-green)
![Library Version](https://img.shields.io/badge/Version-2.0.0-green)

# AIS Library

## AIS BC95
AIS BC95 PI Library, used on arduino, have been developed for
## AIS BC95-B8 & BC95-G
AIS BC95 API Library, used on arduino, have been developed for
any platform. This library include API such as UDP.
### Example for use the AIS BC95 API
#### Call the AIS BC95 API library:
Expand Down
4 changes: 2 additions & 2 deletions library.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Magellan_BC95",
"frameworks": "Arduino",
"keywords": "AIS, NB-IoT, BC95, Magellan, Quectel",
"keywords": "AIS, NB-IoT, BC95, Magellan, Quectel, BC95-G, BC95-B8",
"description": "Arduino Library for AIS Magellan",
"url": "https://github.com/AIS-DeviceInnovation/Magellan_BC95",
"authors":
Expand All @@ -14,6 +14,6 @@
"type": "git",
"url": "https://github.com/AIS-DeviceInnovation/Magellan_BC95.git"
},
"version": "1.1.2",
"version": "2.0.0",
"platforms": "*"
}
6 changes: 3 additions & 3 deletions library.properties
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name=Magellan_BC95
version=1.1.2
version=2.0.0
author=AIS IoT Alliance Program
maintainer= AIS IoT Alliance Program <aiap@ais.co.th>
sentence= AIS Magellan Library; easy way to integrate IoT Device to Magellan using Arduino Platform.
paragraph= Fully compatible with DEVIO NB-SHIELD I plus.
paragraph= Fully compatible with DEVIO NB-SHIELD I Plus.
category=Cellular Communication
url= https://github.com/AIS-DeviceInnovation/Magellan_BC95
architectures=*
includes=AT_BC95.h,AltSoftSerial.h
includes=AT_BC95.h,AltSoftSerial.h
4 changes: 2 additions & 2 deletions src/AIS_BC95_API.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
AIS_BC95_API v1.1.2 NB-IoT.
support Quectel BC95
AIS_BC95_API v2.0.0 NB-IoT.
support Quectel BC95-B8 & BC95-G
NB-IoT with AT command
Author: Device Innovation team
Expand Down
4 changes: 2 additions & 2 deletions src/AIS_BC95_API.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
AIS_BC95_API v1.1.2 NB-IoT.
support Quectel BC95
AIS_BC95_API v2.0.0 NB-IoT.
support Quectel BC95-B8 & BC95-G
NB-IoT with AT command
Author: Device Innovation team
Expand Down
58 changes: 49 additions & 9 deletions src/AT_BC95.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
AT Command Dictionary for Quectel BC95 version 1.1.2
support Quectel BC95
AT Command Dictionary for Quectel BC95 & BC95-G version 2.0.0
support Quectel BC95-B8 & BC95-G
NB-IoT with AT command
Author: Device Innovation team
Create Date: 8 February 2021.
Modified: 31 May 2021.
Modified: 14 June 2021.
*/
#include "AT_BC95.h"
#include "board.h"
Expand Down Expand Up @@ -85,6 +85,10 @@ void AT_BC95::setupModule(String address,String port){
if(debug)Serial.print(F(">>FW ver : "));
if(debug)Serial.println(getFirmwareVersion());

if(debug)Serial.print(F(">>Module BC95 : "));
bc95 = isBC95();
if(debug)Serial.println(bc95);

delay(800);
_serial_flush();
Serial.print(F(">>Connecting "));
Expand Down Expand Up @@ -259,8 +263,14 @@ void AT_BC95::connectNetwork(){
bool AT_BC95::createUDPSocket(String address,String port){
bool status=false;

_Serial->print(F("AT+NSOCR=DGRAM,17,"));
_Serial->println(port+",1");
if(bc95){
_Serial->print(F("AT+NSOCR=DGRAM,17,"));
_Serial->println(port+",1");

}
else{
_Serial->println(F("AT+NSOCR=DGRAM,17,0"));
}

delay(500);
while(1){
Expand All @@ -270,8 +280,13 @@ bool AT_BC95::createUDPSocket(String address,String port){
status=true;
break;
}else if(data_input.indexOf(F("+CME ERROR: 4"))!=-1){
_Serial->print(F("AT+NSOCR=DGRAM,17,"));
_Serial->println(port+",1");
if(bc95){
_Serial->print(F("AT+NSOCR=DGRAM,17,"));
_Serial->println(port+",1");
}
else{
_Serial->println(F("AT+NSOCR=DGRAM,17,0"));
}
}
Serial.print(F("."));
}
Expand Down Expand Up @@ -607,7 +622,12 @@ void AT_BC95::blankChk(String& val){
// Send AT command to send UDP message
void AT_BC95::_Serial_print(String address,String port,unsigned int len){

_Serial->print(F("AT+NSOST=0"));
if(bc95){
_Serial->print(F("AT+NSOST=0"));
}
else{
_Serial->print(F("AT+NSOST=1"));
}
_Serial->print(F(","));
_Serial->print(address);
_Serial->print(F(","));
Expand Down Expand Up @@ -645,7 +665,12 @@ void AT_BC95::_Serial_println(){
void AT_BC95::waitResponse(String &retdata,String server){
unsigned long current=millis();
if((current-previous>=500) && !(_Serial->available())){
_Serial->println(F("AT+NSORF=0,512"));
if(bc95) {
_Serial->println(F("AT+NSORF=0,512"));
}
else{
_Serial->println(F("AT+NSORF=1,512"));
}
previous=current;
}

Expand Down Expand Up @@ -831,3 +856,18 @@ void AT_BC95::reset(){
delay(500);
__asm__ __volatile__ ("jmp 0x0000");
}

bool AT_BC95::isBC95(){
_Serial->println(F("AT+CGMM"));
while(1){
if(_Serial->available()){
data_input=_Serial->readStringUntil('\n');
if(data_input.indexOf(F("OK"))!=-1) break;
else{
if(data_input.indexOf(F("BC95GJB-02-STD"))!=-1) return false;
else if(data_input.indexOf(F("BC95HB-02-STD_900"))!=-1) return true;
}
}
}
return false;
}
7 changes: 4 additions & 3 deletions src/AT_BC95.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
AT Command Dictionary for Quectel BC95 version 1.1.2
support Quectel BC95
AT Command Dictionary for Quectel BC95 version 2.0.0
support Quectel BC95-B8 & BC95-G
NB-IoT with AT command
Author: Device Innovation team
Create Date: 2 January 2020.
Modified: 31 May 2021.
Modified: 14 June 2021.
*/

#include <Arduino.h>
Expand Down Expand Up @@ -126,6 +126,7 @@ class AT_BC95{
void manageResponse(String &retdata,String server);
void at_getBuffer(String socket,String nBuffer);
void blankChk(String& val);
bool isBC95();

protected:
Stream *_Serial;
Expand Down
8 changes: 4 additions & 4 deletions src/Magellan_BC95.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Magellan_BC95 v1.1.2 NB-IoT Magellan Platform .
support Quectel BC95
Magellan_BC95 v2.0.0 NB-IoT Magellan Platform .
support Quectel BC95-B8 & BC95-G
NB-IoT with AT command
Library/SDK has developed with CoAP protocol.
Expand All @@ -42,7 +42,7 @@ and supported only Magellan IoT Platform
Author: Device Innovation team
Create Date: 3 February 2020.
Modified: 31 May 2021.
Modified: 14 June 2021.
Released for private usage.
*/
Expand Down Expand Up @@ -313,7 +313,7 @@ bool Magellan_BC95::begin(){
token_error_report=true;
token_error_config=true;
Serial.println();
Serial.println(F(" AIS NB-IoT Magellan_BC95 V1.1.2"));
Serial.println(F(" AIS NB-IoT Magellan_BC95 V2.0.0"));

atBC95.setupModule(serverIP,port);

Expand Down
6 changes: 3 additions & 3 deletions src/Magellan_BC95.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Magellan_BC95 v1.1.2 NB-IoT Magellan Platform .
support Quectel BC95
Magellan_BC95 v2.0.0 NB-IoT Magellan Platform .
support Quectel BC95-B8 & BC95-G
NB-IoT with AT command
Library/SDK has developed with CoAP protocol.
Expand All @@ -42,7 +42,7 @@ and supported only Magellan IoT Platform
Author: Device Innovation team
Create Date: 8 February 2021.
Modified: 31 May 2021.
Modified: 14 June 2021.
Released for private usage.
*/
Expand Down

0 comments on commit 4aeabc6

Please sign in to comment.