CN107182083B - Mobile terminal and data packet transmission method - Google Patents

Mobile terminal and data packet transmission method Download PDF

Info

Publication number
CN107182083B
CN107182083B CN201710395965.9A CN201710395965A CN107182083B CN 107182083 B CN107182083 B CN 107182083B CN 201710395965 A CN201710395965 A CN 201710395965A CN 107182083 B CN107182083 B CN 107182083B
Authority
CN
China
Prior art keywords
data packet
modem
character
length
extracted
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
CN201710395965.9A
Other languages
Chinese (zh)
Other versions
CN107182083A (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.)
Nubia Technology Co Ltd
Original Assignee
Nubia Technology 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 Nubia Technology Co Ltd filed Critical Nubia Technology Co Ltd
Priority to CN201710395965.9A priority Critical patent/CN107182083B/en
Publication of CN107182083A publication Critical patent/CN107182083A/en
Application granted granted Critical
Publication of CN107182083B publication Critical patent/CN107182083B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W88/00Devices specially adapted for wireless communication networks, e.g. terminals, base stations or access point devices
    • H04W88/02Terminal devices
    • H04W88/06Terminal devices adapted for operation in multiple networks or having at least two operational modes, e.g. multi-mode terminals
    • 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

Abstract

The invention discloses a mobile terminal and a data packet transmission method, wherein the mobile terminal comprises a first processing chip, a second processing chip, a first radio frequency module and a second radio frequency module, the first processing chip comprises a first application processor and a first modem connected with a first user identification card and a second user identification card, and the second processing chip comprises a second application processor and a second modem; the first modem receives a data packet acquisition request sent by the second modem through a preset interface, and extracts a data packet from the first subscriber identification card or the second subscriber identification card; compressing the extracted data packet; and then buffering the data packet into a temporary buffer of a preset interface, so that the second modem extracts the compressed data packet from the buffer to complete the transmission of the data packet. The invention avoids the condition that the terminal is halted due to overlarge containment value in the data packet transmission process.

Description

Mobile terminal and data packet transmission method
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a mobile terminal and a data packet transmission method.
Background
With the development of mobile communication technology, more and more mobile terminals such as smart phones have a dual-card dual-pass function, so that a user can establish data service connection while realizing the standby of voice service. A Mobile terminal generally has two subscriber identity cards and a modem connected to the two subscriber identity cards, respectively, when the two subscriber identity cards are fully opened, one subscriber identity card (SIM1) may use 4G (the 4th Generation Mobile Communication Technology, fourth Generation Mobile Communication Technology), such as LTE (Long Term Evolution) network, and the other subscriber identity card (SIM2) can only use 2G (2-Generation wireless telephone Technology, second Generation Mobile Communication specification) or 3G (3 Generation, third Generation Mobile Communication Technology) network, and the reason why the SIM2 cannot be connected to 4G is mainly: the mobile terminal only has one set of radio frequency, the two cards use the set of radio frequency in a time-sharing multiplexing relationship, and cannot occupy simultaneously, and because when the two cards are fully opened, only one card can use a 4G network, and the other card can only use a 2G or 3G network, the efficiency of data transmission in the mobile terminal is low.
Therefore, in order to enable the mobile terminal to support dual LTE to improve data transmission efficiency, the mobile terminal may have two processing chips, each processing chip corresponding to one modem, so that two SIM cards of the mobile terminal are connected with different modems, thereby implementing a dual LTE communication function. However, when the subscriber identity module card in the mobile terminal is a telecommunication card, since the telecommunication card is generally larger than the capacity value of the temporary buffer for data transmission between modems, the buffer cannot buffer a complete data packet, and if the data transmission is directly performed, the mobile terminal is easily halted.
Disclosure of Invention
The invention mainly aims to provide a mobile terminal and a data packet transmission method, and aims to solve the technical problem that the mobile terminal is easy to crash due to the existing data packet transmission mode.
In order to achieve the above object, the present invention provides a mobile terminal, where the mobile terminal includes a first processing chip and a second processing chip connected based on a preset interface, a first radio frequency module connected to the first processing chip, and a second radio frequency module connected to the second processing chip, the first processing chip includes a first application processor and a first modem connected to a first subscriber identity card and a second subscriber identity card, and the second processing chip includes a second application processor and a second modem;
the first modem is used for extracting a data packet corresponding to the data packet acquisition request from the first subscriber identification card or the second subscriber identification card when receiving the data packet acquisition request sent by the second modem through a preset interface; compressing the extracted data packet; and caching the compressed data packet into a temporary buffer area of the preset interface so that the second modem can extract the compressed data packet from the buffer to finish the transmission of the data packet.
Optionally, the first modem is further configured to determine whether a compression identifier added by the second modem can be extracted from the data packet obtaining request; and if the compression identification can be extracted, compressing the extracted data packet.
Optionally, the first modem is further configured to parse the extracted data packet to obtain a packet header of the data packet; determining a length of the data packet based on a header of the data packet; and when the length of the data packet is greater than a preset threshold value, compressing the extracted data packet.
Optionally, the compressing, by the first modem, the extracted data packet specifically includes:
the first modem acquires a source text corresponding to the data packet;
determining character segments with the occurrence frequency greater than a preset frequency in a source text;
searching codes corresponding to the character segments in a preset dictionary list, wherein the length of the codes is smaller than that of the corresponding character segments;
and replacing the corresponding character segment by the searched code to realize the compression of the data packet.
Optionally, the first modem is further configured to determine whether there are character segments with the same content and a length greater than a preset value in the source text;
if yes, determining the distance between the next character segment and the previous character end and the length of the character segment;
and the identifier of the distance and the length is adopted to replace the next character segment so as to realize the compression of the data packet.
In addition, to achieve the above object, the present invention further provides a data packet transmission method, where the data packet transmission method is applied to a mobile terminal, the mobile terminal includes a first processing chip and a second processing chip connected based on a preset interface, a first radio frequency module connected to the first processing chip, and a second radio frequency module connected to the second processing chip, the first processing chip includes a first application processor and a first modem connected to a first subscriber identity card and a second subscriber identity card, and the second processing chip includes a second application processor and a second modem, and the method includes:
when a first modem receives a data packet acquisition request sent by a second modem through a preset interface, extracting a data packet corresponding to the data packet acquisition request from a first subscriber identification card or a second subscriber identification card;
compressing the extracted data packet;
and caching the compressed data packet into a temporary buffer area of the preset interface so that the second modem can extract the compressed data packet from the buffer to finish the transmission of the data packet.
Optionally, before the step of compressing the extracted data packet, the data packet transmission method further includes:
the first modem judges whether the compression identification added by the second modem can be extracted from the data packet acquisition request or not;
and if the compression identification can be extracted, executing the step of compressing the extracted data packet.
Optionally, before the step of compressing the extracted data packet, the data packet transmission method further includes:
the first modem analyzes the extracted data packet to obtain a packet header of the data packet;
determining a length of the data packet based on a header of the data packet;
and when the length of the data packet is greater than a preset threshold value, executing the step of compressing the extracted data packet.
Optionally, the step of compressing the extracted data packet includes:
the first modem acquires a source text corresponding to the data packet;
determining character segments with the occurrence frequency greater than a preset frequency in a source text;
searching codes corresponding to the character segments in a preset dictionary list, wherein the length of the codes is smaller than that of the corresponding character segments;
and replacing the corresponding character segment by the searched code to realize the compression of the data packet.
Optionally, after the step of obtaining the source text corresponding to the data packet by the first modem, the step of compressing the extracted data packet further includes:
determining whether character segments with the same content and the length larger than a preset value exist in a source text;
if yes, determining the distance between the next character segment and the previous character end and the length of the character segment;
and the identifier of the distance and the length is adopted to replace the next character segment so as to realize the compression of the data packet.
According to the technical scheme provided by the invention, the mobile terminal comprises a first processing chip and a second processing chip which are connected based on a preset interface, a first radio frequency module connected with the first processing chip, and a second radio frequency module connected with the second processing chip, wherein the first processing chip comprises a first application processor and a first modem connected with a first user identification card and a second user identification card, and the second processing chip comprises a second application processor and a second modem; when a first modem receives a data packet acquisition request sent by a second modem through a preset interface, a data packet corresponding to the data packet acquisition request is extracted from a first subscriber identification card or a second subscriber identification card, then the extracted data packet is compressed, and the compressed data packet is cached into a buffer of the preset interface so that the second modem can extract the compressed data packet from the buffer to complete the transmission of the data packet. According to the scheme, when the data packet is transmitted, the data packet to be transmitted is compressed firstly, and then the compressed data packet is transmitted, so that the capacity value of the transmitted data packet is reduced to some extent, and the condition that the mobile terminal crashes in the data transmission process is avoided.
Drawings
Fig. 1 is a schematic diagram of an LTE network architecture according to an embodiment of the present invention;
fig. 2 is a schematic diagram of a hardware structure of a mobile terminal according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of the interaction between a first modem and a second modem in accordance with the present invention;
fig. 4 is a flowchart illustrating a data packet transmission method according to a first embodiment of the present invention.
The implementation, functional features and advantages of the present invention will be described with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention. It should be noted that the embodiments and features of the embodiments of the present invention may be arbitrarily combined with each other without conflict.
For a more clear understanding of the technical features, objects and effects of the present invention, embodiments of the present invention will now be described in detail with reference to the accompanying drawings.
Fig. 1 is a schematic diagram of an LTE network architecture according to an embodiment of the present invention. The LTE network architecture of an embodiment of the invention comprises: one or more mobile terminals (UEs) 100, an E-UTRAN (Evolved UMTS Terrestrial Radio Access Network) (not numbered), an Evolved Packet Core (EPC) (not numbered), a Home Subscriber Server (HSS)107, a Network (e.g., the internet) (not numbered), and a circuit switched system (not numbered).
The E-UTRAN includes evolved node Bs (eNodeBs) 101 and other eNodeBs 102. The eNodeB 101 provides protocol terminations towards the user plane and the control plane of the mobile terminal 100. eNodeB 101 may be connected to other enodebs via an X2 interface. The eNodeB 101 may also be referred to as a base station, a base transceiver station, a radio base station, a radio transceiver, a transceiver function, a basic service set, an extended service set, or some other suitable terminology. The eNodeB 101 provides an access point for the mobile terminal 100 to the EPC.
eNodeB 101 connects to the EPC through the S1 interface. The EPC includes a mobility management entity (EEM)104, other mobility management entities 106, a serving gateway 103, and a Packet Data Network (PDN) gateway 105. The mobility management entity 104 is a control node that handles signaling between the mobile terminal 100 and the EPC. The mobility management entity 104 provides bearer and connection management. All user IP packets are passed through the serving gateway 103, the serving gateway 103 itself being connected to the PDN gateway 105. The PDN gateway 105 provides UE IP address allocation as well as other functions. The PDN gateway 105 is connected to a network, e.g. the internet.
The circuit switched system includes an interactive solution module (IWS)108, a Mobile Switching Center (MSC)109, a base station 110, and a mobile station 111. In one aspect, the circuit switched System may communicate with an EPS (Evolved Packet System) through an IWS and an MME (Mobility Management Entity).
Fig. 2 is a schematic diagram of a hardware structure of the mobile terminal 100 according to an embodiment of the present invention.
In the embodiment of the present invention, the mobile terminal 100 includes a first processing chip 001 and a second processing chip 002, a first rf module 12 connected to the first processing chip 001, and a second rf module 22 connected to the second processing chip 002. The first processing chip 001 and the second processing chip 002 are connected through a preset interface. The preset interface comprises a first preset interface and a second preset interface. The first processing chip 001 includes a first Application Processor (AP 1) 10, a first modem 11(modem1) connected to the first user identification card 13 and the second user identification card 14, and an RPM (Resource Power Manager) 15. The second processing chip 002 includes a second application processor 20 and a second modem (modem2) 21. The Subscriber Identity cards (the first Subscriber Identity card 13 and the second Subscriber Identity card 14) are SIM (Subscriber Identity Module) cards.
The internal framework of the first application processor 10 and the second application processor 20 includes an application layer, a framework layer, and the like, and can handle complex logical operations and perform task allocation, and the like. In the embodiment of the present invention, the application processor refers to an Android operating system and various apks (Android packages) based on the Android operating system.
In the embodiment of the present invention, the first application processor 10 and the second application processor 20 are connected through a first preset interface, provide an interactive interface for a user, and transmit an operation instruction input by the user (for example, an operation instruction input by the user through the user interface and related to starting a video call) to the first modem 11 or the second modem 21, so as to define and transfer data between the two application processors, for example, perform sleep, wake-up, synchronous control of the two application processors, control of a chip start-up sequence during power on and power off, and the like. The first predetermined interface is a Universal Serial Bus (USB). It should be understood that in the embodiment of the present invention, the USB data line multiplexes two data channels, which are respectively used for the interaction between the user data and the control signaling data between the first application processor 10 and the second application processor 20, that is, the data transmitted by the first application processor 10 and the second application processor 20 through the USB data line includes the above two data. The user data comprises data generated by surfing the Internet, pictures and chatting information data; the control signaling data comprises control data of startup and shutdown, control data of flight mode of the switch and control data of display state signals.
In this embodiment, The first application processor 10 and The second application processor 20 perform data interaction by using an OTG (On-The-Go) technology. Through the OTG technology, the first modem 11 in the mobile terminal 100 can access the eNodeB 101 through the SIM card parameters in the first subscriber identity card 13, and the second modem 21 can access the eNodeB 101 through the SIM card parameters in the second subscriber identity card 14; or the first modem 11 accesses the eNodeB 101 through the SIM card parameters in the second subscriber identity card 14 and the second modem 21 accesses the eNodeB 101 through the SIM card parameters in the first subscriber identity card 13. The SIM card parameters include, but are not limited to, SIM card authentication data.
The first modem 11 and the second modem 21 are connected through a second preset interface. In the embodiment of the present invention, the second predetermined interface is a UART (Universal Asynchronous Receiver/Transmitter). The UART is used for the transmission of SIM card parameters between the first modem 11 and the second modem 21. Wherein, buffers of the UART interface exist at both ends of the first modem 11 and the second modem 21, which are denoted by buffers 1 and 2. It should be noted that the buffer1 and the buffer2 correspond to the same physical address, and the synchronous change of the capacity values and the states of the buffer1 and the buffer2 can be controlled through the physical address.
Specifically, the method comprises the following steps: when the second modem 21 receives a SIM card data acquisition request sent by the base station through the second radio frequency module 22, the data acquisition request is transmitted to the first modem 11, and the first modem 11 feeds back the response SIM card data.
The triggering mode of the SIM card data acquisition request comprises two modes:
A. the second modem 21 actively registers the LTE network to trigger the SIM card data acquisition request;
B. the base station side needs to authenticate whether the user is legal or not, and sends an authentication request to the second modem 21, and the second modem 21 actively sends an SIM card data acquisition request.
When the second modem 21 receives a SIM card data acquisition request sent by the base station through the second rf module 22, the data acquisition request is transmitted to the first modem 11 through the UART, and the first modem 11 acquires data from the first subscriber identity card 13 or the second subscriber identity card 14 according to the data acquisition request, which will be described in detail below by taking an example that the first modem 11 acquires data from the first subscriber identity card 13 according to the data acquisition request.
It should be understood that the first subscriber identity card 13 includes a Chip Operating System (COS Operating System) Operating System and a storage module, wherein the COS Operating System is used as a file proxy of the storage module, and data is extracted from the storage module according to a data acquisition request sent by the first modem 11, and the storage module is used for storing data. That is, in the embodiment of the present invention, the first modem 11 cannot interact with the memory module inside the first subscriber identity card 13 to obtain data, and can only obtain data through the COS operating system. Therefore, when the first modem 11 sends a data obtaining request to the first subscriber identity card 13, the COS operating system inside the first subscriber identity card 13 parses out the address information of the data obtaining request, and then obtains the data corresponding to the address information from the storage module according to the address information. After the COS operating system retrieves data from the storage module, the retrieved data is fed back to the first modem 11.
After acquiring the data fed back by the COS operating system, the first modem 11 sends the data to the second modem 21 through the UART, and finally the second modem 21 uploads the data to the base station through the second rf module 22 to complete authentication.
Since it has been described above that the buffer1 and the buffer2 correspond to the same physical address, when the first modem 11 buffers the extracted data packet into the buffer1, the data packet is sent to the buffer2 through the UART for buffering, and when the second modem 21 detects the data packet in the buffer2, the data packet can be acquired, so as to implement transmission of the data packet.
It is understood that the connection between the first processing chip 001 and the second processing chip 002 can be realized through the first preset interface and/or the second preset interface.
The first modem 11 and the second modem 21 include protocol stacks of various network systems for network interaction, where the protocol stacks include protocol codes specified in Communication standards such as LTE (Long Term Evolution)/WCDMA (Wideband Code Division Multiple Access)/GSM (Global System for Mobile Communication), TD-SCDMA (Time Division-Synchronous Code Division Multiple Access, Synchronous Time Division Multiple Access)/CDMA (Code Division Multiple Access )/EDGE (Enhanced Data Rate for GSM Evolution). The mobile terminal 100 interacts with the operator network through a protocol, that is, data traffic internet access, volte (voice Over lte) call or CS (Circuit Switched) call is performed. The first modem 11 and the second modem 21 are also used for management of SIM cards and the like.
In the embodiment of the present invention, the first rf module 12 is configured to process data transmitted by the first processing chip 001 and transmit the processed data to the eNodeB 101 (base station network), and is configured to process data transmitted by the eNodeB 101 and transmit the processed data to the first processing chip 001. The second rf module 22 is configured to process data transmitted by the second processing chip 002 and then transmit the processed data to the eNodeB 101 (base station network), and is configured to process data transmitted by the eNodeB 101 and then transmit the processed data to the second processing chip 002.
The Radio access technologies related to the first Radio frequency module 12 and the second Radio frequency module 22 may include LTE, GSM, GPRS (General Packet Radio Service), CDMA, EDGE, WLAN (Wireless Local Area network), CDMA-2000, TD-SCDMA, WCDMA, WIFI (Wireless Fidelity), and the like.
The first subscriber identification card 13 and the second subscriber identification card 14 in the mobile terminal 100 store subscriber information associated with different wireless communication standards. It should be understood that the current mobile terminal only has one set of radio frequency, and two subscriber identity modules in the mobile terminal use the set of radio frequency in a time division multiplexing relationship, and cannot occupy simultaneously. For example, when two subscriber identity cards are fully opened, one card can process GSM calls, and the other card can only process 4G network information, and specifically which subscriber identity card executes which network is not limited. Therefore, the current architecture of radio frequency dual-card time division multiplexing only achieves LTE + GSM (that is, the technical standard corresponding to one subscriber identity card is LTE, and the technical standard corresponding to the other subscriber identity card is GSM).
That is to say, although the conventional mobile terminal 100 may support a dual-user identification card, when the mobile terminal 100 registers a network, two user identification cards support networks of different technical standards, one supports 2G or 3G, and the other supports 4G, so that the internet traffic speed is slower in the use process of the mobile terminal 100, in the present invention, the mobile terminal 100 is connected to the first processing chip 001 and the second processing chip 002 through a preset interface, because the second processing chip 002 includes the second modem 21 and is connected to the second rf module 22, and the second rf module 22 supports a 4G network. Therefore, the mobile terminal 100 may be provided with dual LTE functions by the first processing chip 001 and the second processing chip 002.
In the present embodiment, the first subscriber identification card 13 and the second subscriber identification card 14 are used to provide relevant data required for mobile communication services (CS voice service, PS data service, and PS voice service), and store user information, short messages, perform authentication algorithms, generate encryption keys, and the like therein.
When the subscriber identity cards (the first subscriber identity card 13 and the second subscriber identity card 14) interact with the mobile terminal 100, a signal for the mobile terminal 100 to detect the presence or absence of the subscriber identity card is generated only at the instant of power-on, and when the presence of the subscriber identity card is not detected at power-on, the mobile terminal 100 prompts "insert subscriber identity card". After the mobile terminal 100 is powered on, the mobile terminal 100 and the subscriber identity card are communicated once in 28 seconds, completing some fixed communication checks (e.g., whether the subscriber identity card is in place, etc.).
In the embodiment of the present invention, the first subscriber identity card 13 and the second subscriber identity card 14 bear information, and return corresponding card parameters according to an external request, and perform authentication operation on the network, and the radio access technology related to the first radio frequency module 12 and the second radio frequency module 22 is LTE. When the first application chip 001 and the second application chip 002 are connected, the first subscriber identification card 13 may support LTE through the first modem 11 in the mobile terminal 100, and the second subscriber identification card 14 may support LTE through the second modem 21; alternatively, the first subscriber identity card 13 may support LTE through the second modem 21 and the second subscriber identity card 14 supports LTE through the first modem 11, so that the mobile terminal 100 may support dual LTE.
RPM15 in mobile terminal 100 is used to manage various resources including clock resources, bus resources, PMIC (Power Management IC, i.e., voltage of each chip), DDR (memory allocation), and interrupts for managing sleep wake-up of chips and deadlines for application processor wake-up. Each subsystem of the mobile terminal 100 applies for resources from RPM15 when the resources are needed, each subsystem includes a first application processor 10, a first modem 11, a PRONTO (WIFI/bluetooth, NFC (Near Field Communication, etc.), an LPASS (Low power audio subsystem), and an RPM15, where RPM 3526 is used to determine a sleep state of the mobile terminal 100 system, specifically, RPM15 is implemented based on a voting mechanism of each subsystem, and when each subsystem casts a sleep ticket, RPM15 may enable the entire system of the mobile terminal 100 to sleep. After the whole system of the mobile terminal 100 is dormant, if the operation is to be restarted, the second processing chip 002 may automatically wake up, but the first processing chip 001 needs the second processing chip 002 to wake up for data transmission interaction.
In the embodiment of the present invention, when the first processing chip 001 and the second processing chip 002 are connected to each other through the predetermined interface, the wake-up mode may be as follows:
1. when the first application processor 10 receives the control signaling data, it transmits a probe packet to the second application processor 20 through the USB interface to wake up the second application processor 20.
2. When the second modem 21 receives the user data, it wakes up the second application processor 20, and the second application processor 20 transmits the probe packet to the first application processor 10 through the USB interface to wake up the first application processor 10.
3. The second modem 21 periodically searches for a paging request to actively activate itself, wakes up the second application processor 20 if the paging request is received, and sends a probe packet to the first application processor 10 through the USB interface by the second application processor 20 to wake up the second application processor 20.
Furthermore, the second modem 21 may wake itself up periodically to perform handshake interaction with the base station when the mobile terminal 100 performs location update, without waking up the first application processor 10.
In the embodiment of the present invention, the mobile terminal includes, but is not limited to, a mobile phone, a PC (Personal Computer), or a PAD (Personal Digital Assistant).
It should be noted that, when the transmitted data packet is user data or control signaling data, the user data or control signaling data is transmitted between the application processors; when the transmitted data packet is the subscriber identification card data, namely SIM card data, the SIM card data can be transmitted only between the modems; because the embodiment of the invention mainly aims at the condition that the terminal is halted due to the fact that the telecommunication card, namely the SIM card transmits data, the data packet in the embodiment is mainly the data packet transmitted between the modems.
In this embodiment, the SIM card includes a mobile card, a unicom card and a telecommunication card, where the mobile card and the unicom card refer to a telephone card communicating by using a 3GPP standard protocol, and the 3GPP standard protocol specifies that the capacity of a data packet transmitted by the telephone card cannot exceed a certain value, and the value is set to 512 bytes; the telecommunication card is a telephone card adopting 3GPP2 standard protocol, the GPP2 standard protocol does not limit the capacity of data packets transmitted by the telecommunication card, and the capacity of the data packets transmitted by the telecommunication card generally exceeds 512 bytes. The mobile card is an SIM card provided by China Mobile (operator) to the user, the Unicom card is an SIM card provided by China Unicom (operator) to the user, and the telecommunication card is an SIM card provided by China telecom (operator) to the user.
The capacity of the existing buffer does not exceed 512 bytes. Therefore, when the first subscriber identity card 13 and the second subscriber identity card 14 in the mobile terminal 100 are both mobile cards or universal serial bus cards, since the data capacity of the mobile cards or universal serial bus cards for receiving and sending data packets is less than 512 bytes, when the first modem 11 receives a data packet acquisition request, the data packets acquired from the first subscriber identity card 13 and the second subscriber identity card 14 are also less than 512 bytes, and correspondingly, the data packets stored in the buffer are also less than 512 bytes, so that the data packets can be completely stored in the buffer, and subsequently, the second modem 21 can also take out a complete data packet.
However, since the telecommunication card is generally larger than 512 bytes, during the data exchange between the first modem 11 and the second modem 21, if the telecommunication card is connected to the first modem 11, such a situation may occur:
taking fig. 2 as an example, in the case that the first subscriber identity card 13 and the second subscriber identity card 14 are telecommunication cards, the first modem 11 of the mobile terminal 100 extracts a data packet from the first subscriber identity card 13 or the second subscriber identity card 14, and since the data packet is larger than 512 bytes, the buffer can only buffer the data packet with no more than 512 bytes at a time, in this case, the system of the mobile terminal is halted due to the inability to forward the large data packet.
If this problem is to be solved, according to the conventional thinking, the data packet is not forwarded at one time, but is split into a plurality of data packets for forwarding, but for the second modem 21, when a data packet is detected from the buffer, the data packet is considered to be a complete data packet, and at this time, the second modem 21 directly obtains the data packet from the buffer and forwards the data packet to the base station. It is clear that in this case the forwarded data packet is an incomplete data packet.
Based on the architecture diagram of the LTE network, the hardware structure diagram of the mobile terminal 100, and the problems in the prior art, various embodiments of the present invention are provided.
Referring to fig. 2, the present embodiment provides a mobile terminal, the mobile terminal includes a first processing chip 001 and a second processing chip 002 connected based on a preset interface, a first rf module 12 connected to the first processing chip 001, and a second rf module 22 connected to the second processing chip 002, the first processing chip 001 includes a first application processor 10 and a first modem 11 connected to a first subscriber identity card 13 and a second subscriber identity card 14, the second processing chip 002 includes a second application processor 20 and a second modem 21,
the first modem 11 is configured to extract a data packet corresponding to a data packet acquisition request from the first subscriber identity card 13 or the second subscriber identity card 14 when receiving the data packet acquisition request sent by the second modem 21 through a preset interface;
compressing the extracted data packet;
and caching the compressed data packet into a temporary buffer of the preset interface, so that the second modem 21 extracts the compressed data packet from the buffer to complete the transmission of the data packet.
In this embodiment, the first modem 11 receives a data packet obtaining request sent by the second modem 21 through a preset interface, and then feeds back a data packet to the second modem 21 through the preset interface. The preset interface is a UART interface.
When the second modem 21 of the second processing chip 002 receives a data packet acquisition request sent by the base station through the second rf module 22, the data packet acquisition request is first transmitted to the first modem 11 of the first processing chip 001 through the UART; after receiving the data packet acquisition request, the first modem 11 acquires a data packet from the first subscriber identity card 13 or the second subscriber identity card 14 according to the data packet acquisition request; after acquiring the data packet, the first modem 11 first compresses the acquired data packet to obtain a compressed data packet in order to ensure that the transmitted data is not greater than the buffer of the UART; transmitting the compressed data packet to the second modem 21 through the UART; after receiving the data packet, the second modem 21 uploads the data packet to the base station through the second rf module 22, so as to complete transmission of the data packet.
Specifically, the extracting, by the first modem 11, the data packet corresponding to the data packet obtaining request from the first subscriber identity card 13 or the second subscriber identity card 14 specifically includes:
the first modem 11 sends a data packet acquisition request to an on-chip operating system in the first subscriber identity module 13 or the second subscriber identity module 14, and the on-chip operating system extracts a data packet corresponding to the data packet acquisition request from a file storage module in the first subscriber identity module 13 or the second subscriber identity module 14 and feeds the data packet back to the first modem 11;
the first modem 11 receives the data packet fed back by the on-chip os.
In this embodiment, it should be noted that the data packets in the first subscriber identity card 13 or the second subscriber identity card 14 are stored in the file storage module, when the first modem 11 is to acquire a data packet in the first subscriber identification card 13 or the second subscriber identification card 14, the first modem 11 does not directly interact with the file storage module in the first subscriber identification card 13 or the second subscriber identification card 14, but first sends a Request for acquiring data packets to a COS (Chip Operating System) Operating System in the first subscriber identity card 13 or the second subscriber identity card 14, the COS operating system of the first subscriber identification card 13 or the second subscriber identification card 14 then retrieves the data packet in the file storage module based on the Request, and then, the acquired data packet is transmitted to the first modem 11, and the first modem 11 can realize the acquisition process of the data packet as long as receiving the data packet fed back by the COS operating system.
It can be understood that, since the first modem 11 cannot directly extract the data packet from the file storage module in the first subscriber identity card 13 or the second subscriber identity card 14, the data packet is extracted by interacting with the COS operating system of the first subscriber identity card 13 or the second subscriber identity card 14, so as to ensure the normal operation of the subsequent data transmission process.
In this embodiment, when the first modem 11 compresses the data packet, the data packet may be compressed in an encryption compression manner or directly in a plaintext compression manner. Because the amount of transmitted network authentication data of the SIM card is relatively small, in order to reduce operations such as encryption and decryption and the like, which result in low data transmission efficiency, the embodiment of the present invention preferably compresses the data packet by using a plaintext compression method, that is, the compression algorithm used in the present solution is mainly simple and efficient, and the compression algorithm and the compression process specifically used are described in detail in the following embodiments.
After the first modem 11 compresses the data packet, the compressed data packet may be buffered in the buffer of the preset interface UART, so that the second modem 21 may extract the compressed data packet from the buffer to complete the transmission of the data packet.
In this embodiment, it should be noted that the buffers exist at two ends of the UART interface, that is, the buffers 1 and 2 are respectively disposed at two ends of the UART interface. When the second modem 21 receives a data acquisition request sent by the base station through the second radio frequency module 22, the data packet acquisition request is sent to the first modem 11 through the UART interface, after the first modem 11 extracts a data packet from the first subscriber identity card 13 or the second subscriber identity card 14, the extracted data packet is stored in the buffer1 to be transmitted to the buffer2 of the second modem 21 through the UART, and the second modem 21 acquires the data packet from the buffer 2.
In the mobile terminal provided in this embodiment, when the first modem receives the data packet acquisition request sent by the second modem through the preset interface, the first modem first extracts the data packet corresponding to the data packet acquisition request from the first subscriber identity card or the second subscriber identity card, then compresses the extracted data packet, and then caches the compressed data packet in the buffer of the preset interface, so that the second modem extracts the compressed data packet from the buffer to complete transmission of the data packet. According to the scheme, when the data packet is transmitted, the data packet to be transmitted is compressed firstly, and then the compressed data packet is transmitted, so that the capacity value of the transmitted data packet is reduced to some extent, and the condition that the mobile terminal crashes in the data transmission process is avoided.
Further, a second embodiment of the mobile terminal of the present invention is proposed based on the first embodiment.
The second embodiment of the mobile terminal is different from the first embodiment of the mobile terminal in that the first modem 11 is further configured to determine whether the compression identifier added by the second modem 21 can be extracted from the data packet obtaining request; and if the compression identification can be extracted, compressing the extracted data packet.
In this embodiment, before the second modem 21 sends a packet acquisition Request (Request) to the first modem 11, in order to prevent the transmitted packet from being too large, when the second modem 21 sends the Request, it is first determined whether a compression identifier needs to be added to the Request, and if so, a compression identifier, such as field 01, is added to the Request to inform the first modem 11 to compress the packet to be sent.
It should be noted that, because the data to be transmitted is determined according to the communication protocol standard, the second modem 21 may know the data type and the data size of the data packet to be acquired, then, before the second modem 21 sends a Request, the size of the data packet to be acquired at present is determined, if the size of the data packet to be acquired exceeds the capacity value of the buffer, the second modem 21 adds a compression identifier to the Request to inform the first modem 11 of compressing the data packet to be transmitted, and if the second modem 21 determines that the size of the data packet to be acquired does not exceed the capacity value of the buffer, the Request may be directly sent without adding a compression capacity identifier.
In this embodiment, before the second modem 21 sends the Request, the size of the data packet to be acquired is identified, and only when the data packet to be acquired exceeds the capacity value of the buffer, the compression identifier is added to the Request, so that it is avoided that all data packet acquisition requests are added with the compression identifier, the time for transmitting the data packet is shortened, and the efficiency for transmitting the data packet is improved.
When the first modem 11 receives a data packet acquisition request sent by the second modem 21 through a preset interface (UART), the data packet acquisition request is analyzed first to determine whether a compression identifier added by the second modem 21 can be extracted from the data packet acquisition request, if the compression identifier is extracted from the data packet acquisition request, the first modem 11 may compress the extracted data packet, and then buffer the compressed data packet into a buffer1 of the preset interface, and transmit the compressed data packet to a buffer2 through the UART, so that the second modem 21 extracts the compressed data packet from the buffer2 to complete transmission of the data packet.
In this embodiment, in the data packet transmission process, after the first modem 11 and the second modem 21 are woken up, when the first modem 11 and the second modem 21 are woken up, if the second modem 21 receives a data packet acquisition request sent by the base station through the second rf module 22, the following operations are performed:
and (3) judging: determining the size of a data packet to be acquired to judge whether a compression identifier needs to be added or not;
and (3) decision making: if the data packet to be acquired exceeds the buffer capacity of the UART, adding a compression identifier to the data packet acquisition request before sending the data packet acquisition request;
and (3) sending: and after the data packet acquisition request adds the compression identifier, sending the data packet acquisition request.
When the first modem 11 receives the packet acquisition request through the UART, the following operations are performed:
extraction: determining whether a compression identifier can be extracted from the data packet acquisition request, and if so, extracting the compression identifier;
compression: compressing the data packet extracted from the first subscriber identification card 13 or the second subscriber identification card 14 based on the extracted compression identification;
and (3) feedback: feeding back the compressed data packet.
Finally, the second modem 21 receives the data packet fed back by the first modem 11 through the UART to complete the data packet transmission process. The above operation process can be referred to fig. 3.
It should be noted that the second modem 21 sends the packet obtaining request, and the packet obtaining request is generally smaller than the buffer capacity, so the packet obtaining request may not be compressed.
In this embodiment, before compressing the data packet, the first modem 11 first determines whether the compression identifier added by the second modem can be extracted from the data packet obtaining request, and if the compression identifier can be extracted, the data packet is compressed, so as to prevent the data packet from being compressed when the capacity of the data packet is smaller than the buffer, thereby preventing the waste of system resources, saving the time for transmitting the data packet, and improving the efficiency of transmitting the data packet.
Further, a third embodiment of the mobile terminal of the present invention is proposed based on the first embodiment.
The third embodiment of the mobile terminal is different from the first embodiment of the mobile terminal in that the first modem 11 is further configured to parse the extracted data packet to obtain a header of the data packet; determining a length of the data packet based on a header of the data packet; and when the length of the data packet is greater than a preset threshold value, compressing the extracted data packet.
In this embodiment, before the first modem 11 compresses the data packet, the data packet extracted from the first subscriber identity card 13 or the second subscriber identity card 14 is parsed to obtain a header of the data packet, and then the length of the data packet is obtained from the header to determine the size of the data packet. The data packet is in a TLV format, the TLV format is one of BER (Basic Encoding Rules) codes, and is fully called as Type, Length, and Value, the T field indicates the Type of the data packet, the L field indicates the Length of the data packet, and the V field is used for storing the content of the data packet.
In this embodiment, the generation process of the data packet is as follows: the transmission layer obtains original data corresponding to the data packet, adds a data packet header of the transmission layer to the original data, wherein the data packet header comprises a data type and a data length of the transmission layer, obtains an initial data packet, and transmits the initial data packet to the transmission multiplexing layer. And after receiving the initial data packet, the transmission multiplexing layer adds a data packet header of the transmission multiplexing layer to the initial data packet, wherein the data packet header comprises the data type and the data length of the multiplexing layer to obtain a data packet, and calls a sending interface of the physical driving layer to send the data packet to the physical layer. Subsequently, the first modem 11 parses the extracted data packet, that is, detects the header of the data packet from a physical driving layer above a physical layer (physical transmission medium) to parse the data packet to obtain the size (length) of the data packet.
When the first modem 11 determines the length of the data packet, it determines whether the length of the data packet is greater than a preset threshold (i.e., the capacity value of the buffer). In this embodiment, the preset threshold may be 512 bytes, and in other embodiments, the preset threshold may also be set to other lengths, which is not limited herein. When the length of the data packet is greater than the preset threshold, the first modem 11 compresses the extracted data packet in order to prevent the terminal from crashing due to the transmission of the data packet. It is understood that if the length of the extracted data packet is smaller than the predetermined threshold, the first modem 11 can directly send the data packet to the second modem 21 through the UART interface.
In this embodiment, before compressing the data packet, the first modem parses the extracted data packet to obtain a packet header of the data packet, determines the length of the data packet, and compresses the extracted data packet only when the length of the data packet is greater than a preset threshold, thereby improving the accuracy of data packet compression.
Further, a fourth embodiment of the mobile terminal of the present invention is proposed based on the first to third embodiments.
The fourth embodiment of the mobile terminal differs from the first to third embodiments of the mobile terminal in that the compressing the extracted data packet by the first modem 11 specifically includes:
acquiring a source text corresponding to the data packet;
determining character segments with the occurrence frequency greater than a preset frequency in a source text;
searching codes corresponding to the character segments in a preset dictionary list, wherein the length of the codes is smaller than that of the corresponding character segments;
and replacing the corresponding character segment by the searched code to realize the compression of the data packet.
In this embodiment, the first modem 11 compresses the data packet, specifically, first obtains a source text corresponding to the data packet, then determines a character segment whose frequency of occurrence is greater than a preset frequency in the source text, and then searches for a code corresponding to the character segment from a preset dictionary list, where the length of the code is smaller than the length of the corresponding character segment, and finally replaces the corresponding character segment with the searched code, so as to implement compression of the data packet.
The algorithm involved in the process is a dictionary algorithm, which is one of the simplest compression algorithms. The dictionary algorithm makes words or words with frequency higher than a preset value in the text into a corresponding dictionary list, and represents the words or words by using a special code, for example, in the current dictionary list:
00=Chinese
01=People
02=China
if the source text in the current data packet is: i am a Chinese scope, I am from China. Then, with the dictionary algorithm, the compressed code is: i am a 0001, I am from 02.
It can be understood that the length after compression encoding is significantly reduced, and the compression efficiency is significantly high in such contents with more encoding proper nouns or fixed combinations, and the predetermined text contents are replaced by the predetermined encoding mapping in the dictionary, and the reverse recovery is performed during decompression.
Further, the first modem 11 is further configured to sequentially determine any two adjacent character segments in which the high four bits in the source text are zero;
deleting the high four bits of any two character segments, and combining the low four bits of any two character segments to realize the compression of the data packet.
That is, after the first modem 11 obtains the source text corresponding to the data packet, it may further sequentially determine any two adjacent character segments in which the high four bits in the source text are zero, delete the high four bits in any two adjacent character segments, and combine the low four bits in any two adjacent character segments, so as to implement compression of the data packet.
The algorithm involved in this process is a Fixed Bit Length algorithm (Fixed Bit Length Packing), which is an algorithm that compression encodes text with the minimum number of bits required. Such as: eight hexadecimal numbers: 1,2,3,4,5,6,7,8. The conversion to binary is: 00000001, 00000010, 00000011, 00000100, 00000101, 00000110, 00000111, 00001000. Each number only uses the lower 4 bits, and the upper 4 bits are not used (all 0), so the compression coding of the lower 4 bits results in: 0001, 0010, 0011, 0100, 0101, 0110, 0111, 1000. Then, every two of the supplementary 8-bit bytes are obtained: 00010010, 00110100, 01010110, 01111000. Therefore, the original eight hexadecimal numbers are shortened by half, and 4 hexadecimal numbers are obtained: 12, 34, 56, 78.
It can be understood that, by such a combination mode, the number of bits needed is reduced, so that the capacity of the data packet is reduced, and similarly, the reverberation splitting and adding combination can be performed during decompression.
Further, the first modem 11 is further configured to replace the characters appearing in the source text with the repetition times plus the characters, so as to implement compression of the data packet.
That is, after the first modem 11 acquires the source text corresponding to the data packet, the characters that continuously appear in the source text may be replaced by repeating times and adding characters, so as to implement compression of the data packet.
The algorithm involved in the process is an RLE (Run Length Encoding) algorithm, the compression Encoding is a variable Length Encoding, and different compression Encoding variants are adapted to the RLE according to different specific situations of texts so as to generate a larger compression ratio. Specifically, the method comprises the following steps:
variant 1: number of repetitions + characters
Text string: a A A B B B C C C C D D D, obtaining after coding: 3 A3B 4C 4D; through the variant algorithm, the text character string of the data packet terminal can be compressed.
Variant 2: special character + repetition number + character
Text string: a A A A A B C C C C, obtaining after coding: b B5A B B4C B3C; the special character is B in the initial description of the code string, then B is added, and the number following B indicates the number of repetition. That is to say, when the text string characters are encoded and compressed by the variant 2 algorithm, the special character B is first described in the initial letter of the encoded string, then since 5 characters a appear next to the following character a, a special character, namely the character B, needs to be added before the 5 characters a, so that the character B is B B5A, B appears after 5A, and 3C appear after B, so that a special character B needs to be added before 3C, which is B B5A B4C connected with the preceding character, and the following character can be obtained in the same way, so that the final encoded string B B5A B4C B3C is obtained.
To more clearly understand this scenario, as another example: the text string is still: if the special character is D in the beginning of the current coding string, then obtaining after coding: d D5A B D4C B D3C.
Variant 3:
the text is divided into blocks per byte, with a maximum of 127 repetitions per character. Each block starts with a special byte. If the 7 th bit of that particular byte is set, then the remaining 7-bit value is the number of repetitions of the following character. If bit 7 is not set, then the remaining 7 bits are the number of characters that are not compressed later.
For example: text string: a A A A A B C D E F F F, obtaining after coding: 85 A4B C D E83F (85H 10000101B, 4H 00000100B, 83H 10000011B). Firstly, grouping a text character string into three blocks, namely A A A A A, B C D E and F F F, wherein three fast corresponding special characters are 10000101, 00000100 and 10000011 respectively, and because the 7 th bit in the 10000101 is set to be 1, the remaining 7-bit numerical value is the repetition frequency of the following character, and at the moment, the value corresponding to the remaining 7-bit numerical value is known to be 5, so that 85A can be obtained; similarly, since the 7 th bit in 00000100 is not set to 1, the remaining 7 bits are the number of characters that are not compressed later, and it can be known that the value corresponding to the remaining 7 bits is 4, and 4 bc D E can be obtained; the same process may determine 83F, which is not described herein.
It should be noted that the three 3 RLE variant algorithms listed above are only preferred variant algorithms, and those skilled in the art can utilize the technical idea of the present invention, and other RLE variant algorithms proposed according to their specific requirements are within the protection scope of the present invention, and are not exhaustive here.
Further, the first modem 11 is further configured to determine whether there are character segments with the same content and a length greater than a preset value in the source text;
if yes, determining the distance between the next character segment and the previous character end and the length of the character segment;
and the identifier of the distance and the length is adopted to replace the next character segment so as to realize the compression of the data packet.
That is, after the first modem 11 acquires the source text corresponding to the data packet, it may further determine whether a character segment with the same content and a length greater than a preset value exists in the source text, and if so, determine a distance between a next character segment and a previous character end and a length of the character segment, and replace the next character segment with an identifier of the distance and the length to implement compression of the data packet.
The algorithm involved in this process is the LZ77 (proposed by Jacob Ziv and Abraham Lempel in 1977, so named LZ77) algorithm.
Compression principle of LZ77 algorithm: if the contents of two character strings in the file are the same, the contents of the next character string can be determined by knowing the position and the size of the contents of the previous character string. So we can replace the latter piece of string content with such a pair of information (distance between two pieces of string, length of the same content). Since the size of the pair of information (the distance between two character strings, the length of the same content) is smaller than the size of the replaced content, the file is compressed.
For better understanding, we take the following example:
the content of one file is as follows: http:// jiurl. yeah. net http:// jiurl. nase. net, some parts of the content, which have been presented previously, are the same parts, which are later enclosed with (): http:// jiurl. yeah. net (http:// jiurl.) nase (. net).
We use such a pair of information (distance between two strings, length of the same content) to replace the content of the latter string, yielding http:// jiurl.yeah.net (22,13) nase (23, 4).
In (22,13), 22 represents the distance between any two same characters in the next block of http:// jiurl. and the previous block of http:// jiurl. such as the distance between the next h and the previous h; 13 is the length of the same content; (23,4) the same process, which will not be described herein.
As can be seen from the above example, since the size of the pair of information (the distance between two character strings, the length of the same content) is smaller than the size of the replaced content, the file is compressed.
Specifically, the LZ77 algorithm uses a sliding window to find the matching string:
namely, the LZ77 algorithm uses a "sliding window" method to find the same part in the file, i.e., the matching string. First, a description is made of a matching string, which refers to a sequence of arbitrary bytes, not only those bytes that can be displayed in a text file, but also a sequence including punctuation marks. The string here emphasizes its position in the file, its length varying with the matching case. Specifically, the method comprises the following steps:
LZ77 starts at the beginning of the file and processes backward one byte by one byte. In the embodiment of the invention, the length of the sliding window is fixed, the end position of the sliding window is before the current byte to be processed and is next to the current byte to be processed, and the sliding window continuously slides backwards along with the processed byte, like the shadow of an airplane slides too much in the sun. For each byte in the file, a match is made with each string in the window, starting with the currently processed byte, to find the longest matching string.
Each string in the window refers to the string in the window that begins with each byte. If the string starting at the currently processed byte has a matching string in the window, the current string is replaced with such a pair of information (distance between, matching length), and then processing continues from the next byte after the just processed string. If the string starting with the currently processed byte does not match the string in the window, the currently processed byte is output without modification.
When the first byte in the file is processed, the window is before the currently processed byte, that is, the window is not slid onto the file, and there is no content in the window, and the processed byte is output without change. With the continuous backward processing, more and more windows slide into the file, and finally the whole window slides into the file, and then the whole window slides backward on the file until the whole file is finished.
It should be noted that the length of the matching string is limited, that is, in this embodiment, the minimum matching string and the maximum matching string are set, and it is necessary to limit that the character string matched through the sliding window is larger than the minimum matching string and smaller than the maximum matching string, and if the matched character string is smaller than the minimum matching string or larger than the maximum matching string, the subsequent compression operation is not performed.
For a better understanding of the present embodiment, the following are exemplified:
assume that the text string is: a A A B A B A A C, there is a sliding window of 6 characters at present, which means that the sliding window contains 6 characters at most at one time.
The first step of encoding: the sliding window is an empty window, the sliding window does not need to slide at the moment, the sliding window is compared with the first character of the text character string outside the sliding window, no matched character exists, the sliding window is moved to the right by one bit at the moment, namely, the sliding window is slid into the text character string from the right, the first letter of the character string enters the sliding window, and the sliding window displays the character A at the moment;
and a second step of encoding: because only the character A is arranged inside the sliding window, the character A appears outside the sliding window, although the matched character A exists inside and outside the sliding window, in order to ensure the efficiency of character coding, the minimum matching string is preset, if the minimum matching string is set to be 2 characters, because only one character A is matched at the moment and is not in accordance with the requirement, the sliding window is kept still, the processed character is moved to the right by one bit, namely the character compared with the sliding window is AA, only one character A exists in the sliding window at the moment, therefore, no matched character exists, the sliding window is continuously slid to the right, the second character of the text character string also enters the sliding window, and two identical characters A appear in the sliding window at the moment.
And a third step of encoding: when two identical characters A exist inside the sliding window, the two characters A inside the sliding window are compared with the characters outside the window, the sliding window continues to slide to the right because the two characters immediately outside the sliding window are A B which are not matched, when the sliding window slides and the A A A A appears, the characters immediately outside the sliding window are B A B which are not matched with the characters inside the sliding window, then the sliding window continues to slide to the right, so that the A A A A B appears inside the sliding window, at this time, since the characters A B inside the sliding window are matched with the characters immediately outside the sliding window A B, A B with the similar length of 2 is considered to be found, and therefore the AB outside the sliding window meets the requirement of the minimum matching string, a pair of < length, distance > is output, the length (length) is 2 and the backward distance is also 2, the output is <2,2 >.
The fourth step of encoding: when the next character string AB is output with <2,2>, the character string is deleted, the sliding window is compared with the rest of the text character strings, the rest of the text character strings are a C, when the first two A A in a C are compared with the sliding window, although A A and the sliding window have characters with the same content and length and accord with the minimum character string, in order to improve the compression efficiency, whether there is a matching character string behind the text character string is continuously judged, if there is detected a character a, namely the text character string a is exactly the same as the three character a in the sliding window, the distance between the rest of the text character string a and a in the sliding window and the length of the same character string are determined, at this time, since the next AB in the original character string is deleted, the distance between aa and aa in the sliding window is 4, the same content length is 3, and <4,3> can be output.
The fifth step of encoding: after outputting <4,3>, the character to be processed in the text character string is only C, since the character in the sliding window is a B, and there is no match, the sliding window slides one bit to the right, and the character C is also slid into the sliding window, so the character in the sliding window is a B C. Since no content needs to be processed subsequently, all characters in the sliding window are output, and the resulting encoded string is aa a B <2,2> <4,3> C.
Compression and decompression using LZ77 algorithm
In order to distinguish between "bytes without match" and "(distance between, matching length) pairs" at decompression, it is also necessary to put a bit before each "byte without match" or "(distance between, matching length) pair" to indicate whether "byte without match" or "(distance between, matching length) pair". In the embodiment of the present invention, 0 may be used to indicate "no matching byte", and 1 may be used to indicate "(distance between, matching length) pair".
In practical applications, the number of bits used for the "distance between" and "matching length" in the pair is fixed. Since the number of bits used for "distance between" is fixed, a window of fixed size is used, for example, the window size is 32KB, and any value in the range of 0-32K can be stored with 15 bits (2^15 ^ 32K). In addition, the maximum matching length is defined, and thus the number of bits used for the "matching length" is fixed.
In practical application, a minimum matching length is set, and only when the matching length of the two strings is larger than the minimum matching length, the two strings are regarded as a match. For better understanding, the reason for this is illustrated as an example: for example, "distance" uses 15 bits and "length" 8 bits, then the pair "(distance between, match length) will use 23 bits, i.e., 3 bytes by 1 bit. If the match length is less than 3 bytes, then replacing "with" (distance between, match length) will not compress, but will increase, so a minimum match length is required.
Compression:
from the beginning of the file to the end of the file, one byte is processed backwards one byte. The string starting with the currently processed byte is matched against each string in the sliding window, finding the longest matching string. If the string starting with the currently processed byte has a matching string in the window, a flag bit is output first indicating that a (distance between, match length) pair is below, then the (distance between, match length) pair is output, and then processing continues from the next byte after the just processed string. If the string from the beginning of the currently processed byte does not match the string in the window, a flag bit is output first indicating that an unmodified byte is below, then the currently processed byte is output without modification, and then the next byte of the currently processed byte is processed.
Decompression:
from the beginning of the file to the end of the file, a flag bit is read first, and whether a (distance between, matching length) pair or an unchanged byte is below is judged through the flag bit. If the current position is a pair (distance between the two pairs, matching length), the pair (distance between the two pairs, matching length) with a fixed number of positions is read, and then the matching string is output to the current position according to the information in the pair. If it is a byte that has not been changed, a byte is read out and then output.
In summary, it can be seen that a great deal of matching work needs to be done during LZ77 compression, and little work needs to be done during decompression, that is, decompression is much faster than compression, which is an advantage of significant effect in the case of requiring one compression and multiple decompressions.
After the first modem 11 compresses the data packet by any one of the compression algorithms, the compressed data packet is stored in the buffer for forwarding. Subsequently, the second modem 21 may extract the compressed data packet from the buffer and decompress the extracted compressed data packet, where the decompression method includes two methods: when the first modem 11 is encrypted and compressed, the second modem 21 decompresses by using the corresponding ciphertext, and when the first modem 11 is plaintext and compressed, the second modem 21 can directly decompress to obtain the decompressed data packet. Since each compression algorithm in the present embodiment is mainly a plaintext algorithm, the decompression mode is also plaintext decompression.
It can be understood that, in the present solution, when a data packet transmitted by a telecommunication card in the mobile terminal 100 is large, the second modem 21 adds an identifier in the Request, so that the first modem 11 compresses the data packet to change an expected value of the data packet, and a subsequent data packet buffered to the buffer does not exceed a capacity value of the buffer, thereby avoiding a problem of crash caused by transmission of a large data packet, and meanwhile, the data packet is not split into a plurality of data packets, thereby avoiding a situation of incomplete forwarding of the data packet.
The invention further provides a data packet transmission method.
Referring to fig. 4, fig. 4 is a flowchart illustrating a data packet transmission method according to a first embodiment of the present invention.
While the present embodiment provides an embodiment of a packet transmission method, it should be noted that although a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in an order different from that shown.
In the present invention, a data packet transmission method is applied to a mobile terminal, the mobile terminal includes a first processing chip 001 and a second processing chip 002 connected based on a preset interface, a first radio frequency module 12 connected to the first processing chip 001, and a second radio frequency module 22 connected to the second processing chip 002, the first processing chip 001 includes a first application processor 10 and a first modem 11 connected to a first subscriber identity card 13 and a second subscriber identity card 14, the second processing chip 002 includes a second application processor 20 and a second modem 21, the method includes:
step S10, when the first modem receives a data packet acquisition request sent by the second modem through a preset interface, extracting a data packet corresponding to the data packet acquisition request from the first subscriber identity module card or the second subscriber identity module card;
step S20, compressing the extracted data packet;
step S30, the compressed data packet is buffered in the buffer of the preset interface, so that the second modem can extract the compressed data packet from the buffer, thereby completing the transmission of the data packet.
In this embodiment, the first modem 11 receives a data packet obtaining request sent by the second modem 21 through a preset interface, and then feeds back a data packet to the second modem 21 through the preset interface. The preset interface is a UART interface.
When the second modem 21 of the second processing chip 002 receives a data packet acquisition request sent by the base station through the second rf module 22, the data packet acquisition request is first transmitted to the first modem 11 of the first processing chip 001 through the UART; after receiving the data packet acquisition request, the first modem 11 acquires a data packet from the first subscriber identity card 13 or the second subscriber identity card 14 according to the data packet acquisition request; after acquiring the data packet, the first modem 11 first compresses the acquired data packet to obtain a compressed data packet in order to ensure that the transmitted data is not greater than the buffer of the UART; transmitting the compressed data packet to the second modem 21 through the UART; after receiving the data packet, the second modem 21 uploads the data packet to the base station through the second rf module 22, so as to complete transmission of the data packet.
Specifically, the step S10 includes:
step A, the first modem sends a data packet acquisition request to an on-chip operating system in a first user identification card or a second user identification card, and the on-chip operating system extracts a data packet corresponding to the data packet acquisition request from a file storage module in the first user identification card or the second user identification card and feeds the data packet back to the first modem;
and step B, the first modem receives a data packet fed back by the on-chip operating system.
In this embodiment, it should be noted that the data packets in the first subscriber identity card 13 or the second subscriber identity card 14 are stored in the file storage module, when the first modem 11 is to acquire a data packet in the first subscriber identification card 13 or the second subscriber identification card 14, the first modem 11 does not directly interact with the file storage module in the first subscriber identification card 13 or the second subscriber identification card 14, but first sends a Request for acquiring data packets to a COS (Chip Operating System) Operating System in the first subscriber identity card 13 or the second subscriber identity card 14, the COS operating system of the first subscriber identification card 13 or the second subscriber identification card 14 then retrieves the data packet in the file storage module based on the Request, and then, the acquired data packet is transmitted to the first modem 11, and the first modem 11 can realize the acquisition process of the data packet as long as receiving the data packet fed back by the COS operating system.
It can be understood that, since the first modem 11 cannot directly extract the data packet from the file storage module in the first subscriber identity card 13 or the second subscriber identity card 14, the data packet is extracted by interacting with the COS operating system of the first subscriber identity card 13 or the second subscriber identity card 14, so as to ensure the normal operation of the subsequent data transmission process.
In this embodiment, when the first modem 11 compresses the data packet, the data packet may be compressed in an encryption compression manner or directly in a plaintext compression manner. Because the amount of transmitted network authentication data of the SIM card is relatively small, in order to reduce operations such as encryption and decryption and the like, which result in low data transmission efficiency, the embodiment of the present invention preferably compresses the data packet by using a plaintext compression method, that is, the compression algorithm used in the present solution is mainly simple and efficient, and the compression algorithm and the compression process specifically used are described in detail in the following embodiments.
After the first modem 11 compresses the data packet, the compressed data packet may be buffered in the buffer of the preset interface UART, so that the second modem 21 may extract the compressed data packet from the buffer to complete the transmission of the data packet.
In this embodiment, it should be noted that the buffers exist at two ends of the UART interface, that is, the buffers 1 and 2 are respectively disposed at two ends of the UART interface. When the second modem 21 receives a data acquisition request sent by the base station through the second radio frequency module 22, the data packet acquisition request is sent to the first modem 11 through the UART interface, after the first modem 11 extracts a data packet from the first subscriber identity card 13 or the second subscriber identity card 14, the extracted data packet is stored in the buffer1 to be transmitted to the buffer2 of the second modem 21 through the UART, and the second modem 21 acquires the data packet from the buffer 2.
In the data packet transmission method provided in this embodiment, when the first modem receives a data packet acquisition request sent by the second modem through the preset interface, the first modem first extracts a data packet corresponding to the data packet acquisition request from the first subscriber identification card or the second subscriber identification card, then compresses the extracted data packet, and then caches the compressed data packet in a buffer of the preset interface, so that the second modem extracts the compressed data packet from the buffer to complete transmission of the data packet. According to the scheme, when the data packet is transmitted, the data packet to be transmitted is compressed firstly, and then the compressed data packet is transmitted, so that the capacity value of the transmitted data packet is reduced to some extent, and the condition that the mobile terminal crashes in the data transmission process is avoided.
Further, a second embodiment of the data packet transmission method according to the present invention is proposed based on the first embodiment.
The second embodiment of the packet transmission method differs from the first embodiment of the packet transmission method in that, before the step S20, the method further includes:
the first modem judges whether the compression identification added by the second modem can be extracted from the data packet acquisition request or not;
if the compression flag can be extracted, the step S20 is executed.
In this embodiment, before the second modem 21 sends a packet acquisition Request (Request) to the first modem 11, in order to prevent the transmitted packet from being too large, when the second modem 21 sends the Request, it is first determined whether a compression identifier needs to be added to the Request, and if so, a compression identifier, such as field 01, is added to the Request to inform the first modem 11 to compress the packet to be sent.
It should be noted that, because the data to be transmitted is determined according to the communication protocol standard, the second modem 21 may know the data type and the data size of the data packet to be acquired, then, before the second modem 21 sends a Request, the size of the data packet to be acquired at present is determined, if the size of the data packet to be acquired exceeds the capacity value of the buffer, the second modem 21 adds a compression identifier to the Request to inform the first modem 11 of compressing the data packet to be transmitted, and if the second modem 21 determines that the size of the data packet to be acquired does not exceed the capacity value of the buffer, the Request may be directly sent without adding a compression capacity identifier.
In this embodiment, before the second modem 21 sends the Request, the size of the data packet to be acquired is identified, and only when the data packet to be acquired exceeds the capacity value of the buffer, the compression identifier is added to the Request, so that it is avoided that all data packet acquisition requests are added with the compression identifier, the time for transmitting the data packet is shortened, and the efficiency for transmitting the data packet is improved.
When the first modem 11 receives a data packet acquisition request sent by the second modem 21 through a preset interface (UART), the data packet acquisition request is analyzed first to determine whether a compression identifier added by the second modem 21 can be extracted from the data packet acquisition request, if the compression identifier is extracted from the data packet acquisition request, the first modem 11 may compress the extracted data packet, and then buffer the compressed data packet into a buffer1 of the preset interface, and transmit the compressed data packet to a buffer2 through the UART, so that the second modem 21 extracts the compressed data packet from the buffer2 to complete transmission of the data packet.
In this embodiment, in the data packet transmission process, after the first modem 11 and the second modem 21 are woken up, when the first modem 11 and the second modem 21 are woken up, if the second modem 21 receives a data packet acquisition request generated by the base station through the second rf module 22, the following operations are performed:
and (3) judging: determining the size of a data packet to be acquired to judge whether a compression identifier needs to be added or not;
and (3) decision making: if the data packet to be acquired exceeds the buffer capacity of the UART, adding a compression identifier to the data packet acquisition request before sending the data packet acquisition request;
and (3) sending: and after the data packet acquisition request adds the compression identifier, sending the data packet acquisition request.
When the first modem 11 receives the packet acquisition request through the UART, the following operations are performed:
extraction: determining whether a compression identifier can be extracted from the data packet acquisition request, and if so, extracting the compression identifier;
compression: compressing the data packet extracted from the first subscriber identification card 13 or the second subscriber identification card 14 based on the extracted compression identification;
and (3) feedback: feeding back the compressed data packet.
Finally, the second modem 21 receives the data packet fed back by the first modem 11 through the UART to complete the data packet transmission process. The above operation process can be referred to fig. 3.
It should be noted that the second modem 21 sends the packet obtaining request, and the packet obtaining request is generally smaller than the buffer capacity, so the packet obtaining request may not be compressed.
In this embodiment, before compressing the data packet, the first modem 11 first determines whether the compression identifier added by the second modem can be extracted from the data packet obtaining request, and if the compression identifier can be extracted, the data packet is compressed, so as to prevent the data packet from being compressed when the capacity of the data packet is smaller than the buffer, thereby preventing the waste of system resources, saving the time for transmitting the data packet, and improving the efficiency of transmitting the data packet.
Further, a third embodiment of the data packet transmission method according to the present invention is provided based on the first embodiment.
The third embodiment of the packet transmission method differs from the first embodiment of the packet transmission method in that, before the step S20, the method further includes:
the first modem analyzes the extracted data packet to obtain a packet header of the data packet;
determining a length of the data packet based on a header of the data packet;
and executing the step S20 when the length of the data packet is greater than a preset threshold.
In this embodiment, before the first modem 11 compresses the data packet, the data packet extracted from the first subscriber identity card 13 or the second subscriber identity card 14 is parsed to obtain a header of the data packet, and then the length of the data packet is obtained from the header to determine the size of the data packet. The data packet is in a TLV format, the TLV format is one of BER (Basic Encoding Rules) codes, and is fully called as Type, Length, and Value, the T field indicates the Type of the data packet, the L field indicates the Length of the data packet, and the V field is used for storing the content of the data packet.
In this embodiment, the generation process of the data packet is as follows: the transmission layer obtains original data corresponding to the data packet, adds a data packet header of the transmission layer to the original data, wherein the data packet header comprises a data type and a data length of the transmission layer, obtains an initial data packet, and transmits the initial data packet to the transmission multiplexing layer. And after receiving the initial data packet, the transmission multiplexing layer adds a data packet header of the transmission multiplexing layer to the initial data packet, wherein the data packet header comprises the data type and the data length of the multiplexing layer to obtain a data packet, and calls a sending interface of the physical driving layer to send the data packet to the physical layer. Subsequently, the first modem 11 parses the extracted data packet, that is, detects the header of the data packet from a physical driving layer above a physical layer (physical transmission medium) to parse the data packet to obtain the size (length) of the data packet.
When the first modem 11 determines the length of the data packet, it determines whether the length of the data packet is greater than a preset threshold (i.e., the capacity value of the buffer). In this embodiment, the preset threshold may be 512 bytes, and in other embodiments, the preset threshold may also be set to other lengths, which is not limited herein. When the length of the data packet is greater than the preset threshold, the first modem 11 compresses the extracted data packet in order to prevent the terminal from crashing due to the transmission of the data packet. It is understood that if the length of the extracted data packet is smaller than the predetermined threshold, the first modem 11 can directly send the data packet to the second modem 21 through the UART interface.
In this embodiment, before compressing the data packet, the first modem parses the extracted data packet to obtain a packet header of the data packet, determines the length of the data packet, and compresses the extracted data packet only when the length of the data packet is greater than a preset threshold, thereby improving the accuracy of data packet compression.
Further, a fourth embodiment of the data packet transmission method of the present invention is proposed based on the first to third embodiments.
The fourth embodiment of the packet transmission method differs from the first to third embodiments of the packet transmission method in that the step S20 includes:
step a, the first modem acquires a source text corresponding to the data packet;
b, determining character segments with the occurrence frequency greater than the preset frequency in the source text;
step c, searching codes corresponding to the character segments in a preset dictionary list, wherein the length of the codes is smaller than that of the corresponding character segments;
and d, replacing the corresponding character segment by the searched code to realize the compression of the data packet.
In this embodiment, the first modem 11 compresses the data packet, specifically, first obtains a source text corresponding to the data packet, then determines a character segment whose frequency of occurrence is greater than a preset frequency in the source text, and then searches for a code corresponding to the character segment from a preset dictionary list, where the length of the code is smaller than the length of the corresponding character segment, and finally replaces the corresponding character segment with the searched code, so as to implement compression of the data packet.
The algorithm involved in the process is a dictionary algorithm, which is one of the simplest compression algorithms. The dictionary algorithm makes words or words with frequency higher than a preset value in the text into a corresponding dictionary list, and represents the words or words by using a special code, for example, in the current dictionary list:
00=Chinese
01=People
02=China
if the source text in the current data packet is: i am a Chinese scope, I am from China. Then, with the dictionary algorithm, the compressed code is: i am a 0001, I am from 02.
It can be understood that the length after compression encoding is significantly reduced, and the compression efficiency is significantly high in such contents with more encoding proper nouns or fixed combinations, and the predetermined text contents are replaced by the predetermined encoding mapping in the dictionary, and the reverse recovery is performed during decompression.
Further, after the step a, the step S20 further includes:
e, sequentially determining any two adjacent character segments with high four digits being zero in the source text;
and f, deleting the high four bits of any two character segments, and combining the low four bits of any two character segments to realize the compression of the data packet.
That is, after the first modem 11 obtains the source text corresponding to the data packet, it may further sequentially determine any two adjacent character segments in which the high four bits in the source text are zero, delete the high four bits in any two adjacent character segments, and combine the low four bits in any two adjacent character segments, so as to implement compression of the data packet.
The algorithm involved in this process is a Fixed Bit Length algorithm (Fixed Bit Length Packing), which is an algorithm that compression encodes text with the minimum number of bits required. Such as: eight hexadecimal numbers: 1,2,3,4,5,6,7,8. The conversion to binary is: 00000001, 00000010, 00000011, 00000100, 00000101, 00000110, 00000111, 00001000. Each number only uses the lower 4 bits, and the upper 4 bits are not used (all 0), so the compression coding of the lower 4 bits results in: 0001, 0010, 0011, 0100, 0101, 0110, 0111, 1000. Then, every two of the supplementary 8-bit bytes are obtained: 00010010, 00110100, 01010110, 01111000. Therefore, the original eight hexadecimal numbers are shortened by half, and 4 hexadecimal numbers are obtained: 12, 34, 56, 78.
It can be understood that, by such a combination mode, the number of bits needed is reduced, so that the capacity of the data packet is reduced, and similarly, the reverberation splitting and adding combination can be performed during decompression.
Further, after the step a, the step S20 further includes:
and g, replacing the characters which continuously appear in the source text by adopting the repeated times and the characters so as to realize the compression of the data packet.
That is, after the first modem 11 acquires the source text corresponding to the data packet, the characters that continuously appear in the source text may be replaced by repeating times and adding characters, so as to implement compression of the data packet.
The algorithm involved in the process is an RLE (Run Length Encoding) algorithm, the compression Encoding is a variable Length Encoding, and different compression Encoding variants are adapted to the RLE according to different specific situations of texts so as to generate a larger compression ratio. Specifically, the method comprises the following steps:
variant 1: number of repetitions + characters
Text string: a A A B B B C C C C D D D, obtaining after coding: 3 A3B 4C 4D; through the variant algorithm, the text character string of the data packet terminal can be compressed.
Variant 2: special character + repetition number + character
Text string: a A A A A B C C C C, obtaining after coding: b B5A B B4C B3C; the special character is B in the initial description of the code string, then B is added, and the number following B indicates the number of repetition. That is to say, when the text string characters are encoded and compressed by the variant 2 algorithm, the special character B is first described in the initial letter of the encoded string, then since 5 characters a appear next to the following character a, a special character, namely the character B, needs to be added before the 5 characters a, so that the character B is B B5A, B appears after 5A, and 3C appear after B, so that a special character B needs to be added before 3C, which is B B5A B4C connected with the preceding character, and the following character can be obtained in the same way, so that the final encoded string B B5A B4C B3C is obtained.
To more clearly understand this scenario, as another example: the text string is still: if the special character is D in the beginning of the current coding string, then obtaining after coding: d D5A B D4C B D3C.
Variant 3:
the text is divided into blocks per byte, with a maximum of 127 repetitions per character. Each block starts with a special byte. If the 7 th bit of that particular byte is set, then the remaining 7-bit value is the number of repetitions of the following character. If bit 7 is not set, then the remaining 7 bits are the number of characters that are not compressed later.
For example: text string: a A A A A B C D E F F F, obtaining after coding: 85 A4B C D E83F (85H 10000101B, 4H 00000100B, 83H 10000011B). Firstly, grouping a text character string into three blocks, namely A A A A A, B C D E and F F F, wherein three fast corresponding special characters are 10000101, 00000100 and 10000011 respectively, and because the 7 th bit in the 10000101 is set to be 1, the remaining 7-bit numerical value is the repetition frequency of the following character, and at the moment, the value corresponding to the remaining 7-bit numerical value is known to be 5, so that 85A can be obtained; similarly, since the 7 th bit in 00000100 is not set to 1, the remaining 7 bits are the number of characters that are not compressed later, and it can be known that the value corresponding to the remaining 7 bits is 4, and 4 bc D E can be obtained; the same process may determine 83F, which is not described herein.
It should be noted that the three 3 RLE variant algorithms listed above are only preferred variant algorithms, and those skilled in the art can utilize the technical idea of the present invention, and other RLE variant algorithms proposed according to their specific requirements are within the protection scope of the present invention, and are not exhaustive here.
Further, after the step a, the step S20 further includes:
h, determining whether character segments with the same content and the length larger than a preset value exist in the source text;
step i, if the character segment exists, determining the distance between the next character segment and the previous character end and the length of the character segment;
and j, replacing the next character segment with the identifier of the distance and the length to realize the compression of the data packet.
That is, after the first modem 11 acquires the source text corresponding to the data packet, it may further determine whether a character segment with the same content and a length greater than a preset value exists in the source text, and if so, determine a distance between a next character segment and a previous character end and a length of the character segment, and replace the next character segment with an identifier of the distance and the length to implement compression of the data packet.
The algorithm involved in this process is the LZ77 (proposed by Jacob Ziv and Abraham Lempel in 1977, so named LZ77) algorithm.
Compression principle of LZ77 algorithm: if the contents of two character strings in the file are the same, the contents of the next character string can be determined by knowing the position and the size of the contents of the previous character string. So we can replace the latter piece of string content with such a pair of information (distance between two pieces of string, length of the same content). Since the size of the pair of information (the distance between two character strings, the length of the same content) is smaller than the size of the replaced content, the file is compressed.
For better understanding, we take the following example:
the content of one file is as follows: http:// jiurl. yeah. net http:// jiurl. nase. net, some parts of the content, which have been presented previously, are the same parts, which are later enclosed with (): http:// jiurl. yeah. net (http:// jiurl.) nase (. net).
We use such a pair of information (distance between two strings, length of the same content) to replace the content of the latter string, yielding http:// jiurl.yeah.net (22,13) nase (23, 4).
In (22,13), 22 represents the distance between any two same characters in the next block of http:// jiurl. and the previous block of http:// jiurl. such as the distance between the next h and the previous h; 13 is the length of the same content; (23,4) the same process, which will not be described herein.
As can be seen from the above example, since the size of the pair of information (the distance between two character strings, the length of the same content) is smaller than the size of the replaced content, the file is compressed.
Specifically, the LZ77 algorithm uses a sliding window to find the matching string:
namely, the LZ77 algorithm uses a "sliding window" method to find the same part in the file, i.e., the matching string. First, a description is made of a matching string, which refers to a sequence of arbitrary bytes, not only those bytes that can be displayed in a text file, but also a sequence including punctuation marks. The string here emphasizes its position in the file, its length varying with the matching case. Specifically, the method comprises the following steps:
LZ77 starts at the beginning of the file and processes backward one byte by one byte. In the embodiment of the invention, the length of the sliding window is fixed, the end position of the sliding window is before the current byte to be processed and is next to the current byte to be processed, and the sliding window continuously slides backwards along with the processed byte, like the shadow of an airplane slides too much in the sun. For each byte in the file, a match is made with each string in the window, starting with the currently processed byte, to find the longest matching string.
Each string in the window refers to the string in the window that begins with each byte. If the string starting at the currently processed byte has a matching string in the window, the current string is replaced with such a pair of information (distance between, matching length), and then processing continues from the next byte after the just processed string. If the string starting with the currently processed byte does not match the string in the window, the currently processed byte is output without modification.
When the first byte in the file is processed, the window is before the currently processed byte, that is, the window is not slid onto the file, and there is no content in the window, and the processed byte is output without change. With the continuous backward processing, more and more windows slide into the file, and finally the whole window slides into the file, and then the whole window slides backward on the file until the whole file is finished.
It should be noted that the length of the matching string is limited, that is, in this embodiment, the minimum matching string and the maximum matching string are set, and it is necessary to limit that the character string matched through the sliding window is larger than the minimum matching string and smaller than the maximum matching string, and if the matched character string is smaller than the minimum matching string or larger than the maximum matching string, the subsequent compression operation is not performed.
For a better understanding of the present embodiment, the following are exemplified:
assume that the text string is: a A A B A B A A C, there is a sliding window of 6 characters at present, which means that the sliding window contains 6 characters at most at one time.
The first step of encoding: the sliding window is an empty window, the sliding window does not need to slide at the moment, the sliding window is compared with the first character of the text character string outside the sliding window, no matched character exists, the sliding window is moved to the right by one bit at the moment, namely, the sliding window is slid into the text character string from the right, the first letter of the character string enters the sliding window, and the sliding window displays the character A at the moment;
and a second step of encoding: because only the character A is arranged inside the sliding window, the character A appears outside the sliding window, although the matched character A exists inside and outside the sliding window, in order to ensure the efficiency of character coding, the minimum matching string is preset, if the minimum matching string is set to be 2 characters, because only one character A is matched at the moment and is not qualified, the sliding window is kept still, the processed character is moved to the right by one bit, namely the character compared with the sliding window is A A, only one character A exists in the sliding window at the moment, therefore, no matched character exists, the sliding window is continuously slid to the right, the second character of the text character string also enters the sliding window, and two identical characters A appear in the sliding window at the moment.
And a third step of encoding: when two identical characters A exist inside the sliding window, the two characters A inside the sliding window are compared with the characters outside the window, the sliding window continues to slide to the right because the two characters immediately outside the sliding window are A B which are not matched, when the sliding window slides and the A A A A appears, the characters immediately outside the sliding window are B A B which are not matched with the characters inside the sliding window, then the sliding window continues to slide to the right, so that the A A A A B appears inside the sliding window, at this time, since the characters A B inside the sliding window are matched with the characters immediately outside the sliding window A B, A B with the similar length of 2 is considered to be found, and therefore the AB outside the sliding window meets the requirement of the minimum matching string, a pair of < length, distance > is output, the length (length) is 2 and the backward distance is also 2, the output is <2,2 >.
The fourth step of encoding: when the next character string AB is output with <2,2>, the character string is deleted, the sliding window is compared with the rest of the text character strings, the rest of the text character strings are a C, when the first two A A in a C are compared with the sliding window, although A A and the sliding window have characters with the same content and length and accord with the minimum character string, in order to improve the compression efficiency, whether there is a matching character string behind the text character string is continuously judged, if there is detected a character a, namely the text character string a is exactly the same as the three character a in the sliding window, the distance between the rest of the text character string a and a in the sliding window and the length of the same character string are determined, at this time, since the next AB in the original character string is deleted, the distance between aa and aa in the sliding window is 4, the same content length is 3, and <4,3> can be output.
The fifth step of encoding: after outputting <4,3>, the character to be processed in the text character string is only C, since the character in the sliding window is a B, and there is no match, the sliding window slides one bit to the right, and the character C is also slid into the sliding window, so the character in the sliding window is a B C. Since no content needs to be processed subsequently, all characters in the sliding window are output, and the resulting encoded string is aa a B <2,2> <4,3> C.
Compression and decompression using LZ77 algorithm
In order to distinguish between "bytes without match" and "(distance between, matching length) pairs" at decompression, it is also necessary to put a bit before each "byte without match" or "(distance between, matching length) pair" to indicate whether "byte without match" or "(distance between, matching length) pair". In the embodiment of the present invention, 0 may be used to indicate "no matching byte", and 1 may be used to indicate "(distance between, matching length) pair".
In practical applications, the number of bits used for the "distance between" and "matching length" in the pair is fixed. Since the number of bits used for "distance between" is fixed, a window of fixed size is used, for example, the window size is 32KB, and any value in the range of 0-32K can be stored with 15 bits (2^15 ^ 32K). In addition, the maximum matching length is defined, and thus the number of bits used for the "matching length" is fixed.
In practical application, a minimum matching length is set, and only when the matching length of the two strings is larger than the minimum matching length, the two strings are regarded as a match. For better understanding, the reason for this is illustrated as an example: for example, "distance" uses 15 bits and "length" 8 bits, then the pair "(distance between, match length) will use 23 bits, i.e., 3 bytes by 1 bit. If the match length is less than 3 bytes, then replacing "with" (distance between, match length) will not compress, but will increase, so a minimum match length is required.
Compression:
from the beginning of the file to the end of the file, one byte is processed backwards one byte. The string starting with the currently processed byte is matched against each string in the sliding window, finding the longest matching string. If the string starting with the currently processed byte has a matching string in the window, a flag bit is output first indicating that a (distance between, match length) pair is below, then the (distance between, match length) pair is output, and then processing continues from the next byte after the just processed string. If the string from the beginning of the currently processed byte does not match the string in the window, a flag bit is output first indicating that an unmodified byte is below, then the currently processed byte is output without modification, and then the next byte of the currently processed byte is processed.
Decompression:
from the beginning of the file to the end of the file, a flag bit is read first, and whether a (distance between, matching length) pair or an unchanged byte is below is judged through the flag bit. If the current position is a pair (distance between the two pairs, matching length), the pair (distance between the two pairs, matching length) with a fixed number of positions is read, and then the matching string is output to the current position according to the information in the pair. If it is a byte that has not been changed, a byte is read out and then output.
In summary, it can be seen that a great deal of matching work needs to be done during LZ77 compression, and little work needs to be done during decompression, that is, decompression is much faster than compression, which is an advantage of significant effect in the case of requiring one compression and multiple decompressions.
After the first modem 11 compresses the data packet by any one of the compression algorithms, the compressed data packet is stored in the buffer for forwarding. Subsequently, the second modem 21 may extract the compressed data packet from the buffer and decompress the extracted compressed data packet, where the decompression method includes two methods: when the first modem 11 is encrypted and compressed, the second modem 21 decompresses by using the corresponding ciphertext, and when the first modem 11 is plaintext and compressed, the second modem 21 can directly decompress to obtain the decompressed data packet. Since each compression algorithm in the present embodiment is mainly a plaintext algorithm, the decompression mode is also plaintext decompression.
It can be understood that, in the present solution, when a data packet transmitted by a telecommunication card in the mobile terminal 100 is large, the second modem 21 adds an identifier in the Request, so that the first modem 11 compresses the data packet to change an expected value of the data packet, and a subsequent data packet buffered to the buffer does not exceed a capacity value of the buffer, thereby avoiding a problem of crash caused by transmission of a large data packet, and meanwhile, the data packet is not split into a plurality of data packets, thereby avoiding a situation of incomplete forwarding of the data packet.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. A mobile terminal is characterized by comprising a first processing chip and a second processing chip which are connected based on a preset interface, a first radio frequency module connected with the first processing chip, and a second radio frequency module connected with the second processing chip, wherein the first processing chip comprises a first application processor and a first modem connected with a first user identification card and a second user identification card, the second processing chip comprises a second application processor and a second modem, and the first application processor is connected with the second application processor through a USB interface;
the first modem is used for extracting a data packet corresponding to the data packet acquisition request from the first user identification card or the second user identification card when receiving the data packet acquisition request sent by the second modem through the UART interface; compressing the extracted data packet; and caching the compressed data packet into a temporary buffer area of the preset interface so that the second modem can extract the compressed data packet from the buffer to finish the transmission of the data packet.
2. The mobile terminal of claim 1, wherein the first modem is further configured to determine whether a compression flag added by the second modem can be extracted from the data packet acquisition request; and if the compression identification can be extracted, compressing the extracted data packet.
3. The mobile terminal of claim 1, wherein the first modem is further configured to parse the extracted data packet to obtain a header of the data packet; determining a length of the data packet based on a header of the data packet; and when the length of the data packet is greater than a preset threshold value, compressing the extracted data packet.
4. The mobile terminal of any of claims 1 to 3, wherein the first modem to compress the extracted data packet specifically comprises:
the first modem acquires a source text corresponding to the data packet;
determining character segments with the occurrence frequency greater than a preset frequency in a source text;
searching codes corresponding to the character segments in a preset dictionary list, wherein the length of the codes is smaller than that of the corresponding character segments;
and replacing the corresponding character segment by the searched code to realize the compression of the data packet.
5. The mobile terminal of claim 4, wherein the first modem is further configured to determine whether there are character segments having the same content and a length greater than a predetermined value in the source text;
if yes, determining the distance between the next character segment and the previous character end and the length of the character segment;
and the identifier of the distance and the length is adopted to replace the next character segment so as to realize the compression of the data packet.
6. A data packet transmission method is applied to a mobile terminal, the mobile terminal comprises a first processing chip and a second processing chip which are connected based on a preset interface, a first radio frequency module connected with the first processing chip, and a second radio frequency module connected with the second processing chip, the first processing chip comprises a first application processor and a first modem connected with a first subscriber identity card and a second subscriber identity card, the second processing chip comprises a second application processor and a second modem, the first application processor is connected with the second application processor through a USB interface, and the method comprises the following steps:
when a first modem receives a data packet acquisition request sent by a second modem through a UART interface, extracting a data packet corresponding to the data packet acquisition request from a first user identification card or a second user identification card;
compressing the extracted data packet;
and caching the compressed data packet into a temporary buffer area of the preset interface so that the second modem can extract the compressed data packet from the buffer to finish the transmission of the data packet.
7. The data packet transmission method according to claim 6, wherein the step of compressing the extracted data packet is preceded by the data packet transmission method further comprising:
the first modem judges whether the compression identification added by the second modem can be extracted from the data packet acquisition request or not;
and if the compression identification can be extracted, executing the step of compressing the extracted data packet.
8. The data packet transmission method according to claim 6, wherein the step of compressing the extracted data packet is preceded by the data packet transmission method further comprising:
the first modem analyzes the extracted data packet to obtain a packet header of the data packet;
determining a length of the data packet based on a header of the data packet;
and when the length of the data packet is greater than a preset threshold value, executing the step of compressing the extracted data packet.
9. The method for transmitting data packets according to any of claims 6 to 8, wherein the step of compressing the extracted data packets comprises:
the first modem acquires a source text corresponding to the data packet;
determining character segments with the occurrence frequency greater than a preset frequency in a source text;
searching codes corresponding to the character segments in a preset dictionary list, wherein the length of the codes is smaller than that of the corresponding character segments;
and replacing the corresponding character segment by the searched code to realize the compression of the data packet.
10. The method for transmitting data packets according to claim 9, wherein after the step of the first modem acquiring the source text corresponding to the data packet, the step of compressing the extracted data packet further comprises:
determining whether character segments with the same content and the length larger than a preset value exist in a source text;
if yes, determining the distance between the next character segment and the previous character end and the length of the character segment;
and the identifier of the distance and the length is adopted to replace the next character segment so as to realize the compression of the data packet.
CN201710395965.9A 2017-05-27 2017-05-27 Mobile terminal and data packet transmission method Active CN107182083B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710395965.9A CN107182083B (en) 2017-05-27 2017-05-27 Mobile terminal and data packet transmission method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710395965.9A CN107182083B (en) 2017-05-27 2017-05-27 Mobile terminal and data packet transmission method

Publications (2)

Publication Number Publication Date
CN107182083A CN107182083A (en) 2017-09-19
CN107182083B true CN107182083B (en) 2021-08-10

Family

ID=59836598

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710395965.9A Active CN107182083B (en) 2017-05-27 2017-05-27 Mobile terminal and data packet transmission method

Country Status (1)

Country Link
CN (1) CN107182083B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR102647646B1 (en) * 2019-05-15 2024-03-13 현대자동차주식회사 Method And Apparatus for operating a vehicle based on edge computing

Family Cites Families (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8416251B2 (en) * 2004-11-15 2013-04-09 Nvidia Corporation Stream processing in a video processor
WO2012112618A1 (en) * 2011-02-14 2012-08-23 The Regents Of The University Of California Multi-band interconnect for inter-chip and intra-chip communications
CN102905259B (en) * 2011-07-27 2015-08-19 中国移动通信有限公司 Realization Method of Communication, central processing unit and terminal
CN103067907B (en) * 2012-12-20 2018-05-18 中兴通讯股份有限公司 A kind of switching method of multimode terminal and multimode terminal
US9712224B2 (en) * 2013-08-30 2017-07-18 Qualcomm Incorporated Antenna switching for dual radio devices
US9244747B2 (en) * 2014-03-13 2016-01-26 Qualcomm Incorporated System and method for providing dynamic clock and voltage scaling (DCVS) aware interprocessor communication
US9892669B2 (en) * 2014-03-18 2018-02-13 Nvidia Corporation Superresolution display using cascaded panels
CN105657691B (en) * 2016-01-27 2020-02-07 努比亚技术有限公司 Mobile terminal and data sharing method of double-chip system thereof
CN105682083B (en) * 2016-01-28 2019-10-29 努比亚技术有限公司 A kind of communication means of mobile terminal and duplex MODEM system
CN106060787A (en) * 2016-05-16 2016-10-26 北京奇虎科技有限公司 Information transmitting method, apparatus and device

Also Published As

Publication number Publication date
CN107182083A (en) 2017-09-19

Similar Documents

Publication Publication Date Title
CN108667559B (en) Communication method and device
RU2767321C1 (en) Method and device for wireless communication
EP3537641A1 (en) Method and device for transmitting data packet
CN107182083B (en) Mobile terminal and data packet transmission method
CN107222581A (en) Data transmission system, method, external equipment and mobile terminal
CN107231660A (en) Data packet transmission system and method
CN107071831A (en) Mobile terminal and data pack transmission method
CN107231622A (en) Mobile terminal and data pack transmission method
CN107071833A (en) Data packet transmission system and method
CN107222429A (en) Data transmission system and method
CN107318108A (en) Data transmission system, method, external equipment and mobile terminal
CN107182086A (en) Data packet transmission system and method
CN107094151A (en) Mobile terminal and data pack transmission method
CN107257569A (en) Mobile terminal and data pack transmission method
CN106953984B (en) Data transmission system and method
CN107182082A (en) Data packet transmission system and method
CN107257568A (en) Data packet transmission system and method
CN107466029A (en) Data transmission system, method, external equipment and mobile terminal
CN107277859A (en) Data transmission system, method, external equipment and mobile terminal
CN107257567A (en) Data transmission system and method
CN107087064B (en) Mobile terminal and data transmission method thereof
CN107094316B (en) Mobile terminal and data transmission method thereof
WO2023098881A1 (en) Transmission method for location auxiliary data, and terminal, location server, and storage medium
CN107086992B (en) Mobile terminal and data packet identification method
CN107148052A (en) Mobile terminal and its data transmission method

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
GR01 Patent grant
GR01 Patent grant