Skip to content

Commit 517c3db

Browse files
陈志和陈志和
authored andcommitted
增加网络重连尝试
1 parent 07a94e7 commit 517c3db

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

code/_main.py renamed to code/main.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,23 @@ def create_app(name="SimpliKit", version="1.0.0", config_path="/usr/config.json"
2626

2727

2828
if __name__ == "__main__":
29+
ret=dataCall.setPDPContext(1, 0, 'BICSAPN', '', '', 0) # 激活之前,应该先配置APN,这里配置第1路的APN
30+
ret2=dataCall.activate(1)#0为成功,-1失败
31+
32+
while ret and ret2:
33+
ret=dataCall.setPDPContext(1, 0, 'BICSAPN', '', '', 0)
34+
ret2=dataCall.activate(1)
35+
if not ret and not ret2:
36+
print("Net injection success")
37+
break
38+
2939
while True:
3040
lte = dataCall.getInfo(1, 0)
3141
if lte[2][0] == 1:
3242
logger.debug('lte network normal')
3343
break
3444
logger.debug('wait lte network normal...')
3545
utime.sleep(3)
36-
37-
dataCall.setPDPContext(1, 0, 'BICSAPN', '', '', 0) # 激活之前,应该先配置APN,这里配置第1路的APN
38-
dataCall.activate(1)
3946

4047
app = create_app()
4148
app.run()

0 commit comments

Comments
 (0)