Giter VIP home page Giter VIP logo

gpsd's Introduction

GPSd

A GPSd client with Java

Warning:You should use the module with Socket(https://github.com/tianwei0828/Socket.git)!!!

一、初始化

  client = new GPSdClient(ip, port);
  client.retryCount(retryCount);
  client.retryInterval(retryInterval);
  client.connectTimeout(connectTimeout);
  client.readTimeout(readTimeout);
  client.isDebug(isDebug);
  client.logPath(logPath);
  client.logName(logName);
  client.isCover(isCover);
  //设置JsonParser
  client.setJsonParser(new JsonParser());
  //添加JsonResultCallback
  client.addJsonResultCallback(new JsonResultCallback() {

            @Override
            public void onTPV(TPV tpv) {
               //收到TPV
            }


            @Override
            public void onGPSdException(GPSdException e) {
                //异常信息
            }

            @Override
            public void onStatusChanged(int status, String message) {
                //状态变化
            }
    });
    //设置NMEAParser
    client.setNMEAParser(new NMEAParser());
    //添加NMEAResultCallback
    client.addNMEAResultCallback(new NMEAResultCallback() {

            @Override
            public void onGGASentence(GGASentence ggaSentence) {
                //GGASentence
            }

            @Override
            public void onRMCSentence(RMCSentence rmcSentence) {
                //RMCSentence
            }

            @Override
            public void onStatusChanged(int status, String message) {
                //状态变化
            }
     });
     //添加原始数据的监听
     client.addRawDataResultCallback(new RawDataResultCallback() {
            @Override
            public void onRawData(String rawData) {
                //原始数据
            }

            @Override
            public void onStatusChanged(int status, String message) {
                //状态改变
            }
     });

二、连接

client.connect();

三、发送指令

  Watch watch = new Watch();
  //开启数据接收
  watch.enable = true;
  //启用nmea格式数据
  watch.nmea = true;
  //启用json格式数据
  watch.json = true;
  client.newRequest(watch).send();

四、关闭

client.close();

gpsd's People

Contributors

tianwei0828 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.