首页 > 编程知识 正文

python模拟登陆,python模拟微信登录

时间:2023-05-05 07:52:50 阅读:187256 作者:3644

数据详细信息: $GPRMC,1,2,3,4,5,6,7,8,9,10,11,12 * hh

1 UTC时间,hhmmss (时分秒)格式

2定位状态,A=有效定位,V=无效定位

3纬度ddmm.mmmm (度)格式(也传输前面的0 ) )。

4纬度半球n (北半球)或s (南半球)

经度dddmm.mmmm (分钟)格式(也传输上一个0 ) )。

经度半球e (东经)或w (西经)

7地面速度(000.0~999.9节,还传输前面的0 ) )。

8地面航向(000.0~359.9度,以正北为基准,也传输前面的0 ) )。

9 UTC日期,ddmmyy (日月年)格式

10磁偏角(000.0~180.0度,上一个0也被传输) ) )。

11磁偏角方向,e (东)或w (西) )。

12模式指示(仅NMEA01833.00版本输出,A=自主定位,D=差分,E=估计,N=数据无效) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) )

' $GPRMC,' 060949.000 ',a,3150.7815,n,11711.9239,e,2.87,314.13,' 050314 ',D*69 '

“”'

$GNRMC,092846.400,a,3029.7317,n,10404.1784,e,000.0,183.8,070417,A*73

$GNRMC,

092846.400,//UTC时间,hhmmss.sss (时分秒.毫秒)格式

a、//定位状态,A=有效定位,V=无效定位

3029.7317,n,//纬度

10404.1784,e,//经度

000.0,//地面速度

183.8,//地面航向

070417,//UTC日期

、//磁俯角

、//磁方位

A*73 //模式指示

“”'

#coding:utf-8

#! /usr/迷人的水蜜桃/python3

import sys,os

导入re

导入日志

导入日期时间

#add path for import module

filePath=os.getcwd (

sys.path.append (文件路径) )。

from com _ utilities.flexconfigimportresourcesconfigasflexconfig

from com _ utilities.uartimportcserialasuart

from com _ utilities.resourcehandlerimportresourcehandlerasresource

__all__=['GPS_Fake']

“”'

GPS数据分组格式:

数据详细信息: $GPRMC,1,2,3,4,5,6,7,8,9,10,11,12 * hh

1 UTC时间,hhmmss (时分秒)格式

2定位状态,A=有效定位,V=无效定位

3纬度ddmm.mmmm (度)格式(也传输前面的0 ) )。

4纬度半球n (北半球)或s (南半球)

经度dddmm.mmmm (分钟)格式(也传输上一个0 ) )。

经度半球e (东经)或w (西经)

7地面速度(000.0~999.9节,还传输前面的0 ) )。

8地面航向(000.0~359.9度,以正北为基准,也传输前面的0 ) )。

9 UTC日期,ddmmyy (日月年)格式

10磁偏角(000.0~180.0度,上一个0也被传输) ) )。

11磁偏角方向,e (东)或w (西) )。

12模式指示(仅NMEA01833.00版本输出,A=自主定位,D=差分,E=估计,N=无数据

效)

"$GPRMC," + "060949.000" +",A,3150.7815,N,11711.9239,E,2.87,314.13," + "050314" + ",,,D*69"

time format: 080650.000 & 08:06:50.000

date format: 311219 & 2019/12/31

"""

"""

$GNRMC,092846.400,A,3029.7317,N,10404.1784,E,000.0,183.8,070417,,,A*73

$GNRMC,

092846.400, // UTC时间,hhmmss.sss(时分秒.毫秒)格式

A, // 定位状态,A=有效定位,V=无效定位

3029.7317,N, // 纬度

10404.1784,E, // 经度

000.0, // 地面速率

183.8, // 地面航向

070417, // UTC日期

, // 磁俯角

, // 磁方向角

A*73 // 模式指示

"""

class GPS_Fake(Uart):

def __init__(self, userName, userID):

self.resource = Resource();

# serial port message: [0]-port, [1]-baud

serialportMsg = self.resource.get_Serial_Or_IP(userName,userID)

Uart.__init__(self, serialportMsg[0], int(serialportMsg[1]), 10)

self.Serial_Create()

def __GPS_CheckSum__(self, string ):

checksum = 0

val = bytes(string)

for index in range(len(val)):

checksum ^= val[index]

return checksum

#time format: 080650.000 & 08:06:50.000

def GPS_CurrentFormatTime(self):

now_time = datetime.datetime.now()

strTime = now_time.strftime("%H%M%S.%f")

str = strTime.split('.')

micSecond = str[1][0:3]

nowTime = str[0] + "." + micSecond

return nowTime

#time format: 260419 & 2019/04/26

def GPS_CurrentFormatDate(self):

now_time = datetime.datetime.now()

covYear = now_time.year-2000

nowDate = "%02d%02d%02d" %(now_time.day,now_time.month,covYear)

return nowDate

def GPRMC_SendMessage(self, time, date):

gpsMessage = "GPRMC," + time + ",A,3150.7815,N,12123.5344,E,2.87,314.13," + date + ",,,D"

checkSum = self.__GPS_CheckSum__(gpsMessage)

Message = "$" + gpsMessage + "*" + str(checkSum, encoding = "utf8")+ "rn"

self.Serial_WriteString(Message)

def GPRMC_SendMessage(self, time, date, latitude, longitude):

gpsMessage = "GPRMC," + time + ",A," + latitude +",N,"+ longitude + ",E,2.87,314.13," + date + ",,,D"

checkSum = self.__GPS_CheckSum__(gpsMessage)

Message = "$" + gpsMessage + "*" + str(checkSum, encoding = "utf8")+ "rn"

self.Serial_WriteString(Message)

def GNRMC_SendMessage(self, time, date):

gpsMessage = "GNRMC," + time + ",A,3150.7815,N,12123.5344,E,2.87,314.13," + date + ",,,A"

checkSum = self.__GPS_CheckSum__(gpsMessage)

Message = "$" + gpsMessage + "*" + str(checkSum, encoding = "utf8")+ "rn"

self.Serial_WriteString(Message)

def GNRMC_SendMessage(self, time, date, latitude, longitude):

gpsMessage = "GNRMC," + time + ",A," + latitude +",N,"+ longitude + ",E,2.87,314.13," + date + ",,,A"

checkSum = self.__GPS_CheckSum__(gpsMessage)

Message = "$" + gpsMessage + "*" + str(checkSum, encoding = "utf8")+ "rn"

self.Serial_WriteString(Message)

def GPS_Stop(self):

self.Serial_Close()

#test example

if __name__ == '__main__':

gps_test = GPS_Fake()

gps_test.Serial_Create()

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。