From 098a07e0a4c04f4dd87ecb87236729aa8acc76fb Mon Sep 17 00:00:00 2001 From: Sam Machin Date: Fri, 14 Sep 2018 08:00:41 +0100 Subject: [PATCH] Update sim800.py Few more tweaks to GPRS handling after real world testing with an app --- lib/sim800.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/sim800.py b/lib/sim800.py index 8db26f5..cb5c53a 100644 --- a/lib/sim800.py +++ b/lib/sim800.py @@ -866,8 +866,16 @@ def connect_gprs(apn): command("AT+CIICR", response_timeout=10000) command("AT+CIFSR") -def start_server(port): - command("AT+CIPSERVER=1,"+port, response_timeout=10000) +def stop_gprs(): + command("AT+CIPSHUT", response_timeout=60000, custom_endofdata="SHUT OK") + +def start_server(port, callback): + global server_callback + server_callback = callback + command("AT+CIPSERVER=1,"+str(port), response_timeout=10000) + +def stop_server(): + command("AT+CIPSERVER=0", response_timeout=10000) # Startup...