Skip to content

Commit 18e814f

Browse files
Jayceon Fu(付俊臣)Jayceon Fu(付俊臣)
authored andcommitted
增加内置GNSS模块接口说明
1 parent 29e91dc commit 18e814f

File tree

2 files changed

+319
-11
lines changed

2 files changed

+319
-11
lines changed

en-us/api/QuecPythonClasslib.md

Lines changed: 161 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4718,10 +4718,6 @@ The values returned are explained as follows:
47184718
| 8 | Booting from PSM wakeup |
47194719
| 9 | Booting by dump |
47204720

4721-
* Note
4722-
4723-
* BC25PA platform does not support restart reason 5 and 6.
4724-
47254721

47264722

47274723
###### Get the Reason for the Last Powering Down of the Module
@@ -10976,7 +10972,7 @@ camCaputre.callback(callback)
1097610972

1097710973

1097810974

10979-
#### GNSS - Navigation Positioning and Timing
10975+
#### GNSS - External GNSS
1098010976

1098110977
Module function: Get positioning data from GPS model of L76 module, including whether the module locates successfully, latitude, longitude, UTC time, positioning mode, number of satellites, number of visible satellites, azimuth angle, speed over the ground, geodetic height and so on.
1098210978

@@ -11065,7 +11061,7 @@ total_sen_num = 3, total_sat_num = 12 # Output the total number of complete GPG
1106511061

1106611062

1106711063

11068-
##### Get the original GNSS data read
11064+
##### Get the original GNSS data
1106911065

1107011066
> **gnss.getOriginalData()**
1107111067

@@ -11336,6 +11332,165 @@ gnss.getSpeed()
1133611332

1133711333

1133811334

11335+
11336+
11337+
#### quecgnss - built-in GNSS
11338+
11339+
Note: The current only EC200UCNAA/EC200UCNLA/EC200UEUAA models support this feature.
11340+
11341+
##### Initialize the GNSS
11342+
11343+
> **import quecgnss**
11344+
>
11345+
> **quecgnss.init()**
11346+
11347+
* Function
11348+
11349+
Initialization of GNSS module functions.
11350+
11351+
* Parameter
11352+
11353+
None
11354+
11355+
* Return Value
11356+
11357+
Returns integer 0 on success, integer -1 on failure.
11358+
11359+
11360+
11361+
##### Get the GNSS working status
11362+
11363+
> **quecgnss.get_state()**
11364+
11365+
* Function
11366+
11367+
Get the GNSS module status.
11368+
11369+
* Parameter
11370+
11371+
None
11372+
11373+
* Return Value
11374+
11375+
| Value | Type | Description |
11376+
| ----- | ---- | ------------------------------------------------------------ |
11377+
| 0 | int | The GNSS module is closed |
11378+
| 1 | int | The GNSS module is being firmware upgrade |
11379+
| 2 | int | The GNSS module is positioning. In this mode, the GNSS module starts to read GNSS positioning data. The validity of the positioning data needs to be determined by parsing corresponding statements after obtaining the positioning data, for example, whether the STATUS of the GNRMC statement is A or V. A indicates that the positioning is valid, and V indicates that the positioning is invalid. |
11380+
11381+
11382+
11383+
##### Enable or disable GNSS
11384+
11385+
> **quecgnss.gnssEnable(opt)**
11386+
11387+
* Function
11388+
11389+
Enable or disable the GNSS module. If you use the GNSS function for the first time after power-on, you do not need to invoke this interface to enable the GNSS function. Instead, you can invoke the init() interface. The init() interface automatically enables the GNSS function during initialization.
11390+
11391+
* Parameter
11392+
11393+
| Parameter | Type | Description |
11394+
| --------- | ---- | ------------------------------------ |
11395+
| opt | int | 0 - disable GNSS<br/>1 - enable GNSS |
11396+
11397+
* Return Value
11398+
11399+
Returns integer 0 on success, integer -1 on failure.
11400+
11401+
11402+
11403+
##### Get the GNSS data
11404+
11405+
> **quecgnss.read(size)**
11406+
11407+
* Function
11408+
11409+
Get the GNSS data。
11410+
11411+
* Parameter
11412+
11413+
| Parameter | Type | Description |
11414+
| --------- | ---- | ---------------------------------------------------------- |
11415+
| size | int | Specifies the size of the data to read, the unit is bytes. |
11416+
11417+
* Return Value
11418+
11419+
Returns a tuple on success, integer -1 on failure. The tuple form is as follows:
11420+
11421+
`(size, data)`
11422+
11423+
`size` - The actual size of the data read
11424+
11425+
`data` - positioning data
11426+
11427+
##### Example
11428+
11429+
```python
11430+
import quecgnss
11431+
11432+
11433+
def main():
11434+
ret = quecgnss.init()
11435+
if ret == 0:
11436+
print('GNSS init ok.')
11437+
else:
11438+
print('GNSS init failed.')
11439+
return -1
11440+
data = quecgnss.read(4096)
11441+
print(data[1].decode())
11442+
11443+
quecgnss.gnssEnable(0)
11444+
11445+
11446+
if __name__ == '__main__':
11447+
main()
11448+
11449+
11450+
#===================================================================================================
11451+
# The result
11452+
167,169,170,,,,,,,,1.773,1.013,1.455*15
11453+
$GPGSV,2,1,8,3,23,303,34,16,32,219,28,22,74,98,26,25,16,43,25*77
11454+
$GPGSV,2,2,8,26,70,236,28,31,59,12,38,32,55,127,34,4,5,,21*49
11455+
$BDGSV,2,1,8,163,51,192,32,166,70,11,31,167,52,197,32,169,59,334,31*61
11456+
$BDGSV,2,2,8,170,40,205,31,161,5,,31,164,5,,27,165,5,,29*59
11457+
$GNRMC,022326.000,A,3149.324624,N,11706.921702,E,0.000,261.541,180222,,E,A*38
11458+
$GNGGA,022326.000,3149.324624,N,11706.921702,E,1,12,1.013,-8.580,M,0,M,,*47
11459+
$GNGLL,3149.324624,N,11706.921702,E,022326.000,A,A*44
11460+
$GNGSA,A,3,31,32,3,16,22,25,26,,,,,,1.773,1.013,1.455*1C
11461+
$GNGSA,A,3,163,166,167,169,170,,,,,,,,1.773,1.013,1.455*15
11462+
$GPGSV,2,1,8,3,23,303,34,16,32,219,27,22,74,98,26,25,16,43,25*78
11463+
$GPGSV,2,2,8,26,70,236,28,31,59,12,37,32,55,127,34,4,5,,20*47
11464+
$BDGSV,2,1,8,163,51,192,32,166,70,11,31,167,52,197,32,169,59,334,31*61
11465+
$BDGSV,2,2,8,170,40,205,31,161,5,,31,164,5,,27,165,5,,29*59
11466+
$GNRMC,022327.000,A,3149.324611,N,11706.921713,E,0.000,261.541,180222,,E,A*3F
11467+
$GNGGA,022327.000,3149.324611,N,11706.921713,E,1,12,1.013,-8.577,M,0,M,,*48
11468+
$GNGLL,3149.324611,N,11706.921713,E,022327.000,A,A*43
11469+
...... # There is too much data, so it is omitted
11470+
$GNGSA,A,3,31,32,3,16,22,25,26,,,,,,1.837,1.120,1.456*11
11471+
$GNGSA,A,3,163,166,167,169,170,,,,,,,,1.837,1.120,1.456*18
11472+
$GPGSV,2,1,8,3,23,302,27,16,32,220,26,22,73,101,27,25,16,43,27*45
11473+
$GPGSV,2,2,8,26,70,237,28,31,59,13,33,32,54,128,28,4,5,,24*44
11474+
$BDGSV,2,1,8,163,51,192,33,166,71,11,35,167,52,198,33,169,59,334,34*6E
11475+
$BDGSV,2,2,8,170,40,205,32,161,5,,33,164,5,,28,165,5,,30*5F
11476+
$GNRMC,022507.000,A,3149.324768,N,11706.922344,E,0.000,261.541,180222,,E,A*31
11477+
$GNGGA,022507.000,3149.324768,N,11706.922344,E,1,12,1.120,-8.794,M,0,M,,*48
11478+
$GNGLL,3149.324768,N,11706.922344,E,022507.000,A,A*4D
11479+
$GNGSA,A,3,31,32,3,16,22,25,26,,,,,,1.837,1.120,1.455*12
11480+
$GNGSA,A,3,163,166,167,169,170,,,,,,,,1.837,1.120,1.455*1B
11481+
$GPGSV,2,1,8,3,23,302,26,16,32,220,26,22,73,101,27,25,16,43,26*45
11482+
$GPGSV,2,2,8,26,70,237,28,31,59,13,32,32,54,128,28,4,5,,24*45
11483+
$BDGSV,2,1,8,163,51,192,24,166,71,11,35,167,52,198,33,169,59,334,34*68
11484+
$BDGSV,2,2,8,170,40,205,31,161,5,,33,164,5,,28,165,5,,30*5C
11485+
$GNRMC,022508.000,A,3149.324754,N,11706.922338,E,0.002,261.541,180222,,E,A*38
11486+
$GNGGA,022508.000,3149.324754,N,11706.922338,E,1,12,1.120,-8.750,M,0,M,,*4B
11487+
$GNGLL,3149.324754,N,11706.922338,E,022508.000,A,A*46
11488+
$GNGSA,A,3,31,3
11489+
11490+
```
11491+
11492+
11493+
1133911494
#### Securedata - secure data area
1134011495

1134111496
Module function: the module provides a bare flash area and a special read-write interface for customers to store important information, and the information will not be lost after burning the firmware (burning the firmware without this function cannot be guaranteed not to be lost). Provide a storage and read interface, not a delete interface.

zh-cn/api/QuecPythonClasslib.md

Lines changed: 158 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4815,10 +4815,6 @@ while 1:
48154815
| 8 | PSM 唤醒开机 |
48164816
| 9 | 发生 Dump 后重启 |
48174817

4818-
* 注意
4819-
4820-
BC25PA平台不支持重启原因56
4821-
48224818

48234819

48244820
###### 获取模块上次关机原因
@@ -10983,7 +10979,7 @@ camCaputre.callback(callback)
1098310979

1098410980

1098510981

10986-
#### GNSS - 定位授时
10982+
#### GNSS - 外置GNSS
1098710983

1098810984
模块功能:对L76K GPS型号进行数据获取,可以得到模块定位是否成功,定位的经纬度数据,UTC授时时间,获取GPS模块的定位模式,获取GPS模块定位使用卫星数量,获取GPS模块定位可见卫星数量,获取定位方位角,GPS模块对地速度,模块定位大地高等数据信息。目前,该模块提供的功能接口,所获取的数据都来源于从串口读出的原始GNSS数据包中的GNGGAGNRMCGPGSV语句。
1098910985

@@ -11350,6 +11346,163 @@ gnss.getSpeed()
1135011346

1135111347

1135211348

11349+
#### quecgnss - 内置GNSS
11350+
11351+
说明:当前仅 EC200UCNAA/EC200UCNLA/EC200UEUAA 型号支持该功能。
11352+
11353+
##### GNSS 功能初始化
11354+
11355+
> **import quecgnss**
11356+
>
11357+
> **quecgnss.init()**
11358+
11359+
* 功能
11360+
11361+
模组内置GNSS模块功能的初始化。
11362+
11363+
* 参数
11364+
11365+
11366+
11367+
* 返回值
11368+
11369+
成功返回整形0,失败返回整形-1
11370+
11371+
11372+
11373+
##### GNSS 工作状态获取
11374+
11375+
> **quecgnss.get_state()**
11376+
11377+
* 功能
11378+
11379+
获取GNSS模块当前工作状态
11380+
11381+
* 参数
11382+
11383+
11384+
11385+
* 返回值
11386+
11387+
| 返回值 | 类型 | 说明 |
11388+
| ------ | ---- | ------------------------------------------------------------ |
11389+
| 0 | int | GNSS模块处于关闭状态 |
11390+
| 1 | int | GNSS模块固件升级中 |
11391+
| 2 | int | GNSS模块定位中,这种模式下即可开始读取GNSS定位数据,定位数据是否有效需要用户获取到定位数据后,解析对应语句来判断,比如判断GNRMC语句的status是 A 还是 V,A 表示定位有效,V 表示定位无效。 |
11392+
11393+
11394+
11395+
##### GNSS开关
11396+
11397+
> **quecgnss.gnssEnable(opt)**
11398+
11399+
* 功能
11400+
11401+
开启或者关闭GNSS模块。如果是上电后第一次使用内置GNSS功能,一般不需要调用该接口来开启GNSS功能,直接调用init()接口即可,init() 接口在初始化时会自动开启GNSS功能。
11402+
11403+
* 参数
11404+
11405+
| 参数 | 类型 | 说明 |
11406+
| ---- | ---- | ------------------------------------- |
11407+
| opt | int | 0 - 关闭GNSS功能<br/>1 - 开启GNSS功能 |
11408+
11409+
* 返回值
11410+
11411+
成功返回整形0,失败返回整形-1
11412+
11413+
11414+
11415+
##### GNSS定位数据获取
11416+
11417+
> **quecgnss.read(size)**
11418+
11419+
* 功能
11420+
11421+
读取GNSS定位数据。
11422+
11423+
* 参数
11424+
11425+
| 参数 | 类型 | 说明 |
11426+
| ---- | ---- | ------------------------------ |
11427+
| size | int | 指定读取数据的大小,单位字节。 |
11428+
11429+
* 返回值
11430+
11431+
成功返回一个元组,失败返回整形-1。元组形式如下:
11432+
11433+
`(size, data)`
11434+
11435+
`size` - 实际读取数据的大小
11436+
11437+
`data` - GNSS定位数据
11438+
11439+
##### GNSS使用示例
11440+
11441+
```python
11442+
import quecgnss
11443+
11444+
11445+
def main():
11446+
ret = quecgnss.init()
11447+
if ret == 0:
11448+
print('GNSS init ok.')
11449+
else:
11450+
print('GNSS init failed.')
11451+
return -1
11452+
data = quecgnss.read(4096)
11453+
print(data[1].decode())
11454+
11455+
quecgnss.gnssEnable(0)
11456+
11457+
11458+
if __name__ == '__main__':
11459+
main()
11460+
11461+
11462+
#===================================================================================================
11463+
#运行结果
11464+
167,169,170,,,,,,,,1.773,1.013,1.455*15
11465+
$GPGSV,2,1,8,3,23,303,34,16,32,219,28,22,74,98,26,25,16,43,25*77
11466+
$GPGSV,2,2,8,26,70,236,28,31,59,12,38,32,55,127,34,4,5,,21*49
11467+
$BDGSV,2,1,8,163,51,192,32,166,70,11,31,167,52,197,32,169,59,334,31*61
11468+
$BDGSV,2,2,8,170,40,205,31,161,5,,31,164,5,,27,165,5,,29*59
11469+
$GNRMC,022326.000,A,3149.324624,N,11706.921702,E,0.000,261.541,180222,,E,A*38
11470+
$GNGGA,022326.000,3149.324624,N,11706.921702,E,1,12,1.013,-8.580,M,0,M,,*47
11471+
$GNGLL,3149.324624,N,11706.921702,E,022326.000,A,A*44
11472+
$GNGSA,A,3,31,32,3,16,22,25,26,,,,,,1.773,1.013,1.455*1C
11473+
$GNGSA,A,3,163,166,167,169,170,,,,,,,,1.773,1.013,1.455*15
11474+
$GPGSV,2,1,8,3,23,303,34,16,32,219,27,22,74,98,26,25,16,43,25*78
11475+
$GPGSV,2,2,8,26,70,236,28,31,59,12,37,32,55,127,34,4,5,,20*47
11476+
$BDGSV,2,1,8,163,51,192,32,166,70,11,31,167,52,197,32,169,59,334,31*61
11477+
$BDGSV,2,2,8,170,40,205,31,161,5,,31,164,5,,27,165,5,,29*59
11478+
$GNRMC,022327.000,A,3149.324611,N,11706.921713,E,0.000,261.541,180222,,E,A*3F
11479+
$GNGGA,022327.000,3149.324611,N,11706.921713,E,1,12,1.013,-8.577,M,0,M,,*48
11480+
$GNGLL,3149.324611,N,11706.921713,E,022327.000,A,A*43
11481+
...... # 数据较多,省略
11482+
$GNGSA,A,3,31,32,3,16,22,25,26,,,,,,1.837,1.120,1.456*11
11483+
$GNGSA,A,3,163,166,167,169,170,,,,,,,,1.837,1.120,1.456*18
11484+
$GPGSV,2,1,8,3,23,302,27,16,32,220,26,22,73,101,27,25,16,43,27*45
11485+
$GPGSV,2,2,8,26,70,237,28,31,59,13,33,32,54,128,28,4,5,,24*44
11486+
$BDGSV,2,1,8,163,51,192,33,166,71,11,35,167,52,198,33,169,59,334,34*6E
11487+
$BDGSV,2,2,8,170,40,205,32,161,5,,33,164,5,,28,165,5,,30*5F
11488+
$GNRMC,022507.000,A,3149.324768,N,11706.922344,E,0.000,261.541,180222,,E,A*31
11489+
$GNGGA,022507.000,3149.324768,N,11706.922344,E,1,12,1.120,-8.794,M,0,M,,*48
11490+
$GNGLL,3149.324768,N,11706.922344,E,022507.000,A,A*4D
11491+
$GNGSA,A,3,31,32,3,16,22,25,26,,,,,,1.837,1.120,1.455*12
11492+
$GNGSA,A,3,163,166,167,169,170,,,,,,,,1.837,1.120,1.455*1B
11493+
$GPGSV,2,1,8,3,23,302,26,16,32,220,26,22,73,101,27,25,16,43,26*45
11494+
$GPGSV,2,2,8,26,70,237,28,31,59,13,32,32,54,128,28,4,5,,24*45
11495+
$BDGSV,2,1,8,163,51,192,24,166,71,11,35,167,52,198,33,169,59,334,34*68
11496+
$BDGSV,2,2,8,170,40,205,31,161,5,,33,164,5,,28,165,5,,30*5C
11497+
$GNRMC,022508.000,A,3149.324754,N,11706.922338,E,0.002,261.541,180222,,E,A*38
11498+
$GNGGA,022508.000,3149.324754,N,11706.922338,E,1,12,1.120,-8.750,M,0,M,,*4B
11499+
$GNGLL,3149.324754,N,11706.922338,E,022508.000,A,A*46
11500+
$GNGSA,A,3,31,3
11501+
11502+
```
11503+
11504+
11505+
1135311506
#### SecureData - 安全数据区
1135411507

1135511508
模块功能:模组提供一块裸flash区域及专门的读写接口供客户存贮重要信息,且信息在烧录固件后不丢失(烧录不包含此功能的固件无法保证不丢失)。提供一个存储和读取接口,不提供删除接口。

0 commit comments

Comments
 (0)