Perform a Ping test, establish a TCP connection and send a message via an M5Stack device, while also sending and receiving HTTP requests, and display the results of these operations on the screen.
from m5stack import *
from m5ui import *
from uiflow import *
from comx.sim800 import SIM800
setScreenColor(0x222222)
gsm = SIM800()
if gsm.tcp_client(0, '118.190.93.84', 2317, 'Hai M5'):
label5.setText('Success')
else:
label5.setText('Unsuccess')
gsm.http_destroy()
label3.setText(str(gsm.http_services(1, 'http://header.json-json.com/', 'application/x-www-form-urlencoded', 'hai m5')))
label3.setText(str(gsm.http_services(0, 'http://api.m5stack.com/v1', 'application/json', ''))) gsm.get_gprs_network_registration() gsm.check_gprs_service() gsm.get_network_registration() gsm.get_single_quality() gsm.check_status() gsm.get_CCID() gsm.get_IMEI() gsm.http_destroy() gsm.http_services(0, '', 'application/json', '') gsm.ping_request('') gsm.set_command_echo_mode(0) 0 disables echoing, 1 enables echoing. When set to OFF, the device will not echo back the command characters after sending AT commands.gsm.PDP_address(1) gsm.set_PDP_context_status(1) gsm.http_services(0, '', 'application/json', '')