Base64 encoding/decoding of socket sent/received data - #BASE. Multitech MTSMC-LSP3 , MTSMC-LSP3-U, MTSMC-LSP3-SP, MTSMC-LSP3-U-SP, MTCAP-LSP3-915-041A, MTCM-LSP3-B03-KIT
Реклама
Реклама
#SD - Socket Dial
AT#SD=1,0,80,”www.google.com”,0,0,0
CONNECT
…
Open socket 1 in command mode
AT#SD=1,0,80,”www.google.com”,0,0,1
OK
AT Commands Reference Guide
8s0490ST10778A Rev.4– 2018-04-12
Base64 encoding/decoding of socket sent/received data - #BASE64
#BASE64 – Base64 encoding/decoding of socket sent/received data
AT#BASE64=
<connId>,<enc>,<dec
>
[,<unused_B >
[,<unused_C >]]
Set command enables base64 encoding and/or decoding of data sent/received to/from the socket in online or in command mode.
Parameters:
<connId>
- socket connection identifier
1..6
<enc>
0
– no encoding of data received from serial port.
1
- MIME RFC2045 base64 encoding of data received from serial port that have to be sent to <connId> socket.
Note:
as indicated from RFC2045 the encoded output stream is represented in lines of no more than 76 characters each.
Lines are defined as sequences of octets separated by a CRLF sequence.
2
- RFC 3548 base64 encoding of data received from serial port that have to be sent to <connId> socket.
Note:
as indicated from RFC3548 CRLF have not to be added.
<dec>
0
– no decoding of data received from socket <connId>.
1
- MIME RFC2045 base64 decoding of data received from socket <connId> and sent to serial port.
(Same rule as for <enc> regarding line feeds in the received file that has to be decoded)
2
- RFC3548 base64 decoding of data received from socket
<connId>
and sent to serial port.
(Same rule as for <enc> regarding line feeds in the received file that has to be decoded)
Reproduction forbidden without Telit Communications S.p.A. written authorization - All Rights Reserved page 316 of 491
AT Commands Reference Guide
8s0490ST10778A Rev.4– 2018-04-12
#BASE64 – Base64 encoding/decoding of socket sent/received data
Note:
it is possible to use command to change current <enc>/<dec> settings for a socket already opened in command mode or in online mode after suspending it.
(In this last case obviously it is necessary to set AT#SKIPESC=1).
AT#BASE64?
AT#BASE64=?
Example
Note:
to use #BASE64 in command mode, if data to send exceed maximum value for #SSENDEXT command, they have to be divided in multiple parts.
These parts have to be a multiple of 57 bytes, except for the last one, to distinguish
EOF condition.
(Base64 encoding rules)
For the same reason if #SRECV command is used by the application to receive data, a multiple of 78 bytes has to be considered.
Note:
to use #SRECV to receive data with <dec> enabled, it is necessary to consider that: reading <maxByte> bytes from socket, user will get less due to decoding that is performed.
Note:
values are automatically saved in NVM.
Read command returns the current <enc>/<dec> settings for all the six sockets, in the format:
#BASE64:<connId1><enc1>,<dec1>,0,0<CR><LF>
. . .
#BASE64:<connId6>,<enc6>,<dec6>,0,0<CR><LF>
Test command returns the range of supported values for all the sub parameters.
AT#SKIPESC=1
OK
AT#SD=<connId>,<txProt>,<rPort>,<IPaddr>
CONNECT
//Data sent without modifications(default)
………
+++ (suspension)
OK at#base64=<connId>,1,0
OK
AT#SO=<connId>
CONNECT
// Data received from serial port are encoded
// base64 before to be sent on the socket
………………
+++ (suspension)
Reproduction forbidden without Telit Communications S.p.A. written authorization - All Rights Reserved page 317 of 491
Изтегляне
Реклама