


技术领域technical field
本发明涉及石油地震勘探数据采集技术领域,特别涉及一种GPS数据传输系统、方法、装置、计算机设备和存储介质。The invention relates to the technical field of petroleum seismic exploration data acquisition, and in particular to a GPS data transmission system, method, device, computer equipment and storage medium.
背景技术Background technique
地震勘探是利用探测仪在地表观测地震波信号,并对其进行处理分析,从而获得地下构造和岩石物性以及资源信息的技术,在油田和工程地质勘查、区域地质研究和地壳研究等方面均得到了广泛应用。Seismic exploration is a technology that uses detectors to observe seismic wave signals on the surface and process and analyze them to obtain information on subsurface structures, petrophysical properties, and resources. widely used.
节点仪即节点探测仪,其是利用GPS(Global Positioning System,全球定位系统)的定位功能获取位置坐标信息,所获得的位置信息是节点仪实施数据采集过程中的必要基础数据。在这些位置信息数据支持下,节点仪能够建立了地震波信号与接收点位置的相关联关系。近年来,随着通信技术的发展,无线节点仪具有安装方便,接口丰富,性能更加稳定的优点,地震勘探采集技术逐步从有线节点仪向无线节点仪发展。但是由于无线节点仪需要使用电池供电,并且GPS模块属于高功耗模组,采用无线节点仪进行地震勘探采集时,电池的电能损耗大,需频繁更换电池或者对其进行充电;给地震勘测技术带来不便。The node detector is a node detector, which uses the positioning function of GPS (Global Positioning System, global positioning system) to obtain position coordinate information, and the obtained position information is the necessary basic data for the node detector to implement the data collection process. With the support of these location information data, the nodal instrument can establish the correlation between the seismic wave signal and the location of the receiving point. In recent years, with the development of communication technology, the wireless node instrument has the advantages of convenient installation, rich interfaces and more stable performance. The seismic exploration and acquisition technology has gradually developed from wired node instrument to wireless node instrument. However, since the wireless node instrument needs to be powered by batteries, and the GPS module is a high power consumption module, when the wireless node instrument is used for seismic exploration and acquisition, the power loss of the battery is large, and the battery needs to be replaced or charged frequently; bring inconvenience.
因此,目前亟需一种能够降低节点仪功耗的方法。Therefore, there is an urgent need for a method capable of reducing the power consumption of the node instrument.
发明内容SUMMARY OF THE INVENTION
基于此,有必要针对上述技术问题,提供一种GPS数据传输系统、方法、装置、计算机设备及存储介质。Based on this, it is necessary to provide a GPS data transmission system, method, apparatus, computer equipment and storage medium for the above technical problems.
在其中一个实施例中,一种GPS数据传输系统,该系统包括:客户端、服务器、LoRa网关及节点仪;In one of the embodiments, a GPS data transmission system, the system includes: a client, a server, a LoRa gateway and a node instrument;
所述客户端用于向所述服务器发送获取GPS数据的请求指令,其中,所述请求指令包括所请求的设备的设备编码;The client is configured to send a request instruction for acquiring GPS data to the server, wherein the request instruction includes the device code of the requested device;
所述服务器用于在接收到所述请求指令后,将所述请求指令转发至所述LoRa网关;The server is configured to forward the request instruction to the LoRa gateway after receiving the request instruction;
所述LoRa网关用于在接收到所述服务器发送的所述请求指令后,以广播形式将所述请求指令发送至所述节点仪;The LoRa gateway is configured to send the request instruction to the node device in a broadcast form after receiving the request instruction sent by the server;
所述节点仪用于接收到所述请求指令后,判断所述设备编码是否与自身编码相匹配;当所述设备编码与所述自身编码相匹配时,启动GPS模块,以获得GPS数据,并将所述GPS数据发送至服务器;The node device is used to judge whether the device code matches its own code after receiving the request instruction; when the device code matches its own code, start the GPS module to obtain GPS data, and sending the GPS data to a server;
所述服务器还用于接收到所述节点仪发送的所述GPS数据后,将所述GPS数据发送至所述客户端。The server is further configured to send the GPS data to the client after receiving the GPS data sent by the node device.
在其中一个实施例中,所述客户端用于通过消息队列遥测传输的方式向所述服务器发送获取GPS数据的请求指令;In one of the embodiments, the client is configured to send a request instruction for acquiring GPS data to the server by means of message queue telemetry transmission;
所述服务器还用于通过消息队列遥测传输的方式将所述GPS数据发送至所述客户端。The server is further configured to send the GPS data to the client by means of message queue telemetry transmission.
在其中一个实施例中,所述LoRa网关处于长连接状态;所述服务器以套接字的方式将所述请求指令发送至所述LoRa网关。In one embodiment, the LoRa gateway is in a long connection state; the server sends the request instruction to the LoRa gateway in a socket manner.
在其中一个实施例中,所述节点仪用于将所述GPS数据按预设格式进行清洗,得到清洗后的所述GPS数据,并将清洗后的所述GPS数据发送至服务器。In one embodiment, the node instrument is configured to clean the GPS data in a preset format, obtain the cleaned GPS data, and send the cleaned GPS data to a server.
在其中一个实施例中,所述节点仪用于根据所约定报文及清洗后的所述GPS数据,得到回传数据报文,并将所述回传数据报文发送至所述服务器;In one embodiment, the node device is configured to obtain a return data message according to the agreed message and the cleaned GPS data, and send the return data message to the server;
所述服务器用于接收到所述节点仪发送的所述回传数据报文后,对所述回传数据报文进行解析,提取清洗后的所述GPS数据,并将清洗后的所述GPS数据发送至所述客户端。The server is configured to parse the returned data message after receiving the returned data message sent by the node device, extract the cleaned GPS data, and store the cleaned GPS data. Data is sent to the client.
在其中一个实施例中,一种GPS数据传输方法,该方法包括:In one of the embodiments, a GPS data transmission method, the method includes:
接收请求指令,其中所述请求指令包括所请求的设备的设备编码;receiving a request instruction, wherein the request instruction includes a device code of the requested device;
判断所述设备编码是否与预设编码相匹配;Determine whether the device code matches the preset code;
当所述设备编码与所述预设编码相匹配时,启动GPS模块,并通过所述GPS模块获得GPS数据;When the device code matches the preset code, start the GPS module, and obtain GPS data through the GPS module;
将所述GPS数据发送至服务器。The GPS data is sent to the server.
在其中一个实施例中,在所述将所述GPS数据发送至服务器的步骤之前,包括:In one embodiment, before the step of sending the GPS data to the server, it includes:
将所述GPS数据按预设格式进行清洗,得到清洗后的所述GPS数据;Cleaning the GPS data according to a preset format to obtain the cleaned GPS data;
所述将所述GPS数据发送至服务器的步骤,包括:The step of sending the GPS data to the server includes:
将所述清洗后的所述GPS数据发送至所述服务器。Send the cleaned GPS data to the server.
在其中一个实施例中,一种GPS数据传输装置,该装置包括:In one of the embodiments, a GPS data transmission device, the device includes:
接收模块,用于接收请求指令,其中所述请求指令包括所请求的设备的设备编码;a receiving module, configured to receive a request instruction, wherein the request instruction includes the device code of the requested device;
判断模块,用于判断所述设备编码是否与预设编码相匹配;a judgment module for judging whether the device code matches the preset code;
获取模块,用于当所述设备编码与所述预设编码相匹配时,启动GPS模块,并通过所述GPS模块获得GPS数据;an acquisition module, configured to start the GPS module when the device code matches the preset code, and obtain GPS data through the GPS module;
发送模块,用于将所述GPS数据发送至服务器。The sending module is used for sending the GPS data to the server.
在其中一个实施例中,一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时实现上述任一实施例中所述方法的步骤。In one of the embodiments, a computer device includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the method described in any of the foregoing embodiments are implemented.
在其中一个实施例中,一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现上述任一实施例中所述的方法的步骤。In one of the embodiments, a computer-readable storage medium has a computer program stored thereon, and the computer program, when executed by a processor, implements the steps of the method described in any of the foregoing embodiments.
上述GPS数据传输系统,用户需要接收节点仪的GPS数据,通过客户端向服务器发送获取GPS数据的请求指令,服务器将接收到的请求指令发送至LoRa网关,LoRa网关接收到服务器转发的请求指令后,以广播的形式向节点仪发送请求指令,节点仪接收到请求指令时,检验请求指令中的设备编码与自身编码是否相匹配,当设备编码与自身编码相匹配时,则启动GPS模块采集GPS数据,以使节点仪获取GPS数据,节点仪将获取的GPS数据发送至服务器,再由服务器将GPS数据发送至客户端,以使客户端获取GPS数据,以实现GPS数据的传输,且由于是根据用户需求再启动GPS模块,GPS模块无需实时进行定位,即根据按需使用的原则,可以降低节点仪的电能损耗,从而延长节点仪的电池寿命,减少更换电池次数或者充电次数。In the above GPS data transmission system, the user needs to receive the GPS data of the node instrument, and sends a request command to obtain GPS data to the server through the client, and the server sends the received request command to the LoRa gateway. After the LoRa gateway receives the request command forwarded by the server , send the request command to the node instrument in the form of broadcast. When the node instrument receives the request command, it checks whether the device code in the request command matches its own code. When the device code matches its own code, it starts the GPS module to collect GPS data, so that the node instrument can obtain GPS data, the node instrument will send the acquired GPS data to the server, and then the server will send the GPS data to the client, so that the client can obtain the GPS data, so as to realize the transmission of GPS data, and because it is Restart the GPS module according to the user's needs, the GPS module does not need to perform real-time positioning, that is, according to the principle of on-demand use, it can reduce the power consumption of the node instrument, thereby prolonging the battery life of the node instrument, and reducing the number of battery replacements or charging times.
附图说明Description of drawings
图1为一个实施例中GPS数据传输方法的流程示意图;1 is a schematic flowchart of a GPS data transmission method in one embodiment;
图2为一个实施例中GPS数据传输装置的结构框图;Fig. 2 is the structural block diagram of the GPS data transmission device in one embodiment;
图3为一个实施例中计算机设备的内部结构图。FIG. 3 is a diagram of the internal structure of a computer device in one embodiment.
具体实施方式Detailed ways
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。In order to make the purpose, technical solutions and advantages of the present application more clearly understood, the present application will be described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application, but not to limit the present application.
在其中一个实施例中,提供一种GPS数据传输系统,该系统包括:客户端、服务器、LoRa网关及节点仪;In one of the embodiments, a GPS data transmission system is provided, and the system includes: a client, a server, a LoRa gateway and a node instrument;
所述客户端用于向所述服务器发送获取GPS数据的请求指令,其中,所述请求指令包括所请求的设备的设备编码;The client is configured to send a request instruction for acquiring GPS data to the server, wherein the request instruction includes the device code of the requested device;
所述服务器用于在接收到所述请求指令后,将所述请求指令转发至所述LoRa网关;The server is configured to forward the request instruction to the LoRa gateway after receiving the request instruction;
所述LoRa网关用于在接收到所述服务器发送的所述请求指令后,以广播形式将所述请求指令发送至所述节点仪;The LoRa gateway is configured to send the request instruction to the node device in a broadcast form after receiving the request instruction sent by the server;
所述节点仪用于接收到所述请求指令后,判断所述设备编码是否与自身编码相匹配;当所述设备编码与所述自身编码相匹配时,启动GPS模块,以获得GPS数据,并将所述GPS数据发送至服务器;The node device is used to judge whether the device code matches its own code after receiving the request instruction; when the device code matches its own code, start the GPS module to obtain GPS data, and sending the GPS data to a server;
所述服务器还用于接收到所述节点仪发送的所述GPS数据后,将所述GPS数据发送至所述客户端。The server is further configured to send the GPS data to the client after receiving the GPS data sent by the node device.
上述GPS数据传输系统,用户需要接收节点仪的GPS数据,通过客户端向服务器发送获取GPS数据的请求指令,服务器将接收到的请求指令发送至LoRa网关,LoRa网关接收到服务器转发的请求指令后,以广播的形式向节点仪发送请求指令,节点仪接收到请求指令时,检验请求指令中的设备编码与自身编码是否相匹配,当设备编码与自身编码相匹配时,则启动GPS模块采集GPS数据,以使节点仪获取GPS数据,节点仪将获取的GPS数据发送至服务器,再由服务器将GPS数据发送至客户端,以使客户端获取GPS数据,以实现GPS数据的传输,且由于是根据用户需求再启动GPS模块,GPS模块无需实时进行定位,即根据按需使用的原则,可以降低节点仪的电能损耗,从而延长节点仪的电池寿命,减少更换电池次数或者充电次数。In the above GPS data transmission system, the user needs to receive the GPS data of the node instrument, and sends a request command to obtain GPS data to the server through the client, and the server sends the received request command to the LoRa gateway. After the LoRa gateway receives the request command forwarded by the server , send the request command to the node instrument in the form of broadcast. When the node instrument receives the request command, it checks whether the device code in the request command matches its own code. When the device code matches its own code, it starts the GPS module to collect GPS data, so that the node instrument can obtain GPS data, the node instrument will send the acquired GPS data to the server, and then the server will send the GPS data to the client, so that the client can obtain the GPS data, so as to realize the transmission of GPS data, and because it is Restart the GPS module according to the user's needs, the GPS module does not need to perform real-time positioning, that is, according to the principle of on-demand use, it can reduce the power consumption of the node instrument, thereby prolonging the battery life of the node instrument, and reducing the number of battery replacements or charging times.
第一实施例first embodiment
本实施例提供一种GPS数据传输系统,该系统包括:客户端、服务器、LoRa网关及节点仪;This embodiment provides a GPS data transmission system, and the system includes: a client, a server, a LoRa gateway, and a node instrument;
所述客户端用于向所述服务器发送获取GPS数据的请求指令,其中,所述请求指令包括所请求的设备的设备编码;The client is configured to send a request instruction for acquiring GPS data to the server, wherein the request instruction includes the device code of the requested device;
所述服务器用于在接收到所述请求指令后,将所述请求指令转发至所述LoRa网关;The server is configured to forward the request instruction to the LoRa gateway after receiving the request instruction;
所述LoRa网关用于在接收到所述服务器发送的所述请求指令后,以广播形式将所述请求指令发送至所述节点仪;The LoRa gateway is configured to send the request instruction to the node device in a broadcast form after receiving the request instruction sent by the server;
所述节点仪用于接收到所述请求指令后,判断所述设备编码是否与自身编码相匹配;当所述设备编码与所述自身编码相匹配时,启动GPS模块,以获得GPS数据,并将所述GPS数据发送至服务器;The node device is used to judge whether the device code matches its own code after receiving the request instruction; when the device code matches its own code, start the GPS module to obtain GPS data, and sending the GPS data to a server;
所述服务器还用于接收到所述节点仪发送的所述GPS数据后,将所述GPS数据发送至所述客户端。The server is further configured to send the GPS data to the client after receiving the GPS data sent by the node device.
具体的,客户端即中央客户端,又称为用户端,其是指与服务器相对应,为客户提供本地服务的程序。客户端供用户进行操作,当用户需要获取节点仪的位置坐标信息时,通过用户端向服务器发送获取GPS数据的请求指令,该指令包含所请求的设备的设备编码,即所请求节点仪的设备编码,客户端需确定需要获取GPS数据的节点仪的设备编号。例如,用户通过手动输入所需获取对应节点仪的设备编号,也可以先将所有节点仪的设备编号存储只列表中,从列表中选择需要获取GPS数据的节点仪的设备编号。Specifically, the client is the central client, also known as the client, which refers to a program corresponding to the server and providing local services for the client. The client is for the user to operate. When the user needs to obtain the position and coordinate information of the node instrument, the user sends a request command for obtaining GPS data to the server through the client. The command contains the device code of the requested device, that is, the device of the requested node instrument. code, the client needs to determine the device number of the node instrument that needs to obtain GPS data. For example, the user can manually input the device number of the corresponding node device to be obtained, or first store the device numbers of all node devices in the list, and select the device number of the node device that needs to obtain GPS data from the list.
具体的,LoRa(Long Range Radio,远距离无线电)网关也称为LoRa基站,其是利用LoRa无线调制技术实现远距离数据传输的网关设备。LoRa网关采用工业级32位专用网络处理器及高速4G无线通讯模块设计,支持APN/VPDN无线专网,支持LoRaWAN通信规范,支持GPS高精度时钟同步,具备多频点、多信道的并发处理能力。通过设置LoRa网关,服务器将从客户端接收的请求指令发送至LoRa网关,LoRa网关通过无线通信技术将请求指令广播至节点仪上,实现了节点仪与客户端的无线传输。Specifically, a LoRa (Long Range Radio, long-distance radio) gateway is also called a LoRa base station, which is a gateway device that uses LoRa wireless modulation technology to realize long-distance data transmission. LoRa gateway is designed with industrial-grade 32-bit dedicated network processor and high-speed 4G wireless communication module, supports APN/VPDN wireless private network, supports LoRaWAN communication specification, supports GPS high-precision clock synchronization, and has multi-frequency and multi-channel concurrent processing capabilities . By setting the LoRa gateway, the server sends the request instruction received from the client to the LoRa gateway, and the LoRa gateway broadcasts the request instruction to the node instrument through wireless communication technology, realizing wireless transmission between the node instrument and the client.
具体的,广播是一种信息的传播方式,其是指网络中的某一设备同时向网络中的所有其他设备发送数据,这个数据所能广播到的范围即为广播域。对应的,本申请,LoRa网关通过无线传输技术同时向网络中的所有节点仪发送请求指令。Specifically, broadcasting is a way of disseminating information, which means that a certain device in the network sends data to all other devices in the network at the same time, and the range to which this data can be broadcast is the broadcast domain. Correspondingly, in this application, the LoRa gateway simultaneously sends request instructions to all nodes in the network through wireless transmission technology.
具体的,节点仪获取LoRa网关发送的请求指令,判断请求指令中的设备编码是否与自身编码相匹配;若相匹配,则说明该节点仪为客户端所需要获取GPS数据的节点仪,启动节点仪中的GPS模块,GPS模块进行定位,以获取GPS数据,即节点仪通过GPS模块获取GPS数据,然后节点仪将获取的GPS数据通过服务器转发至客户端,以使客户端能够收到对应的节点仪的GPS数据。本实施例中,请求指令是通过客户端发送,即根据按需使用原则,当用户需要获取GPS数据时,才启动GPS模块进行定位,无需实时进行定位,可以降低节点仪的电能损耗,从而延长节点仪的电池使用寿命。并且对于不是客户端所请求的节点仪,由于发送请求指令中包含的设备编码与其自身编码不匹配,则保持待机状态,进一步降低节点仪的电能损耗。Specifically, the node device obtains the request command sent by the LoRa gateway, and determines whether the device code in the request command matches its own code; if it matches, it means that the node device is the node device that the client needs to obtain GPS data, and starts the node. The GPS module in the instrument, the GPS module performs positioning to obtain GPS data, that is, the node instrument obtains GPS data through the GPS module, and then the node instrument forwards the acquired GPS data to the client through the server, so that the client can receive the corresponding GPS data. GPS data of the node meter. In this embodiment, the request instruction is sent through the client, that is, according to the principle of on-demand use, when the user needs to obtain GPS data, the GPS module is activated for positioning, and real-time positioning is not required, which can reduce the power consumption of the node meter, thereby prolonging the The battery life of the node meter. And for the node instrument that is not requested by the client, since the device code contained in the sending request instruction does not match its own code, it will remain in a standby state, further reducing the power consumption of the node instrument.
上述GPS数据传输系统,用户需要接收节点仪的GPS数据,通过客户端向服务器发送获取GPS数据的请求指令,服务器将接收到的请求指令发送至LoRa网关,LoRa网关接收到服务器转发的请求指令后,以广播的形式向节点仪发送请求指令,节点仪接收到请求指令时,检验请求指令中的设备编码与自身编码是否相匹配,当设备编码与自身编码相匹配时,则启动GPS模块采集GPS数据,以使节点仪获取GPS数据,节点仪将获取的GPS数据发送至服务器,再由服务器将GPS数据发送至客户端,以使客户端获取GPS数据,以实现GPS数据的传输,且由于是根据用户需求再启动GPS模块,GPS模块无需实时进行定位,即根据按需使用的原则,可以降低节点仪的电能损耗,从而延长节点仪的电池寿命,减少更换电池次数或者充电次数。In the above GPS data transmission system, the user needs to receive the GPS data of the node instrument, and sends a request command to obtain GPS data to the server through the client, and the server sends the received request command to the LoRa gateway. After the LoRa gateway receives the request command forwarded by the server , send the request command to the node instrument in the form of broadcast. When the node instrument receives the request command, it checks whether the device code in the request command matches its own code. When the device code matches its own code, it starts the GPS module to collect GPS data, so that the node instrument can obtain GPS data, the node instrument will send the acquired GPS data to the server, and then the server will send the GPS data to the client, so that the client can obtain the GPS data, so as to realize the transmission of GPS data, and because it is Restart the GPS module according to the user's needs, the GPS module does not need to perform real-time positioning, that is, according to the principle of on-demand use, it can reduce the power consumption of the node instrument, thereby prolonging the battery life of the node instrument, and reducing the number of battery replacements or charging times.
在其中一个实施例中,所述客户端用于通过消息队列遥测传输的方式向所述服务器发送获取GPS数据的请求指令;In one of the embodiments, the client is configured to send a request instruction for acquiring GPS data to the server by means of message queue telemetry transmission;
所述服务器还用于通过消息队列遥测传输的方式将所述GPS数据发送至所述客户端。The server is further configured to send the GPS data to the client by means of message queue telemetry transmission.
具体的,消息队列遥测传输即MQTT(Message Queuing Telemetry Transport,消息队列遥测传输),其是一种基于轻量级代理的发布或者订阅模式的消息传输协议,运行在TCP协议栈之上,为其提供有序、可靠、双向连接的网络连接保证。且消息队列遥测传输具有以下特点:Specifically, Message Queuing Telemetry Transport is MQTT (Message Queuing Telemetry Transport, Message Queuing Telemetry Transport), which is a light-weight proxy-based publish or subscribe message transport protocol, running on top of the TCP protocol stack, for the Provides an orderly, reliable, two-way connection network connection guarantee. And the message queue telemetry transmission has the following characteristics:
(1)MQTT消息带宽小,设计合理在低功率系统上实施;(1) MQTT message bandwidth is small, and the design is reasonable to implement on low-power systems;
(2)实现MQTT非常简单远程传感器系统上的消息。由于大部分复杂工作都是在服务器上实现的,因此远程系统可以在其他地方使用其资源。(2) It is very simple to implement MQTT messages on remote sensor systems. Since most of the complex work is done on the server, the remote system can use its resources elsewhere.
(3)MQTT用于任务关键型传感器系统,其中发送的任何消息都得到确认和接收至关重要。MQTT允许通过声明其服务质量(QOS)级别来定义消息的重要性。(3) MQTT is used in mission-critical sensor systems where it is critical that any message sent is acknowledged and received. MQTT allows the importance of a message to be defined by declaring its Quality of Service (QOS) level.
因此,服务器与客户端通过MQTT方式进行数据传输,可以降低协议开销,降低客户端的电能损耗,数据传输稳定可靠。Therefore, the data transmission between the server and the client through MQTT can reduce the protocol overhead, reduce the power consumption of the client, and the data transmission is stable and reliable.
在其中一个实施例中,所述请求指令还包括帧头、命令码、循环冗余校验码及结束符,所述帧头、所述设备编码、所述命令码、所述循环冗余校验码及所述结束符依次排列。具体的,循环冗余校验码即CRC8(CyclicRedundancyCheck,循环冗余校验码);帧头为“$”占用1个字节,节点仪的设备编码为8位字符编码组成,占用8个字节,命令码占用2个字节,循环冗余校验码占用1个字节,结束符为回车换行“\r\n”,占用2个字节。例如,命令码为“61”,CRC8为指令前11个字符编码的校验值。通过将请求指令按所述帧头、所述设备编码、所述命令码、循环冗余校验码及所述结束符依次排列组成,以使得节点仪在解析请求指令时,能更好地判断请求指令中的设备编码是否与自身编码相匹配。在其中一个实施例中,所述请求指令由帧头、设备编码、命令码、循环冗余校验码及所述结束符依次排列组成。本实施例中,命令码为第一命令码,循环冗余校验码为第一循环冗余校验码。In one embodiment, the request instruction further includes a frame header, a command code, a cyclic redundancy check code, and a terminator, the frame header, the device code, the command code, the cyclic redundancy check code, and the cyclic redundancy check code. The verification code and the terminator are arranged in sequence. Specifically, the cyclic redundancy check code is CRC8 (CyclicRedundancyCheck, cyclic redundancy check code); the frame header is "$" and occupies 1 byte, and the device code of the node instrument is composed of 8-bit character code, occupying 8 words section, the command code occupies 2 bytes, the cyclic redundancy check code occupies 1 byte, and the terminator is carriage return and line feed "\r\n", which occupies 2 bytes. For example, the command code is "61", and CRC8 is the check value encoded by the first 11 characters of the command. By arranging the request command in sequence according to the frame header, the device code, the command code, the cyclic redundancy check code and the terminator, the node instrument can better judge when parsing the request command. Whether the device encoding in the request command matches its own encoding. In one embodiment, the request instruction is composed of a frame header, a device code, a command code, a cyclic redundancy check code, and the terminator in sequence. In this embodiment, the command code is the first command code, and the cyclic redundancy check code is the first cyclic redundancy check code.
在其中一个实施例中,所述LoRa网关处于长连接状态;所述服务器以套接字的方式将所述请求指令发送至所述LoRa网关。具体的,长连接指在一个连接上可以连续发送多个数据包,在连接保持期间,如果没有数据包发送,需要双方发链路检测包。套接字即socket,其是对网络中不同主机上的应用进程之间进行双向通信的端点的抽象。一个套接字就是网络上进程通信的一端,提供了应用层进程利用网络协议交换数据的机制。从所处的地位来讲,套接字上联应用进程,下联网络协议栈,是应用程序通过网络协议进行通信的接口,是应用程序与网络协议根进行交互的接口,套接字是通信的基石,是支持TCP(Transmission Control Protocol,传输控制协议)/IP(Internet Protocol,国际网络协议)协议的路通信的基本操作单元。本实施例中,服务器获取到客户端发送过来的请求指令,向处于长连接状态的LoRa网关以纯socket的方式发送请求指令,从而实现服务器与LoRa网关的通信。In one embodiment, the LoRa gateway is in a long connection state; the server sends the request instruction to the LoRa gateway in a socket manner. Specifically, a long connection means that multiple data packets can be continuously sent on one connection. During the connection maintaining period, if no data packets are sent, both parties need to send link detection packets. A socket is a socket, which is an abstraction of an endpoint for bidirectional communication between application processes on different hosts in a network. A socket is one end of process communication on the network, providing a mechanism for application layer processes to exchange data using network protocols. From the perspective of its position, the socket is connected to the application process and the network protocol stack is connected. It is the interface for the application to communicate through the network protocol, and it is the interface for the application to interact with the network protocol root. The socket is the communication interface. The cornerstone is the basic operation unit of road communication that supports TCP (Transmission Control Protocol, Transmission Control Protocol)/IP (Internet Protocol, Internet Protocol) protocol. In this embodiment, the server obtains the request instruction sent by the client, and sends the request instruction to the LoRa gateway in a long connection state in a pure socket manner, thereby realizing the communication between the server and the LoRa gateway.
在其中一个实施例中,所述节点仪用于将所述GPS数据按预设格式进行清洗,得到清洗后的所述GPS数据,并将清洗后的所述GPS数据发送至服务器。具体的,清洗即数据清洗,其是发现并纠正数据文件中可识别的错误的最后一道程序,包括检查数据一致性,处理无效值和缺失值等。因为数据仓库中的数据是面向某一主题的数据的集合,这些数据从多个业务系统中抽取而来而且包含历史数据,这样就避免不了有的数据是错误数据、有的数据相互之间有冲突,这些错误的或有冲突的数据显然是我们不想要的,称为“脏数据”。数据清洗的目的是为了将很多种不同的信息安全检测的工具统一成平台专用格式,并且提取有用的数据,用于后续流程的数据流转。本实施例中,GPS模块采集GPS数据,节点仪将采集的GPS按预设格式进行清洗,即将GPS数据设置为预设格式,并将清洗后的GPS数据发送至服务器,从而可以保证GPS数据传输的完整性。在其中一个实施例中,所述预设格式为JSON(JavaScript Object Notation,JS,对象简谱)格式。JSON格式为如下:In one embodiment, the node instrument is configured to clean the GPS data in a preset format, obtain the cleaned GPS data, and send the cleaned GPS data to a server. Specifically, cleaning is data cleaning, which is the last procedure to find and correct identifiable errors in data files, including checking data consistency, dealing with invalid and missing values, and so on. Because the data in the data warehouse is a collection of data oriented to a certain topic, these data are extracted from multiple business systems and contain historical data, so it is inevitable that some data are wrong data, and some data are interrelated with each other. Conflicts, these erroneous or conflicting data that we obviously don't want, are called "dirty data". The purpose of data cleaning is to unify many different information security detection tools into a platform-specific format, and extract useful data for data flow in subsequent processes. In this embodiment, the GPS module collects GPS data, and the node meter cleans the collected GPS according to the preset format, that is, sets the GPS data to the preset format, and sends the cleaned GPS data to the server, so as to ensure the GPS data transmission completeness. In one embodiment, the preset format is a JSON (JavaScript Object Notation, JS, Object Notation) format. The JSON format is as follows:
{"GPS":"JJJJJJJJJJJEWWWWWWWWWWNHHHHHvvYYYYMMDDTTMM SS"}{"GPS":"JJJJJJJJJJJEWWWWWWWWWWNHHHHHvvYYYYMMDDTTMM SS"}
为了便于理解举一具体实施例,所采集的GPS数据为:In order to facilitate understanding, a specific embodiment is given, the collected GPS data is:
{"GPS":"11844.00253E3204.22579N+002720720200211135604"}{"GPS":"11844.00253E3204.22579N+002720720200211135604"}
上述JSON格式中各字符的所表达的意思为:The meaning of each character in the above JSON format is:
(1)11个J表示经度的意思,该实施例中表示经度为118度44分,0.00253*60=0.1518秒。(1) 11 Js represent longitude, and in this embodiment, the longitude is 118 degrees and 44 minutes, and 0.00253*60=0.1518 seconds.
(2)E代表东经的意思,如果是W就是西经。(2) E means east longitude, if it is W, it means west longitude.
(3)10个W表示纬度的意思,该实施例中表示纬度为32度04分,0.22579*60=13.5474秒。(3) 10 Ws represent the meaning of latitude. In this embodiment, it represents that the latitude is 32 degrees and 04 minutes, and 0.22579*60=13.5474 seconds.
(4)N代表北半球意思,南半球就是用S表示。(4) N stands for the northern hemisphere, and S for the southern hemisphere.
(5)6个H代表高度,最高999999,单位为分米。该实施例中表示高度27.2m。(5) 6 Hs represent height, the maximum is 999999, and the unit is decimeter. In this example, the height is 27.2 m.
(6)2个V在使用的卫星个数。该实施例表示卫星数7个。(6) The number of satellites in use by 2 V. This example shows seven satellites.
(7)UTC时间,年月日时分秒。(7) UTC time, year, month, day, hour, minute, second.
如此,通过将GPS数据清洗成JSON格式,可以清楚地表示节点仪中GPS模块所采集的GPS数据。且清洗后的GPS数据所占用资源少,传输效率高,更加稳定。In this way, by cleaning the GPS data into JSON format, the GPS data collected by the GPS module in the node instrument can be clearly represented. Moreover, the cleaned GPS data occupies less resources, has high transmission efficiency and is more stable.
在其中一个实施例中,所述节点仪用于根据所约定报文及清洗后的所述GPS数据,得到回传数据报文,并将所述回传数据报文发送至所述服务器;In one embodiment, the node device is configured to obtain a return data message according to the agreed message and the cleaned GPS data, and send the return data message to the server;
所述服务器用于接收到所述节点仪发送的所述回传数据报文后,对所述回传数据报文进行解析,提取清洗后的所述GPS数据,并将清洗后的所述GPS数据发送至所述客户端。The server is configured to parse the returned data message after receiving the returned data message sent by the node device, extract the cleaned GPS data, and store the cleaned GPS data. Data is sent to the client.
具体的,所述节点仪用于根据所约定报文及清洗后的所述GPS数据,得到回传数据报文,即将GPS数据代入约定报文中,从而得到回传数据报文。该回传数据报文包括包长、命令码、设备编码、清洗后的GPS数据及循环冗余检验码,包长、命令码、设备编码、清洗后的GPS数据及循环冗余检验码依序排列。在其中一个实施例中,所述回传数据报由包长、命令码、设备编码、清洗后的GPS数据及循环冗余检验码组成,包长、命令码、设备编码、清洗后的GPS数据及循环冗余检验码依序排列。其中,包长为4个字节(int整型),包长为整个报文的长度,命令码2个字节,例如:命令码为“61”;设备编码为8个字节,该设备编码为获得GPS数据所对应的节点仪的设备编码,也就是客户端所请求的设备编码。循环冗余校验码占用一个字节,循环冗余校验码为报文的校验和;清洗后的GPS数据即JSON格式的GPS数据。通过将GPS数据以约定报文的形式进行传输,使得服务器在接收到回传数据报文时,方便对报文解析,从而更好地提取回传数据报文中所包含的GPS数据,也保证了GPS数据传输的稳定性。本实施例中,所述命令码为第二命令码,所述循环冗余校验码为第二循环冗余校验码。Specifically, the node device is configured to obtain the return data message according to the agreed message and the cleaned GPS data, that is, substitute the GPS data into the agreed message to obtain the return data message. The returned data message includes packet length, command code, device code, cleaned GPS data and cyclic redundancy check code. The packet length, command code, device code, cleaned GPS data and cyclic redundancy check code are in sequence. arrangement. In one embodiment, the returned datagram is composed of packet length, command code, device code, cleaned GPS data, and cyclic redundancy check code. The packet length, command code, device code, and cleaned GPS data and cyclic redundancy check codes are arranged in sequence. Among them, the packet length is 4 bytes (int integer), the packet length is the length of the entire message, and the command code is 2 bytes, for example: the command code is "61"; the device code is 8 bytes, the device The code is the device code of the node instrument corresponding to the obtained GPS data, that is, the device code requested by the client. The cyclic redundancy check code occupies one byte, and the cyclic redundancy check code is the checksum of the message; the cleaned GPS data is the GPS data in JSON format. By transmitting the GPS data in the form of a contracted message, the server can easily parse the message when receiving the returned data message, so as to better extract the GPS data contained in the returned data message, and also ensure The stability of GPS data transmission. In this embodiment, the command code is a second command code, and the cyclic redundancy check code is a second cyclic redundancy check code.
以下是一种GPS数据传输系统的具体实施例,该系统包括:客户端、服务器、LoRa网关及节点仪;The following is a specific embodiment of a GPS data transmission system, the system includes: a client, a server, a LoRa gateway and a node instrument;
所述客户端用于通过消息队列遥测传输的方式向所述服务器发送获取GPS数据的请求指令,其中,所述请求指令包括帧头、第一命令码、设备编码、第一循环冗余校验码及结束符,所述帧头、所述设备编码、所述第一命令码、所述第一循环冗余校验码及所述结束符依次排列;The client is configured to send a request instruction for acquiring GPS data to the server by means of message queue telemetry transmission, wherein the request instruction includes a frame header, a first command code, a device code, and a first cyclic redundancy check. code and terminator, the frame header, the device code, the first command code, the first cyclic redundancy check code and the terminator are arranged in sequence;
所述服务器用于在接收到所述请求指令后,将所述请求指令以套接字的方式转发至所述LoRa网关;The server is configured to forward the request instruction to the LoRa gateway in a socket manner after receiving the request instruction;
所述LoRa网关用于在接收到所述服务器发送的所述请求指令后,以广播形式将所述请求指令发送至所述节点仪;The LoRa gateway is configured to send the request instruction to the node device in a broadcast form after receiving the request instruction sent by the server;
所述节点仪用于接收到所述请求指令后,判断所述设备编码是否与自身编码相匹配;当所述设备编码与所述自身编码相匹配时,启动GPS模块,以获得GPS数据,将所述GPS数据按预设格式进行清洗,得到清洗后的所述GPS数据;根据所约定报文及清洗后的所述GPS数据,得到回传数据报文,并将所述回传数据报文发送至所述服务器;其中,所述预设格式为JSON格式,JSON格式为:The node device is used to judge whether the device code matches its own code after receiving the request instruction; when the device code matches its own code, start the GPS module to obtain GPS data, and The GPS data is cleaned according to a preset format, and the cleaned GPS data is obtained; according to the agreed message and the cleaned GPS data, a return data message is obtained, and the returned data message is sent back. Sent to the server; wherein, the preset format is JSON format, and the JSON format is:
{"GPS":"JJJJJJJJJJJEWWWWWWWWWWNHHHHHvvYYYYMMDDTTMM SS"}{"GPS":"JJJJJJJJJJJEWWWWWWWWWWNHHHHHvvYYYYMMDDTTMM SS"}
所述回传数据报文由包长、第二命令码、设备编码、清洗后的GPS数据及第二循环冗余检验码组成,包长、第二命令码、设备编码、清洗后的GPS数据及第二循环冗余检验码依序排列;The returned data message is composed of the packet length, the second command code, the device code, the cleaned GPS data, and the second cyclic redundancy check code. The packet length, the second command code, the device code, and the cleaned GPS data and the second cyclic redundancy check codes are arranged in sequence;
所述服务器用于接收到所述节点仪发送的所述回传数据报文后,对所述回传数据报文进行解析,提取清洗后的所述GPS数据,并将清洗后的所述GPS数据发送至所述客户端,并将清洗后的所述GPS数据存储到本地磁盘。The server is configured to parse the returned data message after receiving the returned data message sent by the node device, extract the cleaned GPS data, and store the cleaned GPS data. The data is sent to the client, and the cleaned GPS data is stored on a local disk.
上述GPS数据传输系统,用户需要接收节点仪的GPS数据,通过客户端向服务器发送获取GPS数据的请求指令,服务器将接收到的请求指令发送至LoRa网关,LoRa网关接收到服务器转发的请求指令后,以广播的形式向节点仪发送请求指令,节点仪接收到请求指令时,检验请求指令中的设备编码与自身编码是否相匹配,当设备编码与自身编码相匹配时,则启动GPS模块采集GPS数据,以使节点仪获取GPS数据,节点仪将获取的GPS数据发送至服务器,再由服务器将GPS数据发送至客户端,以使客户端获取GPS数据,以实现GPS数据的传输,且由于是根据用户需求再启动GPS模块,GPS模块无需实时进行定位,即根据按需使用的原则,可以降低节点仪的电能损耗,从而延长节点仪的电池寿命,减少更换电池次数或者充电次数;同时设计一套自有的传输协议保证GPS数据信息传输的完整性。In the above GPS data transmission system, the user needs to receive the GPS data of the node instrument, and sends a request command to obtain GPS data to the server through the client, and the server sends the received request command to the LoRa gateway. After the LoRa gateway receives the request command forwarded by the server , send the request command to the node instrument in the form of broadcast. When the node instrument receives the request command, it checks whether the device code in the request command matches its own code. When the device code matches its own code, it starts the GPS module to collect GPS data, so that the node instrument can obtain GPS data, the node instrument will send the acquired GPS data to the server, and then the server will send the GPS data to the client, so that the client can obtain the GPS data, so as to realize the transmission of GPS data, and because it is Restart the GPS module according to the user's needs, the GPS module does not need to perform real-time positioning, that is, according to the principle of on-demand use, the power consumption of the node instrument can be reduced, thereby prolonging the battery life of the node instrument and reducing the number of battery replacements or charging times; Set of its own transmission protocol to ensure the integrity of GPS data information transmission.
第二实施例Second Embodiment
本实施例中,提供一种GPS数据传输方法,该方法包括:In this embodiment, a GPS data transmission method is provided, and the method includes:
接收请求指令,其中所述请求指令包括所请求的设备的设备编码;receiving a request instruction, wherein the request instruction includes a device code of the requested device;
判断所述设备编码是否与预设编码相匹配;Determine whether the device code matches the preset code;
当所述设备编码与所述预设编码相匹配时,启动GPS模块,并通过所述GPS模块获得GPS数据;When the device code matches the preset code, start the GPS module, and obtain GPS data through the GPS module;
将所述GPS数据发送至服务器。The GPS data is sent to the server.
上述GPS数据传输方法,在接收到请求指令时,检测请求指令中的设备编码与自身编码是否相匹配,当设备编码与预设编码相匹配时,则启动GPS模块采集GPS数据,以使节点仪获取GPS数据,节点仪将获取的GPS数据发送至服务器,以实现GPS数据的传输,且由于是根据用户需求再启动GPS模块,GPS模块无需实时进行定位,即根据按需使用的原则,可以降低节点仪的电能损耗,从而延长节点仪的电池寿命。The above GPS data transmission method, when receiving the request command, detects whether the device code in the request command matches its own code, and when the device code matches the preset code, the GPS module is started to collect GPS data, so that the node instrument To obtain GPS data, the node instrument sends the obtained GPS data to the server to realize the transmission of GPS data, and since the GPS module is restarted according to the user's needs, the GPS module does not need to perform real-time positioning, that is, according to the principle of on-demand use, it can reduce Power consumption of the node meter, thereby extending the battery life of the node meter.
请参阅图1,在其中一个实施例中,提供一种GPS数据传输方法,该方法包括:Referring to FIG. 1, in one embodiment, a GPS data transmission method is provided, the method includes:
S110,接收请求指令,其中所述请求指令包括所请求的设备的设备编码;S110, receive a request instruction, wherein the request instruction includes the device code of the requested device;
具体的,请求指令由客户端发送,当用户需要获取节点仪的位置坐标信息时,通过用户端向服务器发送获取GPS数据的请求指令,该指令包含所请求的设备编号,即客户端需确定需要获取GPS数据的节点仪的设备编号。例如,用户通过手动输入所需获取对应节点仪的设备编号,也可以先将所有节点仪的设备编号存储只列表中,从列表中选择需要获取GPS数据的节点仪的设备编号。Specifically, the request instruction is sent by the client. When the user needs to obtain the position coordinate information of the node instrument, the user sends the request instruction for obtaining GPS data to the server through the client. The instruction includes the requested device number, that is, the client needs to determine the need Device ID of the node instrument that obtains GPS data. For example, the user can manually input the device number of the corresponding node device to be obtained, or first store the device numbers of all node devices in the list, and select the device number of the node device that needs to obtain GPS data from the list.
具体的,客户端将所述请求指令发送至服务器,服务器在接收到所述请求指令后,通过转发的方式将所述请求指令转发至所述LoRa网关;所述LoRa网关在接收到所述服务器发送的所述请求指令后,以广播形式将所述请求指令发送至所述节点仪;从而使得节点仪接收到请求指令。Specifically, the client sends the request instruction to the server, and the server forwards the request instruction to the LoRa gateway by forwarding after receiving the request instruction; the LoRa gateway receives the request instruction from the server. After the request instruction is sent, the request instruction is sent to the node instrument in the form of broadcast, so that the node instrument receives the request instruction.
具体的,广播是一种信息的传播方式,其是指网络中的某一设备同时向网络中的所有其他设备发送数据,这个数据所能广播到的范围即为广播域。对应的,本申请,LoRa网关通过无线传输技术同时向网络中的所有节点仪发送请求指令。Specifically, broadcasting is a way of disseminating information, which means that a certain device in the network sends data to all other devices in the network at the same time, and the range to which this data can be broadcast is the broadcast domain. Correspondingly, in this application, the LoRa gateway simultaneously sends request instructions to all nodes in the network through wireless transmission technology.
S120,判断所述设备编码是否与预设编码相匹配;S120, judging whether the device code matches the preset code;
具体的,请求指令包含所请求的节点仪的设备编码,因此,提取请求指令中的设备编码与预设编码进行匹配,以判断该节点仪是否为客户端所请求的节点仪。Specifically, the request instruction includes the device code of the requested node device, therefore, the device code in the extraction request command is matched with the preset code to determine whether the node device is the node device requested by the client.
S130,当所述设备编码与所述预设编码相匹配时,启动GPS模块,并通过所述GPS模块获得GPS数据;S130, when the device code matches the preset code, start the GPS module, and obtain GPS data through the GPS module;
具体的,若相匹配,则说明该节点仪为客户端所需要获取GPS数据的节点仪,启动节点仪中的GPS模块,GPS模块进行定位,以获取GPS数据,即以使节点仪获取GPS数据,然后节点仪将获取的GPS数据通过服务器转发至客户端,以使客户端能够收到对应的节点仪的GPS数据。本实施例中,请求指令是通过客户端发送,即根据按需使用原则,当用户需要获取GPS数据时,才启动GPS模块进行定位,无需实时进行定位,可以降低节点仪的电能损耗,从而延长节点仪的电池使用寿命。并且对于不是客户端所请求的节点仪,由于发送请求指令中包含的设备编码与其自身编码不匹配,则保持待机状态,进一步降低节点仪的电能损耗。Specifically, if they match, it means that the node device is the node device that the client needs to obtain GPS data, start the GPS module in the node device, and the GPS module performs positioning to obtain GPS data, that is, the node device can obtain GPS data. , and then the node instrument forwards the acquired GPS data to the client through the server, so that the client can receive the GPS data of the corresponding node instrument. In this embodiment, the request instruction is sent through the client, that is, according to the principle of on-demand use, when the user needs to obtain GPS data, the GPS module is activated for positioning, and real-time positioning is not required, which can reduce the power consumption of the node meter, thereby prolonging the The battery life of the node meter. And for the node instrument that is not requested by the client, since the device code contained in the sending request instruction does not match its own code, it will remain in a standby state, further reducing the power consumption of the node instrument.
S140,将所述GPS数据发送至服务器。S140, sending the GPS data to a server.
上述GPS数据传输方法,在接收到请求指令时,检测请求指令中的设备编码与自身编码是否相匹配,当设备编码与预设编码相匹配时,则启动GPS模块采集GPS数据,以使节点仪获取GPS数据,节点仪将获取的GPS数据发送至服务器,以实现GPS数据的传输,且由于是根据用户需求再启动GPS模块,GPS模块无需实时进行定位,即根据按需使用的原则,可以降低节点仪的电能损耗,从而延长节点仪的电池寿命,减少更换电池次数或者充电次数。The above GPS data transmission method, when receiving the request command, detects whether the device code in the request command matches its own code, and when the device code matches the preset code, the GPS module is started to collect GPS data, so that the node instrument To obtain GPS data, the node instrument sends the obtained GPS data to the server to realize the transmission of GPS data, and since the GPS module is restarted according to the user's needs, the GPS module does not need to perform real-time positioning, that is, according to the principle of on-demand use, it can reduce The power consumption of the node instrument is extended, thereby extending the battery life of the node instrument and reducing the number of battery replacements or charging times.
在其中一个实施例中,所述请求指令还包括帧头、命令码、循环冗余校验码及结束符,所述帧头、所述设备编码、所述命令码、所述循环冗余校验码及所述结束符依次排列。具体的,循环冗余校验码即CRC(CyclicRedundancyCheck,循环冗余校验码)8;帧头为“$”占用1个字节,节点仪的设备编码为8位字符编码组成,占用8个字节,命令码占用2个字节,循环冗余校验码占用1个字节,结束符为回车换行“\r\n”,占用2个字节。例如,命令码为“61”,CRC8为指令前11个字符编码的校验值。通过将请求指令按所述帧头、所述设备编码、所述命令码、循环冗余校验码及所述结束符依次排列组成,以使得节点仪在解析请求指令时,能更好地判断请求指令中的设备编码是否与自身编码相匹配。在其中一个实施例中,所述请求指令由帧头、设备编码、命令码、循环冗余校验码及所述结束符依次排列组成。In one embodiment, the request instruction further includes a frame header, a command code, a cyclic redundancy check code, and a terminator, the frame header, the device code, the command code, the cyclic redundancy check code, and the cyclic redundancy check code. The verification code and the terminator are arranged in sequence. Specifically, the cyclic redundancy check code is CRC (Cyclic Redundancy Check, cyclic redundancy check code) 8; the frame header is "$" and occupies 1 byte, and the device code of the node instrument is composed of 8-bit character codes, occupying 8 byte, the command code occupies 2 bytes, the cyclic redundancy check code occupies 1 byte, and the terminator is carriage return and line feed "\r\n", which occupies 2 bytes. For example, the command code is "61", and CRC8 is the check value encoded by the first 11 characters of the command. By arranging the request command in sequence according to the frame header, the device code, the command code, the cyclic redundancy check code and the terminator, the node instrument can better judge when parsing the request command. Whether the device encoding in the request command matches its own encoding. In one embodiment, the request instruction is composed of a frame header, a device code, a command code, a cyclic redundancy check code, and the terminator in sequence.
在其中一个实施例中,在所述将所述GPS数据发送至服务器的步骤之前,包括:In one embodiment, before the step of sending the GPS data to the server, it includes:
将所述GPS数据按预设格式进行清洗,得到清洗后的所述GPS数据;Cleaning the GPS data according to a preset format to obtain the cleaned GPS data;
所述将所述GPS数据发送至服务器的步骤,包括:The step of sending the GPS data to the server includes:
将所述清洗后的所述GPS数据发送至所述服务器。Send the cleaned GPS data to the server.
具体的,清洗即数据清洗,其是发现并纠正数据文件中可识别的错误的最后一道程序,包括检查数据一致性,处理无效值和缺失值等。因为数据仓库中的数据是面向某一主题的数据的集合,这些数据从多个业务系统中抽取而来而且包含历史数据,这样就避免不了有的数据是错误数据、有的数据相互之间有冲突,这些错误的或有冲突的数据显然是我们不想要的,称为“脏数据”。数据清洗的目的是为了将很多种不同的信息安全检测的工具统一成平台专用格式,并且提取有用的数据,用于后续流程的数据流转。本实施例中,GPS模块采集GPS数据,将采集的GPS按预设格式进行清洗,即将GPS数据设置为预设格式,并将清洗后的GPS数据发送至服务器,从而可以保证GPS数据传输的完整性。在其中一个实施例中,所述预设格式为JSON(JavaScript Object Notation,JS,对象简谱)格式。JSON格式为如下:Specifically, cleaning is data cleaning, which is the last procedure to find and correct identifiable errors in data files, including checking data consistency, dealing with invalid and missing values, and so on. Because the data in the data warehouse is a collection of data oriented to a certain topic, these data are extracted from multiple business systems and contain historical data, so it is inevitable that some data are wrong data, and some data are interrelated with each other. Conflicts, these erroneous or conflicting data that we obviously don't want, are called "dirty data". The purpose of data cleaning is to unify many different information security detection tools into a platform-specific format, and to extract useful data for data flow in subsequent processes. In this embodiment, the GPS module collects GPS data, cleans the collected GPS according to the preset format, that is, sets the GPS data to the preset format, and sends the cleaned GPS data to the server, so as to ensure the integrity of GPS data transmission sex. In one embodiment, the preset format is a JSON (JavaScript Object Notation, JS, Object Notation) format. The JSON format is as follows:
{"GPS":"JJJJJJJJJJJEWWWWWWWWWWNHHHHHvvYYYYMMDDTTMM SS"}{"GPS":"JJJJJJJJJJJEWWWWWWWWWWNHHHHHvvYYYYMMDDTTMM SS"}
为了便于理解举一具体实施例,所采集的GPS数据为:In order to facilitate understanding, a specific embodiment is given, the collected GPS data is:
{"GPS":"11844.00253E3204.22579N+002720720200211135604"}{"GPS":"11844.00253E3204.22579N+002720720200211135604"}
上述JSON格式中各字符的所表达的意思为:The meaning of each character in the above JSON format is:
(1)11个J表示经度的意思,该实施例中表示经度为118度44分,0.00253*60=0.1518秒。(1) 11 Js represent longitude, and in this embodiment, the longitude is 118 degrees and 44 minutes, and 0.00253*60=0.1518 seconds.
(2)E代表东经的意思,如果是W就是西经。(2) E means east longitude, if it is W, it means west longitude.
(3)10个W表示纬度的意思,该实施例中表示纬度为32度04分,0.22579*60=13.5474秒。(3) 10 Ws represent the meaning of latitude. In this embodiment, it represents that the latitude is 32 degrees and 04 minutes, and 0.22579*60=13.5474 seconds.
(4)N代表北半球意思,南半球就是用S表示。(4) N stands for the northern hemisphere, and S for the southern hemisphere.
(5)6个H代表高度,最高999999,单位为分米。该实施例中表示高度27.2m。(5) 6 Hs represent height, the maximum is 999999, and the unit is decimeter. In this example, the height is 27.2 m.
(6)2个V在使用的卫星个数。该实施例表示卫星数7个。(6) The number of satellites in use by 2 V. This example shows seven satellites.
(7)UTC时间,年月日时分秒。(7) UTC time, year, month, day, hour, minute, second.
如此,通过将GPS数据清洗成JSON格式,可以清楚地表示节点仪中GPS模块所采集的GPS数据。且清洗后的GPS数据所占用资源少,传输效率高,更加稳定。In this way, by cleaning the GPS data into JSON format, the GPS data collected by the GPS module in the node instrument can be clearly represented. Moreover, the cleaned GPS data occupies less resources, has high transmission efficiency and is more stable.
在其中一个实施例中,提供一种GPS数据传输方法,该方法包括:In one of the embodiments, a GPS data transmission method is provided, the method comprising:
接收请求指令,其中所述请求指令包括所请求的设备的设备编码;receiving a request instruction, wherein the request instruction includes a device code of the requested device;
判断所述设备编码是否与预设编码相匹配;Determine whether the device code matches the preset code;
当所述设备编码与所述预设编码相匹配时,启动GPS模块,并通过所述GPS模块获得GPS数据;When the device code matches the preset code, start the GPS module, and obtain GPS data through the GPS module;
将所述GPS数据按预设格式进行清洗,得到清洗后的所述GPS数据;Cleaning the GPS data according to a preset format to obtain the cleaned GPS data;
将所述清洗后的所述GPS数据发送至所述服务器。Send the cleaned GPS data to the server.
上述GPS数据传输方法,在接收到请求指令时,检测请求指令中的设备编码与自身编码是否相匹配,当设备编码与预设编码相匹配时,则启动GPS模块采集GPS数据,以使节点仪获取GPS数据,节点仪将获取的GPS数据发送至服务器,以实现GPS数据的传输,且由于是根据用户需求再启动GPS模块,GPS模块无需实时进行定位,即根据按需使用的原则,可以降低节点仪的电能损耗,从而延长节点仪的电池寿命,减少更换电池次数或者充电次数。The above GPS data transmission method, when receiving the request command, detects whether the device code in the request command matches its own code, and when the device code matches the preset code, the GPS module is started to collect GPS data, so that the node instrument To obtain GPS data, the node instrument sends the obtained GPS data to the server to realize the transmission of GPS data, and since the GPS module is restarted according to the user's needs, the GPS module does not need to perform real-time positioning, that is, according to the principle of on-demand use, it can reduce The power consumption of the node instrument is extended, thereby extending the battery life of the node instrument and reducing the number of battery replacements or charging times.
在其中一个实施例中,所述将所述清洗后的所述GPS数据发送至所述服务器的步骤,包括:In one embodiment, the step of sending the cleaned GPS data to the server includes:
根据所约定报文及清洗后的所述GPS数据,得到回传数据报文,并将所述回传数据报文发送至所述服务器。According to the agreed message and the cleaned GPS data, a return data message is obtained, and the return data message is sent to the server.
具体的,根据所约定报文及所述GPS数据,得到回传数据报文,即将GPS数据代入约定格式的报文中,从而得到回传数据报文。该回传数据报文包括包长、命令码、设备编码、清洗后的GPS数据及循环冗余检验码,包长、命令码、设备编码、清洗后的GPS数据及循环冗余检验码依序排列。在其中一个实施例中,所述回传数据报由包长、命令码、设备编码、清洗后的GPS数据及循环冗余检验码组成,包长、命令码、设备编码、清洗后的GPS数据及循环冗余检验码依序排列。其中,包长为4个字节(int整型),包长为整个报文的长度,命令码2个字节,例如:命令码为“61”;设备编码为8个字节,该设备编码为获得GPS数据所对应的节点仪的设备编码,也就是客户端所请求的设备编码。循环冗余校验码占用一个字节,循环冗余校验码为报文的校验和;清洗后的GPS数据即JSON格式的GPS数据。通过将GPS数据以约定报文的形式进行传输,使得服务器在接收到回传数据报文时,方便报文解析,从而更好地提取回传数据报文中所包含的GPS数据,也保证了GPS数据传输的稳定性。Specifically, according to the agreed message and the GPS data, the return data message is obtained, that is, the GPS data is substituted into the message of the agreed format, so as to obtain the return data message. The returned data message includes packet length, command code, device code, cleaned GPS data and cyclic redundancy check code. The packet length, command code, device code, cleaned GPS data and cyclic redundancy check code are in sequence. arrangement. In one embodiment, the returned datagram is composed of packet length, command code, device code, cleaned GPS data, and cyclic redundancy check code. The packet length, command code, device code, and cleaned GPS data and cyclic redundancy check codes are arranged in sequence. Among them, the packet length is 4 bytes (int integer), the packet length is the length of the entire message, and the command code is 2 bytes, for example: the command code is "61"; the device code is 8 bytes, the device The code is the device code of the node instrument corresponding to the obtained GPS data, that is, the device code requested by the client. The cyclic redundancy check code occupies one byte, and the cyclic redundancy check code is the checksum of the message; the cleaned GPS data is the GPS data in JSON format. By transmitting the GPS data in the form of the agreed message, the server can facilitate the message parsing when receiving the returned data message, so as to better extract the GPS data contained in the returned data message, and ensure the The stability of GPS data transmission.
第三实施例:Third embodiment:
本实施例提供一种GPS数据传输装置,所述GPS数据传输装置采用上述任一实施例所述GPS数据传输方法实现。在其中一个实施例中,所述GPS数据传输装置包括用于实现所述GPS数据传输方法各步骤的相应模块。This embodiment provides a GPS data transmission device, and the GPS data transmission device is implemented by using the GPS data transmission method described in any of the foregoing embodiments. In one of the embodiments, the GPS data transmission device includes corresponding modules for implementing each step of the GPS data transmission method.
请参阅图2,在其中一个实施例中,提供一种GPS数据传输装置,该装置包括:Referring to FIG. 2, in one embodiment, a GPS data transmission device is provided, and the device includes:
接收模块210,用于接收请求指令,其中所述请求指令包括所请求的设备的设备编码;a
判断模块220,用于判断所述设备编码是否与预设编码相匹配;Judging
获取模块230,用于当所述设备编码与所述预设编码相匹配时,启动GPS模块,并通过所述GPS模块获得GPS数据;an
发送模块240,用于将所述GPS数据发送至服务器。The sending
上述GPS数据传输装置,在接收到请求指令时,检测请求指令中的设备编码与自身编码是否相匹配,当设备编码与预设编码相匹配时,则启动GPS模块采集GPS数据,以使节点仪获取GPS数据,节点仪将获取的GPS数据发送至服务器,以实现GPS数据的传输,且由于是根据用户需求再启动GPS模块,GPS模块无需实时进行定位,即根据按需使用的原则,可以降低节点仪的电能损耗,从而延长节点仪的电池寿命,减少更换电池次数或者充电次数。The above-mentioned GPS data transmission device, when receiving the request command, detects whether the device code in the request command matches its own code, and when the device code matches the preset code, starts the GPS module to collect GPS data, so that the node instrument To obtain GPS data, the node instrument sends the obtained GPS data to the server to realize the transmission of GPS data, and since the GPS module is restarted according to the user's needs, the GPS module does not need to perform real-time positioning, that is, according to the principle of on-demand use, it can reduce The power consumption of the node instrument is extended, thereby extending the battery life of the node instrument and reducing the number of battery replacements or charging times.
在其中一个实施例中,所述请求指令还包括帧头、命令码、循环冗余校验码及结束符,所述帧头、所述设备编码、所述命令码、所述循环冗余校验码及所述结束符依次排列。具体的,循环冗余校验码即CRC(CyclicRedundancyCheck,循环冗余校验码)8;帧头为“$”占用1个字节,节点仪的设备编码为8位字符编码组成,占用8个字节,命令码占用2个字节,循环冗余校验码占用1个字节,结束符为回车换行“\r\n”,占用2个字节。例如,命令码为“61”,CRC8为指令前11个字符编码的校验值。通过将请求指令按所述帧头、所述设备编码、所述命令码、循环冗余校验码及所述结束符依次排列组成,以使得节点仪在解析请求指令时,能更好地判断请求指令中的设备编码是否与自身编码相匹配。在其中一个实施例中,所述请求指令由帧头、设备编码、命令码、循环冗余校验码及所述结束符依次排列组成。In one embodiment, the request instruction further includes a frame header, a command code, a cyclic redundancy check code, and a terminator, the frame header, the device code, the command code, the cyclic redundancy check code, and the cyclic redundancy check code. The verification code and the terminator are arranged in sequence. Specifically, the cyclic redundancy check code is CRC (Cyclic Redundancy Check, cyclic redundancy check code) 8; the frame header is "$" and occupies 1 byte, and the device code of the node instrument is composed of 8-bit character codes, occupying 8 byte, the command code occupies 2 bytes, the cyclic redundancy check code occupies 1 byte, and the terminator is carriage return and line feed "\r\n", which occupies 2 bytes. For example, the command code is "61", and CRC8 is the check value encoded by the first 11 characters of the command. By arranging the request command in sequence according to the frame header, the device code, the command code, the cyclic redundancy check code and the terminator, the node instrument can better judge when parsing the request command. Whether the device encoding in the request command matches its own encoding. In one embodiment, the request instruction is composed of a frame header, a device code, a command code, a cyclic redundancy check code, and the terminator in sequence.
在其中一个实施例中,所述的GPS数据传输装置还包括:In one embodiment, the GPS data transmission device further includes:
清洗模块,用于将所述GPS数据按预设格式进行清洗,得到清洗后的所述GPS数据。The cleaning module is used for cleaning the GPS data according to a preset format to obtain the cleaned GPS data.
所述发送模块用于将所述清洗后的所述GPS数据发送至所述服务器。The sending module is configured to send the cleaned GPS data to the server.
具体的,清洗即数据清洗,其是发现并纠正数据文件中可识别的错误的最后一道程序,包括检查数据一致性,处理无效值和缺失值等。因为数据仓库中的数据是面向某一主题的数据的集合,这些数据从多个业务系统中抽取而来而且包含历史数据,这样就避免不了有的数据是错误数据、有的数据相互之间有冲突,这些错误的或有冲突的数据显然是我们不想要的,称为“脏数据”。数据清洗的目的是为了将很多种不同的信息安全检测的工具统一成平台专用格式,并且提取有用的数据,用于后续流程的数据流转。本实施例中,GPS模块采集GPS数据,将采集的GPS按预设格式进行清洗,即将GPS数据设置为预设格式,并将清洗后的GPS数据发送至服务器,从而可以保证GPS数据传输的完整性。在其中一个实施例中,所述预设格式为JSON(JavaScript Object Notation,JS,对象简谱)格式。JSON格式为如下:Specifically, cleaning is data cleaning, which is the last procedure to find and correct identifiable errors in data files, including checking data consistency, dealing with invalid and missing values, and so on. Because the data in the data warehouse is a collection of data oriented to a certain topic, these data are extracted from multiple business systems and contain historical data, so it is inevitable that some data are wrong data, and some data are interrelated with each other. Conflicts, these erroneous or conflicting data that we obviously don't want, are called "dirty data". The purpose of data cleaning is to unify many different information security detection tools into a platform-specific format, and extract useful data for data flow in subsequent processes. In this embodiment, the GPS module collects GPS data, cleans the collected GPS according to the preset format, that is, sets the GPS data to the preset format, and sends the cleaned GPS data to the server, so as to ensure the integrity of GPS data transmission sex. In one embodiment, the preset format is a JSON (JavaScript Object Notation, JS, Object Notation) format. The JSON format is as follows:
{"GPS":"JJJJJJJJJJJEWWWWWWWWWWNHHHHHvvYYYYMMDDTTMM SS"}{"GPS":"JJJJJJJJJJJEWWWWWWWWWWNHHHHHvvYYYYMMDDTTMM SS"}
为了便于理解举一具体实施例,所采集的GPS数据为:In order to facilitate understanding, a specific embodiment is given, the collected GPS data is:
{"GPS":"11844.00253E3204.22579N+002720720200211135604"}{"GPS":"11844.00253E3204.22579N+002720720200211135604"}
上述JSON格式中各字符的所表达的意思为:The meaning of each character in the above JSON format is:
(1)11个J表示经度的意思,该实施例中表示经度为118度44分,0.00253*60=0.1518秒。(1) 11 Js represent longitude, and in this embodiment, the longitude is 118 degrees and 44 minutes, and 0.00253*60=0.1518 seconds.
(2)E代表东经的意思,如果是W就是西经。(2) E means east longitude, if it is W, it means west longitude.
(3)10个W表示纬度的意思,该实施例中表示纬度为32度04分,0.22579*60=13.5474秒。(3) 10 Ws represent the meaning of latitude. In this embodiment, it represents that the latitude is 32 degrees and 04 minutes, and 0.22579*60=13.5474 seconds.
(4)N代表北半球意思,南半球就是用S表示。(4) N stands for the northern hemisphere, and S for the southern hemisphere.
(5)6个H代表高度,最高999999,单位为分米。该实施例中表示高度27.2m。(5) 6 Hs represent height, the maximum is 999999, and the unit is decimeter. In this example, the height is 27.2 m.
(6)2个V在使用的卫星个数。该实施例表示卫星数7个。(6) The number of satellites in use by 2 V. This example shows seven satellites.
(7)UTC时间,年月日时分秒。(7) UTC time, year, month, day, hour, minute, second.
如此,通过将GPS数据清洗成JSON格式,可以清楚地表示节点仪中GPS模块所采集的GPS数据。且清洗后的GPS数据所占用资源少,传输效率高,更加稳定。In this way, by cleaning the GPS data into JSON format, the GPS data collected by the GPS module in the node instrument can be clearly represented. Moreover, the cleaned GPS data occupies less resources, has high transmission efficiency and is more stable.
在其中一个实施例中,所述发送模块用于根据所约定报文及清洗后的所述GPS数据,得到回传数据报文,并将所述回传数据报文发送至所述服务器。In one embodiment, the sending module is configured to obtain a return data message according to the agreed message and the cleaned GPS data, and send the return data message to the server.
具体的,根据所约定报文及所述GPS数据,得到回传数据报文,即将GPS数据代入约定格式的报文中,从而得到回传数据报文。该回传数据报文包括包长、命令码、设备编码、清洗后的GPS数据及循环冗余检验码,包长、命令码、设备编码、清洗后的GPS数据及循环冗余检验码依序排列。在其中一个实施例中,所述回传数据报由包长、命令码、设备编码、清洗后的GPS数据及循环冗余检验码组成,包长、命令码、设备编码、清洗后的GPS数据及循环冗余检验码依序排列。其中,包长为4个字节(int整型),包长为整个报文的长度,命令码2个字节,例如:命令码为“61”;设备编码为8个字节,该设备编码为获得GPS数据所对应的节点仪的设备编码,也就是客户端所请求的设备编码。循环冗余校验码占用一个字节,循环冗余校验码为报文的校验和;清洗后的GPS数据即JSON格式的GPS数据。通过将GPS数据以约定报文的形式进行传输,使得服务器在接收到回传数据报文时,方便报文解析,从而更好地提取回传数据报文中所包含的GPS数据,也保证了GPS数据传输的稳定性。Specifically, according to the agreed message and the GPS data, the return data message is obtained, that is, the GPS data is substituted into the message of the agreed format, so as to obtain the return data message. The returned data message includes packet length, command code, device code, cleaned GPS data and cyclic redundancy check code. The packet length, command code, device code, cleaned GPS data and cyclic redundancy check code are in sequence. arrangement. In one embodiment, the returned datagram is composed of packet length, command code, device code, cleaned GPS data, and cyclic redundancy check code. The packet length, command code, device code, and cleaned GPS data and cyclic redundancy check codes are arranged in sequence. Among them, the packet length is 4 bytes (int integer), the packet length is the length of the entire message, and the command code is 2 bytes, for example: the command code is "61"; the device code is 8 bytes, the device The code is the device code of the node instrument corresponding to the obtained GPS data, that is, the device code requested by the client. The cyclic redundancy check code occupies one byte, and the cyclic redundancy check code is the checksum of the message; the cleaned GPS data is the GPS data in JSON format. By transmitting the GPS data in the form of the agreed message, the server can facilitate the message parsing when receiving the returned data message, so as to better extract the GPS data contained in the returned data message, and ensure the The stability of GPS data transmission.
第三实施例Third Embodiment
本实施例中,提供了一种计算机设备,其内部结构图可以如图3所示。该计算机设备包括通过系统总线连接的处理器、存储器、网络接口、显示屏和输入装置。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统和计算机程序。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的网络接口用于与外部的终端通过网络连接通信。该计算机程序被处理器执行时以实现一种GPS数据传输方法。该计算机设备的显示屏可以是液晶显示屏或者电子墨水显示屏,该计算机设备的输入装置可以是显示屏上覆盖的触摸层,也可以是计算机设备外壳上设置的按键、轨迹球或触控板,还可以是外接的键盘、触控板或鼠标等。In this embodiment, a computer device is provided, and its internal structure diagram may be as shown in FIG. 3 . The computer equipment includes a processor, memory, a network interface, a display screen, and an input device connected by a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium, an internal memory. The nonvolatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the execution of the operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. The computer program, when executed by the processor, implements a GPS data transmission method. The display screen of the computer equipment may be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment may be a touch layer covered on the display screen, or a button, a trackball or a touchpad set on the shell of the computer equipment , or an external keyboard, trackpad, or mouse.
本领域技术人员可以理解,图3中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。Those skilled in the art can understand that the structure shown in FIG. 3 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer equipment to which the solution of the present application is applied. Include more or fewer components than shown in the figures, or combine certain components, or have a different arrangement of components.
在其中一个实施例中,一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时上述任一实施例中所述GPS数据传输方法的步骤。In one of the embodiments, a computer device includes a memory and a processor, the memory stores a computer program, and the processor executes the steps of the GPS data transmission method in any of the foregoing embodiments when the computer program is executed. .
一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时实现以下步骤:A computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:
接收请求指令,其中所述请求指令包括所请求的设备的设备编码;receiving a request instruction, wherein the request instruction includes a device code of the requested device;
判断所述设备编码是否与预设编码相匹配;Determine whether the device code matches the preset code;
当所述设备编码与所述预设编码相匹配时,启动GPS模块,并通过所述GPS模块获得GPS数据;When the device code matches the preset code, start the GPS module, and obtain GPS data through the GPS module;
将所述GPS数据发送至服务器。The GPS data is sent to the server.
上述计算机设备,在接收到请求指令时,检测请求指令中的设备编码与自身编码是否相匹配,当设备编码与预设编码相匹配时,则启动GPS模块采集GPS数据,以使节点仪获取GPS数据,节点仪将获取的GPS数据发送至服务器,以实现GPS数据的传输,且由于是根据用户需求再启动GPS模块,GPS模块无需实时进行定位,即根据按需使用的原则,可以降低节点仪的电能损耗,从而延长节点仪的电池寿命。The above-mentioned computer equipment, when receiving the request command, detects whether the device code in the request command matches its own code, and when the device code matches the preset code, then starts the GPS module to collect GPS data, so that the node instrument obtains GPS data Data, the node instrument sends the acquired GPS data to the server to realize the transmission of GPS data, and because the GPS module is restarted according to the user's needs, the GPS module does not need to perform real-time positioning, that is, according to the principle of on-demand use, the node instrument can be reduced. power consumption, thereby extending the battery life of the node meter.
在其中一个实施例中,所述请求指令还包括帧头、命令码、循环冗余校验码及结束符,所述帧头、所述设备编码、所述命令码、所述循环冗余校验码及所述结束符依次排列。具体的,循环冗余校验码即CRC(CyclicRedundancyCheck,循环冗余校验码)8;帧头为“$”占用1个字节,节点仪的设备编码为8位字符编码组成,占用8个字节,命令码占用2个字节,循环冗余校验码占用1个字节,结束符为回车换行“\r\n”,占用2个字节。例如,命令码为“61”,CRC8为指令前11个字符编码的校验值。通过将请求指令按所述帧头、所述设备编码、所述命令码、循环冗余校验码及所述结束符依次排列组成,以使得节点仪在解析请求指令时,能更好地判断请求指令中的设备编码是否与自身编码相匹配。在其中一个实施例中,所述请求指令由帧头、设备编码、命令码、循环冗余校验码及所述结束符依次排列组成。In one embodiment, the request instruction further includes a frame header, a command code, a cyclic redundancy check code, and a terminator, the frame header, the device code, the command code, the cyclic redundancy check code, and the cyclic redundancy check code. The verification code and the terminator are arranged in sequence. Specifically, the cyclic redundancy check code is CRC (Cyclic Redundancy Check, cyclic redundancy check code) 8; the frame header is "$" and occupies 1 byte, and the device code of the node instrument is composed of 8-bit character codes, occupying 8 byte, the command code occupies 2 bytes, the cyclic redundancy check code occupies 1 byte, and the terminator is carriage return and line feed "\r\n", which occupies 2 bytes. For example, the command code is "61", and CRC8 is the check value encoded by the first 11 characters of the command. By arranging the request command in sequence according to the frame header, the device code, the command code, the cyclic redundancy check code and the terminator, the node instrument can better judge when parsing the request command. Whether the device encoding in the request command matches its own encoding. In one embodiment, the request instruction is composed of a frame header, a device code, a command code, a cyclic redundancy check code, and the terminator in sequence.
在其中一个实施例中,处理器执行计算机程序时还实现以下步骤:In one of the embodiments, the processor further implements the following steps when executing the computer program:
将所述GPS数据按预设格式进行清洗,得到清洗后的所述GPS数据;Cleaning the GPS data according to a preset format to obtain the cleaned GPS data;
将所述清洗后的所述GPS数据发送至所述服务器。Send the cleaned GPS data to the server.
在其中一个实施例中,处理器执行计算机程序时还实现以下步骤:In one of the embodiments, the processor further implements the following steps when executing the computer program:
根据所约定报文及清洗后的所述GPS数据,得到回传数据报文,并将所述回传数据报文发送至所述服务器。According to the agreed message and the cleaned GPS data, a return data message is obtained, and the return data message is sent to the server.
第五实施例Fifth Embodiment
本实施例提供一种计算机可读存储介质,其上存储有计算机程序,其上存储有计算机程序,所述计算机程序被处理器执行时实现上述任一实施例中所述GPS数据传输方法的步骤。This embodiment provides a computer-readable storage medium on which a computer program is stored, and a computer program is stored on it, and when the computer program is executed by a processor, implements the steps of the GPS data transmission method described in any of the foregoing embodiments .
在其中一个实施例中,提供一种计算机可读存储介质,其上存储有计算机程序,其上存储有计算机程序,所述计算机程序被处理器执行时实现以下步骤:In one of the embodiments, a computer-readable storage medium is provided, on which a computer program is stored, and a computer program is stored on it, and when the computer program is executed by a processor, the following steps are implemented:
接收请求指令,其中所述请求指令包括所请求的设备的设备编码;receiving a request instruction, wherein the request instruction includes a device code of the requested device;
判断所述设备编码是否与预设编码相匹配;Determine whether the device code matches the preset code;
当所述设备编码与所述预设编码一致时,启动GPS模块,并通过所述GPS模块获得GPS数据;When the device code is consistent with the preset code, start the GPS module, and obtain GPS data through the GPS module;
将所述GPS数据发送至服务器。The GPS data is sent to the server.
上述存储介质,在接收到请求指令时,检测请求指令中的设备编码与自身编码是否相匹配,当设备编码与预设编码相匹配时,则启动GPS模块采集GPS数据,以使节点仪获取GPS数据,节点仪将获取的GPS数据发送至服务器,以实现GPS数据的传输,且由于是根据用户需求再启动GPS模块,GPS模块无需实时进行定位,即根据按需使用的原则,可以降低节点仪的电能损耗,从而延长节点仪的电池寿命。The above storage medium, when receiving the request command, detects whether the device code in the request command matches its own code, and when the device code matches the preset code, the GPS module is started to collect GPS data, so that the node instrument obtains GPS data Data, the node instrument sends the acquired GPS data to the server to realize the transmission of GPS data, and because the GPS module is restarted according to the user's needs, the GPS module does not need to perform real-time positioning, that is, according to the principle of on-demand use, the node instrument can be reduced. power consumption, thereby extending the battery life of the node meter.
在其中一个实施例中,所述请求指令还包括帧头、命令码、循环冗余校验码及结束符,所述帧头、所述设备编码、所述命令码、所述循环冗余校验码及所述结束符依次排列。具体的,循环冗余校验码即CRC(CyclicRedundancyCheck,循环冗余校验码)8;帧头为“$”占用1个字节,节点仪的设备编码为8位字符编码组成,占用8个字节,命令码占用2个字节,循环冗余校验码占用1个字节,结束符为回车换行“\r\n”,占用2个字节。例如,命令码为“61”,CRC8为指令前11个字符编码的校验值。通过将请求指令按所述帧头、所述设备编码、所述命令码、循环冗余校验码及所述结束符依次排列组成,以使得节点仪在解析请求指令时,能更好地判断请求指令中的设备编码是否与自身编码相匹配。在其中一个实施例中,所述请求指令由帧头、设备编码、命令码、循环冗余校验码及所述结束符依次排列组成。In one embodiment, the request instruction further includes a frame header, a command code, a cyclic redundancy check code, and a terminator, the frame header, the device code, the command code, the cyclic redundancy check code, and the cyclic redundancy check code. The verification code and the terminator are arranged in sequence. Specifically, the cyclic redundancy check code is CRC (Cyclic Redundancy Check, cyclic redundancy check code) 8; the frame header is "$" and occupies 1 byte, and the device code of the node instrument is composed of 8-bit character codes, occupying 8 byte, the command code occupies 2 bytes, the cyclic redundancy check code occupies 1 byte, and the terminator is carriage return and line feed "\r\n", which occupies 2 bytes. For example, the command code is "61", and CRC8 is the check value encoded by the first 11 characters of the command. By arranging the request command in sequence according to the frame header, the device code, the command code, the cyclic redundancy check code and the terminator, the node instrument can better judge when parsing the request command. Whether the device encoding in the request command matches its own encoding. In one embodiment, the request instruction is composed of a frame header, a device code, a command code, a cyclic redundancy check code, and the terminator in sequence.
在其中一个实施例中,计算机程序被处理器执行时还实现以下步骤:In one of the embodiments, the computer program further implements the following steps when executed by the processor:
将所述GPS数据按预设格式进行清洗,得到清洗后的所述GPS数据;Cleaning the GPS data according to a preset format to obtain the cleaned GPS data;
将所述清洗后的所述GPS数据发送至所述服务器。Send the cleaned GPS data to the server.
在其中一个实施例中,计算机程序被处理器执行时还实现以下步骤:In one of the embodiments, the computer program further implements the following steps when executed by the processor:
根据所约定报文及清洗后的所述GPS数据,得到回传数据报文,并将所述回传数据报文发送至所述服务器。According to the agreed message and the cleaned GPS data, a return data message is obtained, and the return data message is sent to the server.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一非易失性计算机可读取存储介质中,该计算机程序在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易失性和/或易失性存储器。非易失性存储器可包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。易失性存储器可包括随机存取存储器(RAM)或者外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双数据率SDRAM(DDRSDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink)DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)等。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be implemented by instructing relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage In the medium, when the computer program is executed, it may include the processes of the above-mentioned method embodiments. Wherein, any reference to memory, storage, database or other medium used in the various embodiments provided in this application may include non-volatile and/or volatile memory. Nonvolatile memory may include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous chain Road (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
以上实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, all It is considered to be the range described in this specification.
以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。The above-mentioned embodiments only represent several embodiments of the present application, and the descriptions thereof are specific and detailed, but should not be construed as a limitation on the scope of the invention patent. It should be pointed out that for those skilled in the art, without departing from the concept of the present application, several modifications and improvements can be made, which all belong to the protection scope of the present application. Therefore, the scope of protection of the patent of the present application shall be subject to the appended claims.
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010974424.3ACN114430531A (en) | 2020-09-16 | 2020-09-16 | GPS data transmission system, method, device, computer equipment and storage medium |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010974424.3ACN114430531A (en) | 2020-09-16 | 2020-09-16 | GPS data transmission system, method, device, computer equipment and storage medium |
| Publication Number | Publication Date |
|---|---|
| CN114430531Atrue CN114430531A (en) | 2022-05-03 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202010974424.3APendingCN114430531A (en) | 2020-09-16 | 2020-09-16 | GPS data transmission system, method, device, computer equipment and storage medium |
| Country | Link |
|---|---|
| CN (1) | CN114430531A (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN103595706A (en)* | 2013-10-15 | 2014-02-19 | 航天科工深圳(集团)有限公司 | Temperature sensing data universal server and communication method of temperature sensing data universal server |
| CN106371349A (en)* | 2016-08-01 | 2017-02-01 | 深圳市唯传科技有限公司 | LoRa technology based liquid flow sensor data acquisition system and method |
| CN207319435U (en)* | 2017-10-31 | 2018-05-04 | 北方节能股份有限公司 | A kind of efficiency data acquisition device based on FPGA |
| CN208891079U (en)* | 2018-08-02 | 2019-05-21 | 深圳万城节能股份有限公司 | Equipment monitoring system based on lora technology |
| CN110099049A (en)* | 2019-04-19 | 2019-08-06 | 中电科安科技股份有限公司 | Communication protocol for intelligent micro-circuit breaker and control centre's information exchange |
| CN110376641A (en)* | 2019-06-28 | 2019-10-25 | 吉林大学 | A kind of 5G of the wireless seismic detector and 4G combination means of communication and system |
| CN110912810A (en)* | 2019-11-08 | 2020-03-24 | 中国电建集团国际工程有限公司 | Data transmission method, intelligent gateway, computer equipment and storage medium |
| CN111542083A (en)* | 2020-03-24 | 2020-08-14 | 浙江中烟工业有限责任公司 | Method for collecting and analyzing through industrial wireless network air interface |
| CN111597388A (en)* | 2020-07-27 | 2020-08-28 | 平安国际智慧城市科技股份有限公司 | Sample collection method, device, equipment and medium based on distributed system |
| CN111615018A (en)* | 2020-05-12 | 2020-09-01 | 国网江苏省电力有限公司电力科学研究院 | A communication system and method based on super/ultra-high voltage power transmission and transformation engineering |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN103595706A (en)* | 2013-10-15 | 2014-02-19 | 航天科工深圳(集团)有限公司 | Temperature sensing data universal server and communication method of temperature sensing data universal server |
| CN106371349A (en)* | 2016-08-01 | 2017-02-01 | 深圳市唯传科技有限公司 | LoRa technology based liquid flow sensor data acquisition system and method |
| CN207319435U (en)* | 2017-10-31 | 2018-05-04 | 北方节能股份有限公司 | A kind of efficiency data acquisition device based on FPGA |
| CN208891079U (en)* | 2018-08-02 | 2019-05-21 | 深圳万城节能股份有限公司 | Equipment monitoring system based on lora technology |
| CN110099049A (en)* | 2019-04-19 | 2019-08-06 | 中电科安科技股份有限公司 | Communication protocol for intelligent micro-circuit breaker and control centre's information exchange |
| CN110376641A (en)* | 2019-06-28 | 2019-10-25 | 吉林大学 | A kind of 5G of the wireless seismic detector and 4G combination means of communication and system |
| CN110912810A (en)* | 2019-11-08 | 2020-03-24 | 中国电建集团国际工程有限公司 | Data transmission method, intelligent gateway, computer equipment and storage medium |
| CN111542083A (en)* | 2020-03-24 | 2020-08-14 | 浙江中烟工业有限责任公司 | Method for collecting and analyzing through industrial wireless network air interface |
| CN111615018A (en)* | 2020-05-12 | 2020-09-01 | 国网江苏省电力有限公司电力科学研究院 | A communication system and method based on super/ultra-high voltage power transmission and transformation engineering |
| CN111597388A (en)* | 2020-07-27 | 2020-08-28 | 平安国际智慧城市科技股份有限公司 | Sample collection method, device, equipment and medium based on distributed system |
| Title |
|---|
| 张向南;汪传建;兰贞益;: "基于Android的老人关爱系统", 计算机系统应用, no. 06, pages 100 - 105* |
| 朱家骅;金光;江先亮;: "基于低功耗广域物联网的旅游景区垃圾监测系统", 无线通信技术, no. 01, pages 57 - 61* |
| 高瞻,严汝康,向郑涛,陈宇峰: "车辆轨迹数据可视化分析系统的设计与实现", 湖北汽车工业学院学报, no. 01, 31 March 2019 (2019-03-31), pages 6 - 11* |
| Publication | Publication Date | Title |
|---|---|---|
| US10567310B2 (en) | Real-time data communication over internet of things network | |
| US8943166B2 (en) | Data transfer device, data transfer method, and data transfer system | |
| Keller et al. | How was your journey? Uncovering routing dynamics in deployed sensor networks with multi-hop network tomography | |
| US10015259B1 (en) | Deployable sensor system using mesh networking and satellite communication | |
| CN107332909B (en) | Method and device for realizing data transmission | |
| JP6716583B2 (en) | Method and system for ranging protocols | |
| CN106537959B (en) | Method for encoding and decoding frames in a telecommunication network | |
| CN110913038B (en) | IP address determination method, device, server and computer readable storage medium | |
| CN105490773A (en) | Method and device for transmitting multimedia data | |
| CN119341704A (en) | Packet loss retransmission method, device, computer equipment, readable storage medium and program product | |
| CN115884111A (en) | Data transmission method, system, terminal and medium based on Beidou short message | |
| CN105142175B (en) | A kind of method of rapid link state-detection between Wireless Communication Equipment | |
| CN114430531A (en) | GPS data transmission system, method, device, computer equipment and storage medium | |
| US20060234624A1 (en) | System and method of dynamic packet transmission for AGPS | |
| CN116166640A (en) | Real-time acquisition and management method and system for global navigation satellite observation data | |
| US20230412528A1 (en) | Multi-stride packet payload mapping for robust transmission of data | |
| US20220224995A1 (en) | Method for reading fluid meters | |
| Kleinschmidt | Analyzing and improving the energy efficiency of IEEE 802.15. 4 wireless sensor networks using retransmissions and custom coding | |
| CN111385015A (en) | Data transmission and reception method and device, gateway and terminal for satellite communication | |
| Morgenroth | Event-driven Software-architecture for Delay-and Disruption-tolerant Networking | |
| CN101170384A (en) | Method for maintaining data consistency of mobile equipment in wireless ad hoc network | |
| CN114430418A (en) | Seismic data transmission system, method, apparatus, computer device, and storage medium | |
| US12445224B2 (en) | Data transmission method and apparatus, device, and medium | |
| US20250015924A1 (en) | Data transmission method and apparatus, device, and medium | |
| US11496612B1 (en) | Scrambled packet payload mapping for robust transmission of data |
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| RJ01 | Rejection of invention patent application after publication | ||
| RJ01 | Rejection of invention patent application after publication | Application publication date:20220503 |