当前位置: 首页>>代码示例>>Python>>正文


Python GPS.getPowerOnOff方法代码示例

本文整理汇总了Python中GPS.getPowerOnOff方法的典型用法代码示例。如果您正苦于以下问题:Python GPS.getPowerOnOff方法的具体用法?Python GPS.getPowerOnOff怎么用?Python GPS.getPowerOnOff使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GPS的用法示例。


在下文中一共展示了GPS.getPowerOnOff方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: getGPSLocation

# 需要导入模块: import GPS [as 别名]
# 或者: from GPS import getPowerOnOff [as 别名]
def getGPSLocation(type) :
	gpsStatus = GPS.getPowerOnOff()
	if gpsStatus == 0:
		GPS. powerOnOff(1)
	
	gpsStatus = GPS.getPowerOnOff()
	while gpsStatus == 0 :
		gpsStatus = GPS.getPowerOnOff()
	
	GPSResult = GPS.getPosition()
	SER.send(str(GPSResult)+'\r\n')
	
	Latitude = str(GPSResult).split(',')[0].replace('(','')
	Latitude = Latitude[0:len(Latitude)-7]+'.'+Latitude[len(Latitude)-7:len(Latitude)]
	
	Longitude = str(GPSResult).split(',')[2].replace(')','')
	Longitude = Longitude[0:len(Longitude)-7]+'.'+Longitude[len(Longitude)-7:len(Longitude)]
	
	if type == 'Lat' :
		GPSResult = Latitude
	elif type == 'Lon' :
		GPSResult = Longitude
	
	return GPSResult
开发者ID:MrZANE42,项目名称:car-tracker,代码行数:26,代码来源:RHandler.py

示例2: main

# 需要导入模块: import GPS [as 别名]
# 或者: from GPS import getPowerOnOff [as 别名]
def main():

    try:

        rtnList = [-1, -1]  # [return status,return data]
        # return status:
        #   -1:    Exception occurred
        #    0:    No errors occurred, no return data
        #    1:    No errors occurred, return data
        #    2:    Error occurred

        # Initialize the serial interface @ 115200, we must do this or nothing comes out the serial port
        rtnList = mySER.init("115200", "8N1")
        if rtnList[0] == -1:
            return

        mySER.sendUART("Beginning the T2 SMS Query Program. \r\n\r\n")
        # Set Global Watchdog timeout in Seconds
        # MOD.watchdogEnable(300)

        # Get configuration from demoT2.conf file, transpose into new local myApp class
        myApp = conf.conf("/sys", "demoT2.conf")
        if myApp.CONF_STATUS != 0:
            mySER.sendUART("DemoT2 configuration error: " + str(myApp.CONF_STATUS))
            return rtnList

        mySER.sendUART("Configuration Loaded.\r\n")

        rtnList = myIO.init()
        if (rtnList[0] == -1) or (rtnList[0] == -2) or rtnList[1] == "ERROR":
            raise UserWarning

        mySER.sendUART("\r\nInitializing Network Setup. \r\n")
        # Set Network specific settings, wait for SIM card to be ready
        rtnList = NETWORK.initNetwork(myApp.ENS)
        if (rtnList[0] == -1) or (rtnList[0] == -2) or rtnList[1] == "ERROR":
            raise UserWarning

        # Initialize SOCKET communications
        rtnList = SOCKET.init("1", myApp.APN)
        if (rtnList[0] == -1) or (rtnList[0] == -2) or rtnList[1] == "ERROR":
            raise UserWarning

        mySER.sendUART("Network Setup Initialized. \r\n\r\n")

        mySER.sendUART("Initializing GPS \r\n")

        # Turn the GPS ON
        rtnList[1] = GPS.getPowerOnOff()
        while rtnList[1] != 1:
            GPS.powerOnOff(1)
            rtnList[1] = GPS.getPowerOnOff()
            mySER.sendUART("GPS Status: " + str(rtnList[1]) + "\r\n")

        mySER.sendUART("GPS Initialized. \r\n\r\n")

        mySER.sendUART("Initializing SMS. \r\n")

        # Setup SMS
        rtnList = mySMS.configSMS()
        if rtnList[0] == 0:
            mySER.sendUART("SMS Initialized. \r\n\r\n")
        else:
            return

        # Update Unit information
        rtnList = ATC.getUnitInfo()
        if (rtnList[0] == -1) or rtnList[1] == "ERROR":
            raise UserWarning

        # Loop forever, without this loop the script would run once and exit script mode.  On reboot or power-on the script would run once more
        while 1:

            # MOD.watchdogReset()

            RegCheck = 0  # Initialize check

            mySER.sendUART("Checking Modem Registration. \r\n")
            # Wait until module is registered to GSM Network
            rtnList = NETWORK.isRegistered(180)  # Wait 180 seconds for module to obtain GSM registration
            if (rtnList[0] == -1) or (rtnList[0] == -2) or rtnList[1] == "ERROR":
                raise UserWarning

            if rtnList[0] == 0:
                RegCheck = 1
                mySER.sendUART("Modem Registered. Waiting for SMS. \r\n\r\n")

            # Loop forever, without this loop the script would run once and exit script mode.  On reboot or power-on the script would run once more
            while RegCheck == 1:

                # MOD.watchdogReset()

                # Update NMEA Data
                # The following are available through the included GPS module:
                # GPS.getActualPosition(), returns all fields like AT$GPSACP would
                # GPS.getLastGGA()
                # GPS.getLastGLL()
                # GPS.getLastGSA()
                # GPS.getLastGSV()
                # GPS.getLastRMC()
#.........这里部分代码省略.........
开发者ID:JanusRC,项目名称:Python,代码行数:103,代码来源:SMSQRY_HE910.py

示例3: init

# 需要导入模块: import GPS [as 别名]
# 或者: from GPS import getPowerOnOff [as 别名]
def init():
    if GPS.getPowerOnOff() == 0:
        GPS.powerOnOff(1)
开发者ID:jgrahamc,项目名称:gaga,代码行数:5,代码来源:gps2.py


注:本文中的GPS.getPowerOnOff方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。