CN113490165B - 4G module short message receiving and transmitting method for embedded system - Google Patents

4G module short message receiving and transmitting method for embedded system Download PDF

Info

Publication number
CN113490165B
CN113490165B CN202110683242.5A CN202110683242A CN113490165B CN 113490165 B CN113490165 B CN 113490165B CN 202110683242 A CN202110683242 A CN 202110683242A CN 113490165 B CN113490165 B CN 113490165B
Authority
CN
China
Prior art keywords
packet
pdu
pdu unit
unit packet
short message
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110683242.5A
Other languages
Chinese (zh)
Other versions
CN113490165A (en
Inventor
周立功
王林福
翁叶东
曹文静
陈扬鑫
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Zhiyuan Electronics Co Ltd
Original Assignee
Guangzhou Zhiyuan Electronics Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Zhiyuan Electronics Co Ltd filed Critical Guangzhou Zhiyuan Electronics Co Ltd
Priority to CN202110683242.5A priority Critical patent/CN113490165B/en
Publication of CN113490165A publication Critical patent/CN113490165A/en
Application granted granted Critical
Publication of CN113490165B publication Critical patent/CN113490165B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/12Messaging; Mailboxes; Announcements
    • H04W4/14Short messaging services, e.g. short message services [SMS] or unstructured supplementary service data [USSD]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W28/00Network traffic management; Network resource management
    • H04W28/02Traffic management, e.g. flow control or congestion control
    • H04W28/06Optimizing the usage of the radio link, e.g. header compression, information sizing, discarding information
    • H04W28/065Optimizing the usage of the radio link, e.g. header compression, information sizing, discarding information using assembly or disassembly of packets

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Communication Control (AREA)

Abstract

The embodiment of the application discloses a method for receiving and sending short messages of a 4G module of an embedded system, which is applied to a system layer, and is used for transcoding first text information transmitted by a received application layer to obtain a first data packet, and decoding the first data packet to generate a first PDU unit packet; judging whether the length of the first PDU unit packet exceeds a short message length threshold value or not; if yes, the first PDU unit packet is encoded into a plurality of second PDU protocol data packets in a packet-dividing mode and sent to the 4G module, and the length of the second PDU protocol data packets is smaller than or equal to the short message length threshold value; and if not, encoding the first PDU unit packet to generate a first PDU protocol data packet, and sending the first PDU protocol data packet to the 4G module. The system layer transcodes the transmitted information data, encodes and decodes the information data, and then transmits and receives the text information with the application layer, so that the operation complexity of the application layer is reduced, and the efficiency of receiving short messages by the application layer is improved.

Description

4G module short message receiving and transmitting method of embedded system
Technical Field
The embodiment of the application relates to the technical field of communication, in particular to a method for receiving and sending short messages of a 4G module of an embedded system.
Background
In an embedded system, a 2G or 4G module is often carried for connecting a network and receiving and transmitting short messages, a communication protocol between the embedded system and the 4G module generally uses an AT command, the receiving and transmitting of the short messages with pure english content and without sub-packaging are simple, but the short messages with chinese content need to be encoded into a PDU format, the short messages with longer content need to be split into a plurality of messages to be transmitted, and the application end needs to process the messages into a common character encoding format after receiving the messages to complete the receiving and transmitting of the messages. Therefore, the process from the complete sending of a short message to the receiving and parsing of the short message into a visual text is centralized at the application end, which greatly increases the operation complexity of the application end.
Disclosure of Invention
The embodiment of the application provides a method for receiving and sending short messages of a 4G module of an embedded system, which is used for processing the whole short message receiving and sending process, greatly simplifying the short message receiving and sending process, improving the transmission efficiency and reducing the operation complexity of an application layer.
In a first aspect, an embodiment of the present application provides a method for sending and receiving short messages in a 4G module of an embedded system, which is used in a system layer, and includes:
transcoding first text information transmitted by a received application layer to obtain a first data packet, and decoding the first data packet to generate a first PDU unit packet;
judging whether the length of the first PDU unit packet exceeds a short message length threshold value or not;
if yes, the first PDU unit packet is encoded into a plurality of second PDU protocol data packets in a packet-dividing mode and sent to the 4G module, and the length of the second PDU protocol data packets is smaller than or equal to the short message length threshold value;
if not, the first PDU unit packet is encoded to generate a first PDU protocol data packet, and the first PDU protocol data packet is sent to the 4G module;
decoding and processing a PDU protocol data packet received from a 4G module to generate a third PDU unit packet, and judging whether the third PDU unit packet has a related sub-packet or not;
if so, merging and encoding the third PDU unit packet and the associated sub-packet thereof to obtain a second data packet with complete data, transcoding the second data packet with complete data to obtain second text information with complete information, and transmitting the second text information to an application layer;
and if not, coding the third PDU unit packet to obtain a third data packet, transcoding the third data packet to obtain third text information, and transmitting the third text information to an application layer.
Further, checking whether the third PDU unit packet exists in the PDU unit packet linked list;
if the third PDU unit packet exists, taking the third PDU unit packet out of the PDU unit packet linked list;
checking whether the third PDU unit packet has an associated packet mark;
if the third PDU unit packet has the associated sub-packet mark, the PDU unit packet linked list is continuously checked, the associated sub-packet with the associated sub-packet mark corresponding to the third PDU unit packet is taken out, the third PDU unit packet and the associated sub-packet thereof are merged to obtain a complete fourth PDU unit packet, and the fourth PDU unit packet is encoded to obtain the second data packet;
and if the third PDU unit packet does not have the associated subpackage mark, encoding the third PDU unit packet to obtain the third data packet.
Further, carrying out periodic check on the PDU unit packet linked list, and checking whether an expired PDU unit packet exists in the PDU unit packet linked list;
and if the expired PDU unit packet exists, deleting the expired PDU unit packet from the PDU unit packet linked list.
Further, the associated sub-packets are PDU unit packets with associated sub-packet flags, and the associated sub-packet flags include index values indicating the order and information data indicating the total number of sub-packets.
Further, the application layer is informed of receiving a new short message event through a callback function program; the application layer can read, search and delete the short message.
In a second aspect, an embodiment of the present application provides a method for sending and receiving short messages in a 4G module of an embedded system, where the method is applied to the 4G module and includes:
transcoding the received text information transmitted by an application layer to obtain a first data packet, and decoding the first data packet to generate a first PDU unit packet;
judging whether the length of the first PDU unit packet exceeds a short message length threshold value or not;
if yes, the first PDU unit packet is encoded into a plurality of second PDU protocol data packets in a packet-dividing mode and sent to a system layer, and the length of each second PDU protocol data packet is smaller than or equal to the short message length threshold;
if not, the first PDU unit packet is coded to generate a first PDU protocol data packet, and the first PDU protocol data packet is sent to a system layer;
decoding and processing a PDU protocol data packet received from a system layer to generate a third PDU unit packet, and judging whether the third PDU unit packet has associated sub-packets;
if so, merging and encoding the third PDU unit packet and the associated sub-packet thereof to obtain a second data packet with complete data, transcoding the second data packet with complete data to obtain second text information with complete information, and transmitting the second text information to an application layer;
and if not, coding the third PDU unit packet to obtain a third data packet, transcoding the third data packet to obtain third text information, and transmitting the third text information to an application layer.
Further, checking whether the third PDU unit packet exists in the PDU unit packet linked list or not;
if the third PDU unit packet exists, taking the third PDU unit packet out of the PDU unit packet linked list;
checking whether the third PDU unit packet has an associated packet mark;
if the third PDU unit packet has the associated sub-packet mark, the PDU unit packet linked list is continuously checked, the associated sub-packet with the associated sub-packet mark corresponding to the third PDU unit packet is taken out, the third PDU unit packet and the associated sub-packet thereof are merged to obtain a complete fourth PDU unit packet, and the fourth PDU unit packet is encoded to obtain the second data packet;
and if the third PDU unit packet does not have the associated packet mark, encoding the third PDU unit packet to obtain the third data packet.
Further, the PDU unit packet linked list is periodically checked to check whether there is an expired PDU unit packet in the PDU unit packet linked list.
And if the expired PDU unit packet exists, deleting the expired PDU unit packet from the PDU unit packet linked list.
Further, the associated sub-packets are PDU unit packets with associated sub-packet flags, and the associated sub-packet flags include index values indicating the order and information data indicating the total number of sub-packets.
Further, the application layer is informed of receiving a new short message event through a callback function program; the application layer can read, search and delete the short message.
In the embodiment of the application, the system layer carries out transcoding and coding processing on the character information transmitted by the application layer to obtain PDU protocol data transmitted to the 4G module, so that the transmitting process is realized; and the received PDU protocol data transmitted by the 4G module is decoded and transcoded to obtain text information transmitted to an application layer, so that the receiving process is realized. By adopting the technical means, the processing processes of the coding and decoding and the transcoding of the short message receiving and sending can be realized by the system layer, the transcoding and coding and decoding processing operation of the application layer is not required, the operation complexity of the application layer is reduced, the receiving and sending processes of the short message are greatly simplified, and the transmission efficiency is improved.
The PDU protocol data transmitted by the system layer is decoded and transcoded by the 4G module to obtain the text information transmitted to the application layer, the receiving process is achieved, and the PDU protocol data packet transmitted to the system layer is obtained by transcoding and encoding the text information received by the application layer, so that the transmitting process is achieved. By adopting the technical means, the transcoding, encoding and decoding processing process of the 4G module for receiving and sending the short message can be realized, the transcoding, encoding and decoding processing operation of the application layer is not required, the operation complexity of the application layer is reduced, the receiving and sending process of the short message is greatly simplified, and the transmission efficiency is improved.
Drawings
Fig. 1 is a schematic connection diagram of devices in a 4G module short message sending and receiving method for an embedded system according to an embodiment of the present disclosure;
fig. 2 is a flowchart of a 4G module short message transceiving method applied to a system layer in an embedded system according to an embodiment of the present application;
fig. 3 is a flowchart illustrating a 4G module short message transceiving method applied to a 4G module of an embedded system according to a second embodiment of the present application;
fig. 4 is a flowchart of PDU unit packet linked list inspection in the first and second embodiments of the present application;
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, specific embodiments of the present application will be described in detail with reference to the accompanying drawings. It is to be understood that the specific embodiments described herein are merely illustrative of the application and are not limiting of the application. It should be further noted that, for the convenience of description, only some but not all of the relevant portions of the present application are shown in the drawings. Before discussing exemplary embodiments in greater detail, it should be noted that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although a flowchart may describe the operations (or steps) as a sequential process, many of the operations can be performed in parallel, concurrently or simultaneously. In addition, the order of the operations may be re-arranged. The process may be terminated when its operations are completed, but may have additional steps not included in the figure. The processes may correspond to methods, functions, procedures, subroutines, and the like.
The method for receiving and sending the short message of the 4G module of the embedded system aims to carry out transcoding and de-coding processing on data through a system layer or the 4G module and send the processed text message to an application layer in the process of receiving and sending the short message so as to reduce the operation complexity of the application layer. In the current short message transceiving process, data decoding processing is only performed through an application layer, and the transceiving process can be completed only by performing coding and decoding processing on the transceiving information, so that the operation complexity of the application layer is high. When the long short message is received and sent, the long short message needs to be split into a plurality of short messages to be sent, and the processes of receiving and sending the plurality of short messages also need to be coded and decoded, so that the process of completely sending the long short message to the process of receiving the long short message as a visual text is relatively complex, and the process of sending the long short message to the process of receiving the long short message as the visual text by the application layer is processed, so that the operation burden of the application layer is greatly increased, and the working efficiency of receiving and sending the short messages is low. Therefore, the 4G module short message transceiving method of the embedded system is provided to solve the problems of high operation complexity and low transceiving efficiency of an application layer in the existing short message transceiving process.
Referring to fig. 1, the system layer is connected to the 4G module and the application layer, respectively, and the 4G module is connected to the application layer. The system layer is used for receiving and sending text information to the application layer, and the system layer is also used for receiving and sending PDU protocol data packets to the 4G module. The 4G module is used for receiving and sending text information to the application layer, and the 4G module is also used for sending a protocol data packet to the system layer.
Referring to fig. 1, taking intelligent control applied in the internet of things as an example, text information is edited on an application layer interface of the intelligent control and sent, the system layer receives the text information sent by the application layer, transcodes and encodes the text information to obtain a PDU unit packet, further encodes the PDU unit packet into a PDU protocol data packet, and sends the PDU protocol data packet to the 4G module; and the 4G module decodes the received PDU protocol data packet to obtain a PDU unit packet, decodes and transcodes the PDU unit packet to obtain generated text data information, and sends the text data information to an application layer of equipment which needs to be intelligently controlled, so that the sending process of the short message is realized.
Further, in the receiving process, an application layer of the intelligently controlled device sends text information to a 4G module, the 4G module performs transcoding and coding processing on the received text information to obtain a PDU unit packet, codes the PDU unit packet to obtain a PDU protocol data packet, and sends the PDU protocol data packet to a system layer, the system layer performs decoding processing on the received PDU protocol data packet to obtain the PDU unit packet, decodes and transcodes the PDU unit to obtain the text information, and sends the text information to the intelligently controlled application layer, so that the receiving process of the short message is realized.
The first embodiment is as follows:
fig. 2 is a flowchart illustrating a 4G module short message sending and receiving method for an embedded system according to an embodiment of the present application, where the method is applied to a system layer, and the 4G module short message sending and receiving method for an embedded system according to the embodiment may be implemented by a short message sending and receiving device, where the short message sending and receiving device may be implemented in a software and/or hardware manner, and the short message sending and receiving device may be formed by two or more physical entities or may be formed by one physical entity. Generally, the short message transceiving equipment may be a server host, a communication terminal equipment, etc.
The following description will be made by taking a main body of a 4G module short message transceiving method in which a short message transceiving device is an embedded system as an example. Referring to fig. 2, the 4G module short message transceiving method of the embedded system, applied to a system layer, specifically includes:
s201, transcoding the received first text information transmitted by the application layer to obtain a first data packet, and decoding the first data packet to generate a first PDU unit packet.
Specifically, the PDU format short message supports three content coding formats of 7BI T, 8BI T and UCS2, and common character codes include ascii, UTF8, UTF16, GB2312, GBK and UCS 2. When the 4G module is used for sending the Chinese short message content, the short message content carried in the PDU protocol message is UCS2 coded. Receiving first text content information and number information of a receiver sent by an application layer, transcoding the first text content information into character UCS2 codes, and packaging and coding the character UCS2 codes and the number information of the receiver to generate the first PDU unit packet. The first PDU unit packet contains a source address, a destination address, a guard (validity) time, a data format, and body information. The first PDU unit also comprises the number of the sender or the receiver, the coding format of the short message content, the length of the short message content, the text content of the short message, the time stamp of the short message service center and other information.
S202, judging whether the length of the first PDU unit packet exceeds a short message length threshold value.
Specifically, when the length of the short message to be sent exceeds the threshold value of the length of the short message, the short message needs to be subjected to sub-packet processing, and the sending and receiving processes of the long short message are realized. Therefore, when short message is transmitted, it is necessary to determine the length of the short message to determine whether the short message is transmitted in a single packet or in a packetized manner.
Further, if the first PDU unit packet length exceeds the short message length threshold, step S203 is executed.
S203, the first PDU unit packet is encoded into a plurality of second PDU protocol data packets in a packet-dividing mode and sent to the 4G module, and the length of the second PDU protocol data packets is smaller than or equal to the short message length threshold value.
Specifically, the first PDU unit packet is divided into a plurality of associated packets, the associated packets are encoded to generate a plurality of second PDU protocol data packets, and the second PDU protocol data packets are sent to the 4G module, so that the long short message sending process is realized.
Further, if the length of the first PDU unit packet exceeds a short message length threshold, the PDU unit packet is divided into a plurality of associated sub packets according to the short message threshold length. The length of the associated sub-packet is smaller than or equal to the length threshold of the short message. The related sub-packets are PDU unit packets with related sub-packet marks, and the related sub-packet marks comprise index values representing the sequence and information data representing the total number of sub-packets. The related sub-packets comprise mark segments and information segments, and the mark segments comprise index values representing the sequence and information representing the total number of the sub-packets. The information segment includes source address, destination address, protection (effective) time, data format and text information, number of sender or receiver, short message content coding format, length of short message content, short message text content, time stamp of short message service center, etc. The mark segment is specifically, for example, the packet index value of the mark segment of the first associated packet is 1, the packet index value of the mark segment of the second associated packet is 2, and so on until all the associated packets are marked. And packaging the mark segment and the information segment into a complete PDU unit packet association sub-packet, and encoding the association sub-packet to generate the second PDU protocol data packet.
Further, if the first PDU unit packet length does not exceed the short message length threshold, S204 is executed.
S204, encoding the first PDU unit packet to generate a first PDU protocol data packet, and sending the first PDU protocol data packet to the 4G module.
Specifically, if the length of the first PDU unit packet does not exceed the short message length threshold and the length of the sent short message is within the range of single packet sending, the first PDU unit is encoded to generate a first PDU protocol data packet, and the first PDU protocol data packet is sent to the 4G module, so that the short message is sent.
And S205, decoding the PDU protocol data packet received from the 4G module to generate a third PDU unit packet.
Specifically, whether a short message AT instruction is reported by the 4G module is checked, a PDU protocol data packet is extracted from the AT instruction after the short message AT instruction is reported, and a third PDU unit packet is generated according to the decoding of the PDU protocol data packet, wherein the third PDU unit packet comprises information such as date, PDU type, sender number, data coding format, user data and the like.
S206, judging whether the third PDU unit packet has the associated sub-packet.
Specifically, if the association packet exists, S207 is executed.
And S207, merging and encoding the third PDU unit packet and the associated sub-packet thereof to obtain a second data packet with complete data, transcoding the second data packet with complete data to obtain second text information with complete information, and transmitting the second text information to an application layer.
Further, if there is no association package, S208 is executed.
S208, coding the third PDU unit packet to obtain a third data packet, transcoding the third data packet to obtain third text information, and transmitting the third text information to an application layer.
In an embodiment, referring to fig. 4, the determining whether there is an associated packet in the third PDU unit packet includes:
s401, checking whether the PDU unit packet linked list has the third PDU unit packet.
Further, if the third PDU unit packet does not exist in the PDU unit packet linked list, the PDU unit packet linked list is repeatedly checked.
Further, if the third PDU unit packet exists in the PDU unit packet linked list, then S402 is executed.
S402, taking out the third PDU unit packet from the PDU unit packet linked list.
S403, checking whether the third PDU unit packet has a related packet mark.
Further, if the extracted third PDU unit packet has an associated packetization flag, S404 is executed.
S404, continuously checking the PDU unit packet chain table, taking out the associated sub-packet with the associated sub-packet mark corresponding to the third PDU unit packet, combining the third PDU unit packet and the associated sub-packet to obtain a complete fourth PDU unit packet, and encoding the fourth PDU unit packet to obtain the second data packet.
Further, if the extracted third PDU unit packet does not have the associated packetization flag, S405 is performed.
S405, encoding the third PDU unit packet to obtain the third data packet.
Specifically, the PDU unit packet chain table is checked, if the third PDU unit packet exists in the PDU unit packet chain table, the third PDU unit packet is taken out from the PDU unit packet chain table, whether a related sub-packet mark exists in the third PDU unit packet that is taken out is checked, if the related sub-packet mark does not exist, the third PDU unit packet is encoded into a UCS2 code, and the UCS2 code is transcoded into third text information and sent to an application layer.
Further, if the third PDU unit packet taken out is checked to have the associated sub-packet mark, whether the unit packets in the PDU unit packet linked list have the corresponding associated sub-packet mark or not is continuously checked. Combining the related sub-packets with the corresponding related sub-packet marks according to an index sequence, wherein the combining rule is that the sub-packets with the same total number information in the mark segments in the related sub-packet marks are combined, and if the combining is successful, a PDU unit packet with complete information content is obtained; and if the combination fails, the association sub-packets which fail to be combined are moved into the linked list to be combined, and the combination processing is carried out after all the association sub-packets are received. And encoding the fourth PDU unit packet obtained after combination into UCS2 code, transcoding the UCS2 code into second text information and sending the second text information to an application layer.
In an embodiment, the PDU unit packet linked list is periodically checked to check whether an expired PDU unit packet exists in the PDU unit packet linked list; and if an expired PDU unit packet exists, deleting the expired PDU unit packet from the PDU unit packet linked list. And deleting the overdue PDU unit packet to prevent other associated sub-packets from being combined and staying in the PDU unit packet linked list all the time due to the loss of the associated sub-packets, thereby improving the working efficiency of the system in the process of transmitting and receiving.
In one embodiment, the application layer is informed of receiving a new short message event through a callback function program; the application layer can read, search and delete the short message. When the system is initialized, a notification callback function and a short message callback function are added, when a new short message is received, the application layer is notified of the event of the received new short message through the notification callback function program, and when the application layer deletes the short message, the application layer notifies the 4G module to synchronously delete the short message stored in the 4G module through the deletion callback function.
Further, when receiving new information, receiving a PDU unit packet report new message, sequentially inserting the PDU unit packet report new message into an information linked list according to a date stamp of a short message service center by the system, placing the latest message at the forefront of the linked list, and notifying an application layer of the new message by notifying a callback function, wherein the application layer can read the latest message. The application layer can search the short message by using the mobile phone number, and can specify the index number to search the short message when a plurality of same short messages exist.
The method is applied to the system layer, the text information sent by the application layer is transcoded and coded and decoded to obtain the PDU protocol data packet which can be transmitted to the 4G module, the short message sending process is finished, whether the length of the short message exceeds the threshold value of single packet sending or not is judged in the process, sub-packet processing is carried out when the length of the short message exceeds the threshold value of single packet sending, and the sending process is finished in a mode of carrying out sub-packet sending on the long short message. The method comprises the steps of coding, decoding and transcoding a PDU protocol data packet sent by a 4G module to obtain visual text information which can be transmitted to an application layer for reading, completing the receiving process of the short message, judging whether the short message data is sent in a sub-packet mode in the process, and when the short message data is sent in the sub-packet mode, carrying out sub-packet combination processing to obtain a long short message with complete information so as to complete the receiving process of the long short message. By adopting the technical means, the transmitted data information can be transcoded, coded and decoded by the system layer, the complexity of the operation of the application layer is reduced, and the efficiency of the application layer for receiving and sending short messages is improved. In addition, the application layer can also receive a new short message event notification in time, and perform reading, searching, deleting and the like, so that the functional diversity of the application layer is greatly improved, and the experience of the application layer is improved.
Example two:
on the basis of the foregoing embodiment, fig. 3 is a flowchart illustrating a 4G module short message transceiving method for an embedded system according to a second embodiment of the present application, where the method is applied to a 4G module. The 4G module short message sending and receiving method of the embedded system provided in this embodiment may be implemented by a short message sending and receiving device, where the short message sending and receiving device may be implemented in a software and/or hardware manner, and the short message sending and receiving device may be composed of two or more physical entities or may be composed of one physical entity. Generally, the short message transceiving equipment may be a server host, a communication terminal equipment, etc.
The following description will be given by taking the main body of the 4G module short message transceiving method in which the short message transceiving equipment is an embedded system as an example. Referring to fig. 3, the 4G module short message transceiving method of the embedded system is applied to a 4G module, and specifically comprises the following steps:
s301, transcoding the received text information transmitted by the application layer to obtain a first data packet, and decoding the first data packet to generate a first PDU unit packet.
Specifically, the PDU format short message supports three content coding formats of 7BI T, 8BI T and UCS2, and common character codes include ascii, UTF8, UTF16, GB2312, GBK and UCS 2. When the 4G module is used for sending the Chinese short message content, the short message content carried in the PDU protocol message is UCS2 coded. Receiving first text content information and number information of a receiver sent by an application layer, transcoding the first text content information into character UCS2 codes, and packaging and coding the character UCS2 codes and the number information of the receiver to generate the first PDU unit packet. The first PDU unit packet contains a source address, a destination address, a guard (validity) time, a data format, and body information. The first PDU unit also comprises the number of the sender or the receiver, the coding format of the short message content, the length of the short message content, the text content of the short message, the time stamp of the short message service center and other information.
S302, judging whether the length of the first PDU unit packet exceeds a short message length threshold value.
Specifically, when the length of the short message to be sent exceeds the threshold value of the length of the short message, the short message needs to be subjected to sub-packet processing, and the sending and receiving processes of the long short message are realized. Therefore, when transmitting a short message, it is necessary to determine the length of the short message to determine whether the short message is transmitted in a single packet or in a sub-packet manner.
Further, if the first PDU unit packet length exceeds the short message length threshold, S303 is executed.
And S303, encoding the first PDU unit packet into a plurality of second PDU protocol data packets in a packet mode, and sending the second PDU protocol data packets to a system layer, wherein the length of the second PDU protocol data packets is less than or equal to the short message length threshold.
Specifically, the first PDU unit packet is packetized into a plurality of association packets, and the plurality of association packets are encoded into a plurality of second PDU protocol data packets and transmitted to a system layer, so as to realize the transmission process of the long short message.
Further, if the length of the first PDU unit packet exceeds a short message length threshold, the PDU unit packet is divided into a plurality of associated sub packets according to the short message threshold length. The length of the associated sub-package is smaller than or equal to the length threshold of the short message. The related sub-packets are PDU unit packets with related sub-packet marks, and the related sub-packet marks comprise index values representing the sequence and information data representing the total number of sub-packets. The related sub-packets comprise mark segments and information segments, and the mark segments comprise index values representing the sequence and information representing the total number of the sub-packets. The information segment includes source address, destination address, protection (effective) time, data format and text information, number of sender or receiver, short message content coding format, length of short message content, short message text content, short message service center time stamp, etc. The labeled segment is specifically, for example, the first associated sub-packet labeled segment has a packet index value of 1, the second associated sub-packet labeled segment has a packet index value of 2, and so on until all associated sub-packets are labeled. And packaging the mark segment and the information segment into a complete PDU unit packet association sub-packet, and encoding the association sub-packet to generate the second PDU protocol data packet.
Further, if the first PDU unit packet length does not exceed the short message length threshold, S304 is performed.
S304, the first PDU unit packet is encoded to generate a first PDU protocol data packet, and the first PDU protocol data packet is sent to a system layer.
Specifically, if the length of the first PDU unit packet does not exceed the short message length threshold and the length of the sent short message is within the range of single packet sending, the first PDU unit packet is encoded to generate a first PDU protocol data packet and sent to a system layer, so that the short message is sent.
S305, decoding the PDU protocol data packet received from the system layer to generate a third PDU unit packet.
Specifically, whether a short message AT instruction is reported by the 4G module is checked, a PDU protocol data packet is extracted from the AT instruction after the short message AT instruction is reported, and a third PDU unit packet is generated according to the decoding of the PDU protocol data packet, wherein the third PDU unit packet comprises information such as date, PDU type, sender number, data coding format, user data and the like.
S306, judging whether the third PDU unit packet has the associated sub-packet.
Specifically, if the associated packet exists, S307 is executed.
S307, merging and encoding the third PDU unit packet and the related sub-packet thereof to obtain a second data packet with complete data, transcoding the second data packet with complete data to obtain second text information with complete information, and transmitting the second text information to an application layer.
Further, if there is no association package, S308 is executed.
S308, coding the third PDU unit packet to obtain a third data packet, transcoding the third data packet to obtain third text information, and transmitting the third text information to an application layer.
In an embodiment, referring to fig. 4, the determining whether the third PDU unit packet has an associated sub-packet includes:
s401, checking whether the PDU unit packet linked list has the third PDU unit packet.
Further, if the third PDU unit packet does not exist in the PDU unit packet linked list, the PDU unit packet linked list is repeatedly checked.
Further, if the third PDU unit packet exists in the PDU unit packet linked list, then S402 is executed.
S402, taking out the third PDU unit packet from the PDU unit packet linked list.
S403, checking whether the third PDU unit packet has a related packet mark.
Further, if the extracted third PDU unit packet has an associated packetization flag, S404 is executed.
S404, continuously checking the PDU unit packet chain table, taking out the associated sub-packet with the associated sub-packet mark corresponding to the third PDU unit packet, combining the third PDU unit packet and the associated sub-packet to obtain a complete fourth PDU unit packet, and encoding the fourth PDU unit packet to obtain the second data packet.
Further, if the extracted third PDU unit packet does not have the associated packetization flag, S405 is performed.
S405, coding the third PDU unit packet to obtain the third data packet.
Specifically, the PDU unit packet chain table is checked, if the third PDU unit packet exists in the PDU unit packet chain table, the third PDU unit packet is taken out from the PDU unit packet chain table, whether a related sub-packet mark exists in the third PDU unit packet that is taken out is checked, if the related sub-packet mark does not exist, the third PDU unit packet is encoded into a UCS2 code, and the UCS2 code is transcoded into third text information and sent to an application layer.
Further, if the third PDU unit packet taken out is checked to have the associated sub-packet mark, whether the unit packets in the PDU unit packet linked list have the corresponding associated sub-packet mark or not is continuously checked. Combining the related sub-packets with the corresponding related sub-packet marks according to an index sequence, wherein the combining rule is that the sub-packets with the same total number information in the mark segments in the related sub-packet marks are combined, and if the combining is successful, a PDU unit packet with complete information content is obtained; and if the combination fails, the association sub-packets which fail to be combined are moved into the linked list to be combined, and the combination processing is carried out after all the association sub-packets are received. And coding the fourth PDU unit packet obtained after combination into UCS2 codes, transcoding the UCS2 codes into second text information and sending the second text information to an application layer.
In an embodiment, the PDU unit packet linked list is periodically checked to check whether an expired PDU unit packet exists in the PDU unit packet linked list; and if the expired PDU unit packet exists, deleting the expired PDU unit packet from the PDU unit packet linked list. And deleting the overdue PDU unit packet to prevent other associated sub-packets from being combined and staying in the PDU unit packet linked list all the time due to the loss of the associated sub-packets, thereby improving the working efficiency of the system in the process of transmitting and receiving.
In one embodiment, the application layer is informed of receiving a new short message event through a callback function program; the application layer can read, search and delete the short message. When the system is initialized, a notification callback function and a short message callback function are added, when a new short message is received, the application layer is notified of the event of the received new short message through the notification callback function program, and when the application layer deletes the short message, the application layer notifies the 4G module to synchronously delete the short message stored in the 4G module through the deletion callback function.
Further, when receiving new information, receiving a PDU unit packet report new message, sequentially inserting the PDU unit packet report new message into an information linked list according to a date stamp of a short message service center by the system, placing the latest message at the forefront of the linked list, and notifying an application layer of the new message by notifying a callback function, wherein the application layer can read the latest message. The application layer can search the short message by using the mobile phone number, and can specify the index number to search the short message when a plurality of same short messages exist.
The method is applied to the 4G module, the text information sent by the application layer is transcoded, coded and decoded to obtain the PDU protocol data packet which can be transmitted to the system layer, the short message sending process is completed, whether the length of the short message exceeds the threshold value of single packet sending or not is judged in the process, sub-packet processing is performed when the length of the short message exceeds the threshold value of single packet sending, and the sending process is completed in a mode of sub-packet sending of the long short message. The method comprises the steps of coding, decoding and transcoding a PDU protocol data packet sent by a system layer to obtain visual text information which can be transmitted to an application layer for reading, completing the receiving process of short messages, judging whether the short message data is sent by sub-packaging in a mode, and when the short message data is sent by sub-packaging in a mode, combining and processing sub-packaging to obtain long short messages with complete information so as to complete the receiving process of the long short messages. By adopting the technical means, the transmitted data information can be transcoded, coded and decoded through the 4G module, the running complexity of the application layer is reduced, and the short message transceiving efficiency of the application layer is improved. In addition, the application layer can also receive a new short message event notification in time, and perform reading, searching, deleting and the like, so that the functional diversity of the application layer is greatly improved, and the experience of the application layer is improved.
The foregoing is considered as illustrative of the preferred embodiments of the invention and the technical principles employed. The present application is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present application has been described in more detail with reference to the above embodiments, the present application is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present application, and the scope of the present application is determined by the scope of the claims.

Claims (10)

1. A4G module short message receiving and sending method of an embedded system is used for a system layer and is characterized by comprising the following steps:
transcoding first text information transmitted by a received application layer to obtain a first data packet, and decoding the first data packet to generate a first PDU unit packet;
judging whether the length of the first PDU unit packet exceeds a short message length threshold value;
if yes, the first PDU unit packet is encoded into a plurality of second PDU protocol data packets in a packet-dividing mode and sent to the 4G module, and the length of the second PDU protocol data packets is smaller than or equal to the short message length threshold value;
if not, the first PDU unit packet is encoded to generate a first PDU protocol data packet, and the first PDU protocol data packet is sent to the 4G module;
decoding and processing a PDU protocol data packet received from a 4G module to generate a third PDU unit packet, and judging whether the third PDU unit packet has a related sub-packet or not;
if so, merging and encoding the third PDU unit packet and the associated sub-packet thereof to obtain a second data packet with complete data, transcoding the second data packet with complete data to obtain second text information with complete information, and transmitting the second text information to an application layer;
and if not, coding the third PDU unit packet to obtain a third data packet, transcoding the third data packet to obtain third text information, and transmitting the third text information to an application layer.
2. The 4G module short message transceiving method of claim 1, wherein checking whether the third PDU packet exists in the PDU packet chain table;
if the third PDU unit packet exists, taking the third PDU unit packet out of the PDU unit packet linked list;
checking whether the third PDU unit packet has an associated packet mark;
if the third PDU unit packet has the associated sub-packet mark, the PDU unit packet linked list is continuously checked, the associated sub-packet with the associated sub-packet mark corresponding to the third PDU unit packet is taken out, the third PDU unit packet and the associated sub-packet thereof are merged to obtain a complete fourth PDU unit packet, and the fourth PDU unit packet is encoded to obtain the second data packet;
and if the third PDU unit packet does not have the associated packet mark, encoding the third PDU unit packet to obtain the third data packet.
3. The 4G module short message transceiving method of claim 2, wherein the PDU unit packet linked list is periodically checked to check whether there is an expired PDU unit packet in the PDU unit packet linked list;
and if the expired PDU unit packet exists, deleting the expired PDU unit packet from the PDU unit packet linked list.
4. The 4G module short message transceiving method of the embedded system according to any one of claims 1 to 3, wherein the associated sub-packets are PDU unit packets having associated sub-packet flags, and the associated sub-packet flags include index values indicating the order and information data indicating the total number of sub-packets.
5. The 4G module short message transceiving method of claim 4, wherein the application layer is notified of the reception of a new short message event by a callback function program;
the application layer can read, search and delete the short message.
6. A4G module short message receiving and sending method of an embedded system is applied to a 4G module, and is characterized by comprising the following steps:
transcoding the received text information transmitted by an application layer to obtain a first data packet, and decoding the first data packet to generate a first PDU unit packet;
judging whether the length of the first PDU unit packet exceeds a short message length threshold value or not;
if yes, the first PDU unit packet is encoded into a plurality of second PDU protocol data packets in a packet-dividing mode and sent to a system layer, and the length of the second PDU protocol data packets is smaller than or equal to the short message length threshold;
if not, the first PDU unit packet is coded to generate a first PDU protocol data packet, and the first PDU protocol data packet is sent to a system layer;
decoding and processing a PDU protocol data packet received from a system layer to generate a third PDU unit packet, and judging whether the third PDU unit packet has associated sub-packets;
if so, merging and encoding the third PDU unit packet and the associated sub-packet thereof to obtain a second data packet with complete data, transcoding the second data packet with complete data to obtain second text information with complete information, and transmitting the second text information to an application layer;
and if not, coding the third PDU unit packet to obtain a third data packet, transcoding the third data packet to obtain third text information, and transmitting the third text information to an application layer.
7. The 4G module short message transceiving method of claim 6, wherein checking whether said third PDU unit packet exists in a PDU unit packet chain table;
if the third PDU unit packet exists, taking the third PDU unit packet out of the PDU unit packet linked list;
checking whether the third PDU unit packet has an associated packet mark;
if the third PDU unit packet has the associated sub-packet mark, continuously checking the PDU unit packet linked list, taking out the associated sub-packet with the associated sub-packet mark corresponding to the third PDU unit packet, combining the third PDU unit packet and the associated sub-packet thereof to obtain a complete fourth PDU unit packet, and encoding the fourth PDU unit packet to obtain the second data packet;
and if the third PDU unit packet does not have the associated packet mark, encoding the third PDU unit packet to obtain the third data packet.
8. The 4G module short message transceiving method of claim 7, wherein the PDU unit packet linked list is periodically checked to see if there is an expired PDU unit packet in the PDU unit packet linked list;
and if the expired PDU unit packet exists, deleting the expired PDU unit packet from the PDU unit packet linked list.
9. The 4G module short message transceiving method of the embedded system according to any one of claims 6 to 8, wherein the associated sub-packets are PDU unit packets having associated sub-packet flags, and the associated sub-packet flags include index values indicating the order and information data indicating the total number of sub-packets.
10. The 4G module short message transceiving method of the embedded system as claimed in claim 9, wherein the application layer is notified of the reception of a new short message event through a callback function program;
the application layer can read, search and delete the short message.
CN202110683242.5A 2021-06-21 2021-06-21 4G module short message receiving and transmitting method for embedded system Active CN113490165B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110683242.5A CN113490165B (en) 2021-06-21 2021-06-21 4G module short message receiving and transmitting method for embedded system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110683242.5A CN113490165B (en) 2021-06-21 2021-06-21 4G module short message receiving and transmitting method for embedded system

Publications (2)

Publication Number Publication Date
CN113490165A CN113490165A (en) 2021-10-08
CN113490165B true CN113490165B (en) 2022-09-02

Family

ID=77934080

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110683242.5A Active CN113490165B (en) 2021-06-21 2021-06-21 4G module short message receiving and transmitting method for embedded system

Country Status (1)

Country Link
CN (1) CN113490165B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101001413A (en) * 2007-01-08 2007-07-18 宇龙计算机通信科技(深圳)有限公司 Long-short message transmission method of CDMA network
CN106535145A (en) * 2016-12-19 2017-03-22 宇龙计算机通信科技(深圳)有限公司 Short message transmission method, short message transmission device, terminal and application server
CN107333247A (en) * 2016-04-28 2017-11-07 努比亚技术有限公司 SMS processing, apparatus and system
CN111669219A (en) * 2020-07-06 2020-09-15 成都卫士通信息产业股份有限公司 Beidou short message data transmission method and device, electronic equipment and computer medium
CN111669718A (en) * 2020-06-19 2020-09-15 天通畅达(深圳)科技有限公司 Mobile information interaction system based on multiple wireless communication channels
CN112383888A (en) * 2020-11-03 2021-02-19 上海中觅通信技术有限公司 Short message system, method and equipment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101001413A (en) * 2007-01-08 2007-07-18 宇龙计算机通信科技(深圳)有限公司 Long-short message transmission method of CDMA network
CN107333247A (en) * 2016-04-28 2017-11-07 努比亚技术有限公司 SMS processing, apparatus and system
CN106535145A (en) * 2016-12-19 2017-03-22 宇龙计算机通信科技(深圳)有限公司 Short message transmission method, short message transmission device, terminal and application server
CN111669718A (en) * 2020-06-19 2020-09-15 天通畅达(深圳)科技有限公司 Mobile information interaction system based on multiple wireless communication channels
CN111669219A (en) * 2020-07-06 2020-09-15 成都卫士通信息产业股份有限公司 Beidou short message data transmission method and device, electronic equipment and computer medium
CN112383888A (en) * 2020-11-03 2021-02-19 上海中觅通信技术有限公司 Short message system, method and equipment

Also Published As

Publication number Publication date
CN113490165A (en) 2021-10-08

Similar Documents

Publication Publication Date Title
US20120278433A1 (en) Method for transmitting and receiving multimedia information and terminal
EP2297645B1 (en) Extended messaging platform
KR20190066065A (en) Encoding and decoding methods and devices
CN101743771A (en) Message broadcasting
CN101621763B (en) Method and corresponding device for displaying sender Chinese name at mobile phone terminal
EP2790378B1 (en) A method, apparatus and computer program for adding content to a data container
JP2007006498A (en) Method for providing transmitting function with extended short message service
CN101350858A (en) Method for decoding short message and user terminal
CN104869174A (en) File transmission method based on third party message-oriented middle-ware
CN113395130A (en) Communication method and device
EP3893419A1 (en) Data retransmission decoding method, apparatus and system, and communication device
WO2015117407A1 (en) Processing method and device for terminal information
CN101622889A (en) Move the route of the short message of initiating
CN113490165B (en) 4G module short message receiving and transmitting method for embedded system
EP1300976A1 (en) Method of blind transport format detection
CN109428676B (en) Method and device for synchronizing forward error correction coding and decoding modes
CN107645700B (en) Mobile communication data transmission method based on USSD protocol
CN102970661A (en) Method and device for code conversion of short messages
EP2860915B1 (en) Method of handling SMS messages and related communication system
CN1897579A (en) Multiple language support system and method for mail transmitting
CN115412190A (en) Voice communication system of very high frequency data exchange system and implementation method
CN102281516B (en) Short message processing method and short message processing terminal
WO2002041498A2 (en) Communication system and method utilizing request-reply communication patterns for data compression
KR100956793B1 (en) Method and Server for Transforming Message Format for Interworking between Different Message Standards
CN111225423B (en) Method and device for forwarding data

Legal Events

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
CB02 Change of applicant information

Address after: 510000 room 306, 3rd floor, 43 Sicheng Road, software park, Tianhe District, Guangzhou City, Guangdong Province

Applicant after: GUANGZHOU ZHIYUAN ELECTRONICS Co.,Ltd.

Address before: 510000 room 306, 3rd floor, 43 Sicheng Road, software park, Tianhe District, Guangzhou City, Guangdong Province

Applicant before: GUANGZHOU ZHIYUAN ELECTRONICS Co.,Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant
CB03 Change of inventor or designer information

Inventor after: Zhou Ligong

Inventor after: Wang Linfu

Inventor after: Weng Yedong

Inventor after: Cao Wenjing

Inventor after: Chen Yangxin

Inventor before: Zhou Ligong

Inventor before: Wang Linfu

Inventor before: Weng Yedong

Inventor before: Cao Wenjing

Inventor before: Chen Yangxin

CB03 Change of inventor or designer information