北斗卫星定位GPS解析全过程
生活随笔
收集整理的這篇文章主要介紹了
北斗卫星定位GPS解析全过程
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
解析工具類
package com.jeesite.modules.utils;import java.text.DecimalFormat; import org.apache.commons.lang.StringUtils; import com.alibaba.fastjson.JSONObject; import lombok.extern.slf4j.Slf4j;/*** @Desc 解析GPS發(fā)送數(shù)據(jù)工具類* @author PGQing*/ @Slf4j public class HexMathUtils {/*** @Desc 1.將收到的GPS定位數(shù)據(jù)解析成JSON格式* @param hex* @return* @throws Exception*/public static JSONObject formatHexStr(String hexStr) throws Exception {log.info("準(zhǔn)備解析的數(shù)據(jù):\n" + hexStr);JSONObject result = new JSONObject();try {if (StringUtils.isNotBlank(hexStr) && hexStr.replaceAll(" ", "").length() == 110) {JSONObject info = new JSONObject();// 去空String content = hexStr.replaceAll(" ", "");// 長(zhǎng)度info.put("length", content.getBytes("UTF-8").length / 2);// 消息頭info.put("head", content.substring(0, 2));總結(jié)
以上是生活随笔為你收集整理的北斗卫星定位GPS解析全过程的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 开发板烧录系统
- 下一篇: python 红楼梦 人物关系_用Pyt