Annex
CoAP
Method Codes
Response Codes
79
NB-IoT
Source Code for NB-IoT using BC66
void
modem_init();
void
sendData(
char
sensor,
int
val);
#define MODEM Serial1
uint8_t ATflag=
0
;
int
i=
0
;
char
ATCheck[
50
];
void
setup()
{
Serial.begin(
9600
);
MODEM.begin(
9600
);
delay(
2000
);
Serial.write(
"\r\nPress RESET Button on Modem"
);
delay(
5000
);
Serial.write(
"\r\nInitializing Modem"
);
modem_init();
Serial.write(
"\r\nModem Initialized"
);
delay(
2000
);
}
void
loop()
{
if
(Serial.available())
{
// If anything comes in Serial (USB),
MODEM.write(Serial.read());
// read it and send it out MODEM (pins 0 &
1)
}
if
(MODEM.available())
{
// If anything comes in MODEM (pins 0 & 1)
Serial.write(MODEM.read());
// read it and send it out Serial (USB)
}
}
void
modem_init()
{
/*AT Command*/
Serial.write(
"\r\nAT Polling"
);
80
while
(ATflag==
0
)
{
delay(
1000
);
MODEM.println(
"AT"
);
MODEM.flush();
delay(
2000
);
while
(MODEM.available()>
0
)
{
char
printChar = MODEM.read();
Serial.write(printChar);
if
(printChar ==
'+'
)
{
ATflag=
1
;
}
}
}
Serial.write(
"\r\nAT Polling Finished"
);
ATflag =
0
;
/*-------------------------------------AT Command finished------------------
--------------------*/
/*------------------Setting-up the PDN Context------------------------------*/
Serial.write(
"\r\nSetting-up the PDN Context"
);
while
(ATflag==
0
)
{
delay(
1000
);
MODEM.println(
"AT+QGACT=1,1,\"u.iot.mt.gr.hu\""
);
MODEM.flush();
delay(
4000
);
while
(MODEM.available()>
0
)
{
char
printChar = MODEM.read();
Serial.write(printChar);
if
(printChar ==
'K'
)
{
ATflag =
1
;
}
}
}
ATflag =
0
;
/*------------END Setting-up the PDN Context------------------------------*/
/*------------------Setting-up the REST API ------------------------------*/
81
Serial.write(
"\r\nSetting-up the REST API\r\n"
);
while
(ATflag==
0
)
{
delay(
1000
);
MODEM.println(
"AT+QIOPEN=1,0,\"UDP\",\"165.227.145.200\",41243,0,1"
);
MODEM.flush();
delay(
4000
);
while
(MODEM.available()>
0
)
{
char
printChar = MODEM.read();
Serial.write(printChar);
if
(printChar ==
'K'
)
{
ATflag =
1
;
}
}
}
ATflag =
0
;
/*---------------END Setting-up the REST API ------------------------------*/
/*----------------------Disabling Sleep Mode ------------------------------*/
Serial.write(
"\r\nDisabling Sleep Mode\r\n"
);
while
(ATflag==
0
)
{
delay(
1000
);
MODEM.println(
"AT+QSCLK=0"
);
MODEM.flush();
delay(
4000
);
while
(MODEM.available()>
0
)
{
char
printChar = MODEM.read();
Serial.write(printChar);
if
(printChar ==
'K'
)
{
ATflag =
1
;
}
}
}
ATflag =
0
;
/*----------------END Disabling Sleep Mode ------------------------------*/
Serial.write(
"\r\nSending the first data\r\n"
);
82
while
(ATflag==
0
)
{
delay(
1000
);
MODEM.println(
"AT+QISEND=0,18,Client Initialized"
);
MODEM.flush();
delay(
4000
);
while
(MODEM.available()>
0
)
{
char
printChar = MODEM.read();
Serial.write(printChar);
if
(printChar ==
'K'
)
{
ATflag =
1
;
}
}
}
ATflag =
0
;
}
Document Outline - Summary
- 1 Introduction
- 1.1 What is Internet-of-Things?
- 1.2 Internet of Things: Projected Growth
- 1.3 Internet of Things: Device Management
- 1.4 The Problem
- 1.5 Objectives of Thesis
- 1.5.1 In-depth study and presentation of the OMA LWM2M standard
- 1.5.2 Study and analysis of IPSO object model, CoAP
- 1.5.3 Study, analysis and implementation of NB-IoT based communication
- 1.5.4 Integration of IPSO, LWM2M, CoAP, DTLS, AT Commands Driver into a protocol stack
- 1.5.5 Automated code generation (E.g. XML to C/C++)
- 1.5.6 Implementation of automatic software deployment on SoC
- 1.5.7 Implement end-to-end testing with a LWM2M server
- 1.6 Summary: The Complete Architecture of the System
- 2 Literature Review
- 2.1 Low-power Wide-area Networks
- 2.2 Narrow-Band IoT (NB-IoT)
- 2.2.1 Overview
- 2.2.2 NB-IoT Deployment
- In-Band Deployment
- Guard-band Deployment
- Standalone Deployment
- 2.2.3 NB-IoT Applications
- 2.2.4 Role of NB-IoT in the Thesis
- 2.3 IPSO Smart Objects
- 2.3.1 Representation of the IPSO Object
- 2.3.2 IPSO Object: Example of Temperature Sensor
- 2.3.3 Composite Objects
- 2.3.4 Role of IPSO in the Thesis
- 2.4 Constrained Application Protocol (CoAP)
- 2.4.1 Messaging Model of CoAP
- 2.4.2 CoAP Message Format
- 2.4.3 Security in CoAP
- 2.4.4 CoAP v/s HTTP
- 2.5 Datagram Transport Layer Security (DTLS)
- 2.5.1 Transport Layer Security (TLS)
- 2.5.2 DTLS Overview
- 2.5.3 Epoch
- 2.5.4 Sequence Number
- 2.5.5 DTLS Handshake [24]
- Stateless cookie exchange for DoS attack prevention
- Handshake message fragmentation and re-assembly
- 2.5.6 Timeout and Retransmission
- 2.5.7 DTLS: Role in Thesis
- 2.6 Light-weight Machine-to-Machine Protocol (LWM2M)
- 2.6.1 Architecture and Protocol Stack
- 2.6.2 Interfaces
- Bootstrap
- Device Discovery and Registration
- Device Management and Service Enablement
- Information Reporting
- 2.6.3 LWM2M: Role in Thesis
- 3 Implementation, Testing and Results
- 3.1 NB-IoT based Communication
- 3.1.1 NB-IoT implementation without on-board Modem (Arduino Mega + BC66)
- 3.1.2 NB-IoT implementation with on-board Modem (SODAQ SARA)
- 3.2 Automated Code Generation
- 3.3 Stack integration: adding the DTLS support
- 3.3.1 Role of UNIX libraries in Eclipse tinydtls and their Resolution
- 3.3.2 Session API (tinydtls/session.c, tinydtls/session.h)
- 3.3.3 DTLS Connections API (dtlsconnection.c, dtlsconnection.h)
- 3.3.4 Integration to Wakaama and other changes
- 3.3.5 Results
- 3.4 End-to-end Testing
- 4 Conclusion
- 5 Future Work
- Acknowledgements
- References
- Annex
Do'stlaringiz bilan baham: |