SeeedJP / WioLTEforArduino

GNU General Public License v2.0
33 stars 19 forks source link

GetTime()でエラーになる #3

Closed KazuyukiEguchi closed 6 years ago

KazuyukiEguchi commented 6 years ago

『AT+CCLK?』戻り値のフォーマットは、

“yy/MM/dd,hh:mm:ss±zz”

であるが、

“yy/MM/dd,hh:mm:ss”

が戻ってくることを前提にWioLTE.cppが記述されている。

下記のように修正したところ、エラーが発生しなく、日時を取得することができた。

// if (strlen(parameter) != 19) return RET_ERR(false);
if (strlen(parameter) != 22) return RET_ERR(false);
if (parameter[0] != '"') return RET_ERR(false);
if (parameter[3] != '/') return RET_ERR(false);
if (parameter[6] != '/') return RET_ERR(false);
if (parameter[9] != ',') return RET_ERR(false);
if (parameter[12] != ':') return RET_ERR(false);
if (parameter[15] != ':') return RET_ERR(false);
// if (parameter[18] != '"') return RET_ERR(false);
if (parameter[21] != '"') return RET_ERR(false);
matsujirushi commented 6 years ago
■SORACOM Air DATA-SIM with SMS

### Sync time.
<- AT+QNTP=1,"ntp.nict.jp"
-> (+CPIN: READY)
-> (+QUSIM: 1)
-> (+QIND: SMS DONE)
-> (+QIND: PB DONE)
-> OK
-> +QNTP: 0,"2017/10/30,10:25:44"
### Get time.
<- AT+CCLK?
-> +CCLK: "17/10/30,10:25:44+00"
-> OK
### ERROR! ###

■SORACOM Air DATA-SIM without SMS

### Sync time.
<- AT+QNTP=1,"ntp.nict.jp"
-> (+CPIN: READY)
-> (+QUSIM: 1)
-> (+QIND: SMS DONE)
-> (+QIND: PB DONE)
-> OK
-> +QNTP: 0,"2017/10/30,10:27:39"
### Get time.
<- AT+CCLK?
-> +CCLK: "17/10/30,10:27:39+00"
-> OK
### ERROR! ###

■IIJmio

### Sync time.
<- AT+QNTP=1,"ntp.nict.jp"
-> (+CPIN: READY)
-> (+QUSIM: 1)
-> (+QIND: SMS DONE)
-> (+QIND: PB DONE)
-> OK
-> +QNTP: 561
### Get time.
<- AT+CCLK?
-> +CCLK: "17/10/30,10:29:33+00"
-> OK
### ERROR! ###

"17/10/30,10:27:39+00"
matsujirushi commented 6 years ago

KazuyukiEguchiさん、どうもありがとうございました!

https://github.com/SeeedJP/WioLTEforArduino/commit/947fc3b6b48b76476b4236710b5502944627bc9b