• 大小: 21.71MB
    文件类型: .zip
    金币: 2
    下载: 8 次
    发布日期: 2023-06-13
  • 语言: Java
  • 标签: jtt809  车辆gps  

资源简介

本项目使用JAVA + MINA + ServiceLoader实现交通部809协议服务端代码。代码中完成了主链路部分,包括对客户端登录验证及应答,注销及应答,保持连接及应答,接收实时定位数据及历史定位数据等。如果扩充新业务只需要实现SocketMsgHandler接口即可。因第三方厂商没有对数据加密,故本项目没有写数据解密逻辑。
本项目接收数据逻辑已上线测试,能够正常收到下级平台上传的车辆定位数据。

资源截图

代码片段和文件信息

package grandland.glits.vehicle.gps;

import grandland.glits.vehicle.gps.service.VehicleLocationService;
import grandland.glits.vehicle.gps.socket.SocketServer;
import grandland.glits.vehicle.gps.util.ConfigureUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * JTT809Server
 */
public class JTT809Server {
    public static final Logger LOG = LoggerFactory.getLogger(JTT809Server.class);

    private static final int PORT = ConfigureUtil.getProperties(ConfigureUtil.PropertiesKey.SERVER_PORT 8386);
    private static final int SERVICE_THREAD_NUM = ConfigureUtil.getProperties(ConfigureUtil.PropertiesKey.SERVICE_THTEAD_NUM 1);

    private VehicleLocationService[] services;

    public static void main(String[] args) throws Exception {

        SocketServer.getInstance(PORT).startServer();
        LOG.info(“JTT809Server start listen port: {}“ PORT);

        final JTT809Server jtt809Server = new JTT809Server();
        Runtime.getRuntime().addShutdownHook(new Thread() {
            public void run() {
                jtt809Server.stop();
            }
        });
        jtt809Server.start();
    }


    public void start() throws ClassNotFoundException {
        services = new VehicleLocationService[SERVICE_THREAD_NUM];
        for (int i = 0; i < SERVICE_THREAD_NUM; ++i) {
            services[i] = new VehicleLocationService();
            services[i].setName(String.valueOf(i));
            services[i].start();
        }
    }

    public void stop() {
        for (int i = 0; i < SERVICE_THREAD_NUM; ++i) {
            if (services[i] != null) {
                services[i].stop();
            }
        }
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2019-12-22 21:39  gl-vehicle-gps\
     目录           0  2019-12-22 21:38  gl-vehicle-gps\build\
     文件         441  2019-12-22 19:35  gl-vehicle-gps\build.gradle
     目录           0  2019-12-22 21:38  gl-vehicle-gps\build\classes\
     目录           0  2019-12-22 21:38  gl-vehicle-gps\build\classes\main\
     目录           0  2019-12-22 21:38  gl-vehicle-gps\build\classes\main\grandland\
     目录           0  2019-12-22 21:38  gl-vehicle-gps\build\classes\main\grandland\glits\
     目录           0  2019-12-22 21:38  gl-vehicle-gps\build\classes\main\grandland\glits\vehicle\
     目录           0  2019-12-22 21:38  gl-vehicle-gps\build\classes\main\grandland\glits\vehicle\gps\
     目录           0  2019-12-22 21:38  gl-vehicle-gps\build\classes\main\grandland\glits\vehicle\gps\client\
     文件        4920  2019-12-22 20:50  gl-vehicle-gps\build\classes\main\grandland\glits\vehicle\gps\client\ComData4Ztc.class
     文件         950  2019-12-22 20:50  gl-vehicle-gps\build\classes\main\grandland\glits\vehicle\gps\client\ILocationService.class
     文件        3325  2019-12-22 20:50  gl-vehicle-gps\build\classes\main\grandland\glits\vehicle\gps\client\Location.class
     文件        2496  2019-12-22 20:50  gl-vehicle-gps\build\classes\main\grandland\glits\vehicle\gps\client\objectFactory.class
     文件         282  2019-12-22 20:50  gl-vehicle-gps\build\classes\main\grandland\glits\vehicle\gps\client\package-info.class
     文件         954  2019-12-22 20:50  gl-vehicle-gps\build\classes\main\grandland\glits\vehicle\gps\client\WriteLocationInfo.class
     文件         897  2019-12-22 20:50  gl-vehicle-gps\build\classes\main\grandland\glits\vehicle\gps\client\WriteLocationInfoResponse.class
     目录           0  2019-12-22 21:38  gl-vehicle-gps\build\classes\main\grandland\glits\vehicle\gps\domain\
     文件        1850  2019-12-22 20:50  gl-vehicle-gps\build\classes\main\grandland\glits\vehicle\gps\domain\TXZInfo.class
     文件        3175  2019-12-22 20:50  gl-vehicle-gps\build\classes\main\grandland\glits\vehicle\gps\domain\Vehicle.class
     文件        2955  2019-12-22 20:50  gl-vehicle-gps\build\classes\main\grandland\glits\vehicle\gps\domain\YYZInfo.class
     目录           0  2019-12-22 21:38  gl-vehicle-gps\build\classes\main\grandland\glits\vehicle\gps\entity\
     文件        3761  2019-12-22 20:50  gl-vehicle-gps\build\classes\main\grandland\glits\vehicle\gps\entity\VehicleLocation.class
     文件         689  2019-12-22 20:50  gl-vehicle-gps\build\classes\main\grandland\glits\vehicle\gps\JTT809Server$1.class
     文件        2600  2019-12-22 20:50  gl-vehicle-gps\build\classes\main\grandland\glits\vehicle\gps\JTT809Server.class
     目录           0  2019-12-22 21:38  gl-vehicle-gps\build\classes\main\grandland\glits\vehicle\gps\manager\
     文件         192  2019-12-22 20:50  gl-vehicle-gps\build\classes\main\grandland\glits\vehicle\gps\manager\IManager.class
     文件        2498  2019-12-22 20:50  gl-vehicle-gps\build\classes\main\grandland\glits\vehicle\gps\manager\ManagerRegistry.class
     文件         695  2019-12-22 20:50  gl-vehicle-gps\build\classes\main\grandland\glits\vehicle\gps\manager\TXZManager$1.class
     文件        4556  2019-12-22 20:50  gl-vehicle-gps\build\classes\main\grandland\glits\vehicle\gps\manager\TXZManager.class
     文件         754  2019-12-22 20:50  gl-vehicle-gps\build\classes\main\grandland\glits\vehicle\gps\manager\VehicleManager$1.class
............此处省略154个文件信息

评论

共有 条评论

相关资源