lbsLoc2 - base station positioning v2#

Adaptation status unknown

Note

This page document is automatically generated by this file. If there is any error, please submit issue or help modify pr, thank you!

Tip

This library has its own demo,click this link to view lbsLoc2 demo examples

Example

-- Attention:
-- 1. Because sys.wait() is used, all apis need to be used in the coroutine.
-- 2. Only single base station positioning is supported, that is, the currently networked base station
-- 3. This service is currently in test status
sys.taskInit(function()
    sys.waitUntil("IP_READY", 30000)
    -- mobile.reqCellInfo(60)
    -- sys.wait(1000)
    while mobile do -- No mobile library, no base station location
        mobile.reqCellInfo(15)
        sys.waitUntil("CELL_INFO_UPDATE", 3000)
        local lat, lng, t = lbsLoc2.request(5000)
        -- local lat, lng, t = lbsLoc2.request(5000, "bs.openluat.com")
        log.info("lbsLoc2", lat, lng, (json.encode(t or {})))
        sys.wait(60000)
    end
end)

lbsLoc2.request(timeout, host, port, reqTime)#

Execute positioning request

Parameters

Incoming Value Type

Explanation

number

Request timeout, in milliseconds, by default.15000

number

Server address, with default value, can be domain name, generally do not need to fill in

number

Server port, default 12411, generally do not need to fill in

bool

Request to return server time

Return Value

return value type

explanation

string

If successful, return the latitude of the positioning coordinates, otherwise it will be returned.nil

string

If successful, return the accuracy of the positioning coordinates, otherwise it will be returned.nil

table

Server time, East Zone 8 time. When the reqTime is true and the location is successful, it will be returned.

Examples

-- About Coordinate Systems
-- In some cases, it will return GCJ02 coordinate system, and in some cases, it will return WGS84 coordinates.
-- Historical data has been unable to distinguish the specific coordinate system
-- In view of the error between the two coordinate systems is not large, less than the error of the base station positioning itself, the significance
sys.taskInit(function()
    sys.waitUntil("IP_READY", 30000)
    -- mobile.reqCellInfo(60)
    -- sys.wait(1000)
    while mobile do -- No mobile library, no base station location
        mobile.reqCellInfo(15)
        sys.waitUntil("CELL_INFO_UPDATE", 3000)
        local lat, lng, t = lbsLoc2.request(5000)
        -- local lat, lng, t = lbsLoc2.request(5000, "bs.openluat.com")
        log.info("lbsLoc2", lat, lng, (json.encode(t or {})))
        sys.wait(60000)
    end
end)