# SMS-4G-GNSS-GPS COMMUNICATION

> Source: https://maker.tdlogy.com/wiki-doc/quecpython-eg800k-eg800ak-instructions-sms-4g-gnss-gps-communication-protocols/

This document guides the use of QuecPython's standard modules to implement three common communication protocols on the Quectel EG800K module and EG800AK: sending SMS, establishing a 4G data connection (PDP Context/Data Call), and reading the built-in GNSS/GPS positioning data in the module. Each section includes: the relevant API, the logical flow, and the actual demo code with a GitHub link.

## 1. SMS Protocol

### 1.1. Overview

QuecPython provides a module for sending/receiving/deleting SMS messages in two modes: TEXT (simple, no encoding required) and PDU (more complex but more widely compatible). In most IoT applications—alerts, device control via SMS—TEXT mode is sufficient.sms

### 1.2. Related QuecPython APIs

sim.getStatus()

Check the SIM status before interacting with the network/SMS.

Return ValueMeaning1SIM ready0No SIM/Unrecognized SIM-1API call errorOthersSee the full code sheet in the API reference (PIN/PUK locked SIM, initializing, etc.)

checkNet.waitNetworkReady(timeout)

Wait for the network registration module and activate the PDP context successfully, do it sequentially: check the SIM → register the network → activate the PDP context.

sms.sendTextMsg(phoneNumber, msg, codeMode)

Send an SMS message in TEXT mode (empty content is not supported).

ParameterTypeDescriptionphoneNumberStringRecipient phone number, up to 20 bytesmsgStringMessage content, up to 140 bytes for a single newsletter (excess will automatically split into multiple newsletters on supported module lines)codeModeString'GSM' — 7-bit GSM encryption, for English SMS; — used for SMS with Vietnamese/Chinese accents'UCS2'

Returns on successful submission, when failed.0-1

### 1.3. Processing sequence (logical flow)

### 1.4. Demo Code

Source: TEST_EG_800AK_SMS.py

### 1.5. Notes when deploying

## 2. 4G Protocol (Data Call / PDP Context)

### 2.1. Overview

Establishing a mobile data connection on QuecPython is actually the process of activating PDP Context — the module registers with the network, then the carrier's gateway grants an IP address to the module for Internet communication (HTTP, MQTT, socket, etc.). Three modules coordinate in this process: (SIM), (network registration, signal), (configuration and activation of PDP context).simnetdataCall

### 2.2. Related QuecPython APIs

sim.getStatus() — as described in the SMS section.

net.getState()

Get the current network registration information.

net.csqQueryPoll()

Take the signal strength (CSQ), a scale of 0–31 (the higher the value, the stronger), which is error/unknown.99

net.operatorName()

Returns tuple—the full name, initials, country code, and network code of the carrier currently registered.(long_eons, short_eons, mcc, mnc)

dataCall.setPDPContext(profileID, ipType, apn, username, password, authType)

Configure the APN for a PDP context, save in the event of a power failure.

ParameterDescriptionprofileIDContext ID, commonly used, range 1–31ipType0 =IPv4,=IPv6,=both12apnName of access point by carrier (e.g. Mobifone, Viettel m-wapv-internet)username, passwordUsually leave it empty if the carrier doesn't ask for it''authType0 =None,=PAP,=CHAP,=both123

Return success, failure.0-1

dataCall.start(profileID, ipType) (equivalent in standard API)dataCall.activate(profileID)

Enable the configured PDP context. Note: by default, the module automatically activates context 1 at startup, so this step is only really necessary when auto-activate is disabled or you want to actively re-activate.

dataCall.getInfo(profileID, ipType)

Get data channel setup information.

### 2.3. Processing sequence (logical flow)

### 2.4. Demo Code

Source: test_4g.py

### 2.5. Notes when deploying

## 3. GNSS/GPS Protocol

### 3.1. Overview

The EG800K/EG800AK (built-in GNSS support series) uses a module to control the built-in GNSS engine and read raw NMEA sentence format positioning data via internal UART. The application needs to parse NMEA sentences (GGA, RMC...) to get the coordinates, instead of getting the processed data ready.quecgnss

### 3.2. Related QuecPython APIs

quecgnss.init()

Initialize the built-in GNSS feature (power on the GNSS engine, open the data reading stream). Return success, failure.0-1

quecgnss.read(size)

Read the existing GNSS positioning data in the buffer.

quecgnss.configSet(config_type, config_value) (optional, pre-recommended init())

Satellite system configuration, NMEA output fishing type, AGPS, and backup battery power for GNSS. For example, choose GPS + BeiDou, turn on AGPS to shorten the time to catch the signal for the first time (TTFF).configSet(0, 1)configSet(2, 1)

### 3.3. NMEA Sentence Structure $GNGGA/$GPGGA

The GGA (Global Positioning System Fix Data) sentence contains core positioning information, structuring important fields:

Field (ordinary, separated by comma)Meaning1UTC Time (hhmmss.sss)2Latitude (ddmm.mmmm)3Latitude Direction: N/S4Longitude (dddmm.mmmm)5Longitude Direction: E/W6Status fix:=invalid,=GPS fix,=DGPS fix0127Number of satellites in use8HDOP (horizontal precision)

Field 6 () is a mandatory condition to check before believing in a coordinate value — if it is equal to (or empty), the readable coordinates are not meaningful because the module has not yet captured the satellite.fix status0

### 3.4. Processing sequence (logical flow)

### 3.5. Demo Code

Source: test_gnss.py

### 3.6. Notes when deploying

## References