当前位置:网站首页>Haas506 2.0 development tutorial - Advanced Component Library -modem Net (only supports versions above 2.2)

Haas506 2.0 development tutorial - Advanced Component Library -modem Net (only supports versions above 2.2)

2022-06-23 06:37:00 Zhiyunfu

haas506 2.0 Development tutorial - Advanced component library -modem.net

1. obtain net Information

Case description :

  • The development board networking needs to be inserted SIM card
  • Use in this case net The module obtains the signal strength , near CELL Information, etc .

main.py

# -*- coding: UTF-8 -*-
from modem import net
import utime as time


print("-----------start net test----------")
time.sleep_ms(3000)
print("methods in net:",dir(net))
print(" Set the working mode :",net.setModem(0))
print(" Signal strength :",net.getCsq())
print(" Get proximity  CELL  Information about :",net.getCellInfo())
print(" Get working mode :",net.getModem())
print(" Get the current network mode :",net.getMode())
print("------------end net test------------")

Log output

-----------start net test----------
methods in net: ['__class__', '__name__', '__bases__', '__dict__', 'checkNet', 'dataCall', 'csqQueryPoll', 'getCsq', 'getCellInfo', 'getMode', 'getModem', 'setModem']
 Set the working mode : 0
 Signal strength : 31
 Get proximity  CELL  Information about :([], [], [(0, 68395803, 1120, 272, 46, 0, 16734, -65), (0, 68395804, 1120, 272, 45, 0, 16734, -68), (0, 68395825, 1120, 272, 69, 0, 16734, -73)])
 Get working mode : 0
 Get the current network mode : 0
------------end net test------------

2.Class-net

getModemsetModemgetCsqgetCellInfogetMode
Get working mode Set the working mode Get the signal strength Obtain the attached cell information Get the current network mode

net - Network function

  • The function prototype :

modem.net()

  • Parameter description : nothing

setModem - Set flight mode

  • The functionality : Set flight mode

  • The function prototype :

net.setModem(value)

  • Parameter description :
Parameters type explain
valueintvalue=0 Full function mode ;value=1 Turn on flight mode

getModem - Get working mode

  • The functionality : Get working mode

  • The function prototype :

net.getModem()

  • Parameter description : nothing

  • Return value : Return value =1, Flight Mode ; Return value =0, Normal mode

getCsq - Get working mode

  • The functionality : Get the flight mode status

  • The function prototype :

net.getCsq()

  • Parameter description : nothing

  • Return value : Successfully returned integer csq Signal strength value

getMode - Get the current network mode

  • The functionality : Get the current network mode

  • The function prototype :

net.getMode()

  • Parameter description : nothing

  • Return value :

The number explain
0auto
1GSM only
3LTE only

getCellInfo - Obtain the attached cell information

  • The functionality : Obtain the attached cell information

  • The function prototype :

net.getCellInfo()

  • Parameter description : nothing

  • Return value : The successful return contains three network systems (GSM、UMTS、LTE) Of information list, If the corresponding network system information is empty , Returns empty List.(UMTS Temporary does not support , Default return []), The format of the return value is as follows :
    ([(cid, mcc, mnc, lac, arfcn, bsic)], [], [(cid, mcc, mnc, pci, earfcn,tac),…])

GSM Description of network system return value

Parameters Parameter meaning
cid return GSM Under the Internet cell id Information ,0 Is empty , Range 0 ~ 65535
mcc Mobile device country code , Range 0 ~ 999 Be careful :EC100Y/EC600S/EC600N Series of modules , The value is expressed in hexadecimal , For example, the decimal number in the following example 1120, Expressed in hexadecimal as 0x460, Indicates the mobile device country code 460, Other model modules , The value is expressed directly in decimal , For example, mobile device country code 460, It's in decimal system 460 To express .
mnc Mobile device network code , Range 0 ~ 99
lac Location area code , Range 1 ~ 65534
arfcn Wireless channel number , Range 0 ~ 65535
bsic Base station identification number , Range 0 ~ 255

LTE Description of network system return value

Parameters Parameter meaning
cid return LTE Under the Internet Cell identity Information ,Cell identity = RNC_ID * 65536 + Cell_ID,Cell identity Range 0x0000000 ~ 0xFFFFFFF( Notice that this is 28bits); among RNC_ID The range is 0 ~ 4095,Cell_ID The range is 0 ~ 65535
mcc Mobile device country code , Range 0 ~ 999
mnc Mobile device network code , Range 0 ~ 99
pci Physical layer cell ID ,0 ~ 503
tac Tracking area code ,0 ~ 65535
earfcn Wireless channel number , Range 0 ~ 65535
原网站

版权声明
本文为[Zhiyunfu]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/174/202206230512037607.html