CN112888024A - Data processing method, data processing device, storage medium and electronic equipment - Google Patents

Data processing method, data processing device, storage medium and electronic equipment Download PDF

Info

Publication number
CN112888024A
CN112888024A CN201911205073.3A CN201911205073A CN112888024A CN 112888024 A CN112888024 A CN 112888024A CN 201911205073 A CN201911205073 A CN 201911205073A CN 112888024 A CN112888024 A CN 112888024A
Authority
CN
China
Prior art keywords
data
sent
strategy
character
encoding
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.)
Granted
Application number
CN201911205073.3A
Other languages
Chinese (zh)
Other versions
CN112888024B (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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201911205073.3A priority Critical patent/CN112888024B/en
Publication of CN112888024A publication Critical patent/CN112888024A/en
Application granted granted Critical
Publication of CN112888024B publication Critical patent/CN112888024B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

The application discloses a data processing method, a data processing device, a storage medium and electronic equipment, wherein data to be transmitted is acquired, the data to be transmitted comprises at least one character, the character type of each character in the data to be transmitted is determined, a character type group is acquired, then a dynamic coding strategy of the data to be transmitted is determined according to the character type group, and the data to be transmitted is coded according to the dynamic coding strategy, so that a proper coding mode can be selected for coding based on the character type of the transmitted data, the data volume of the transmitted data is reduced, the transmission speed is accelerated, the time consumed by transmission is reduced, and the method is favorable for the use and popularization of a wireless low-speed network.

Description

Data processing method, data processing device, storage medium and electronic equipment
Technical Field
The present application relates to the field of computers, and in particular, to a data processing method, an apparatus, a storage medium, and an electronic device.
Background
Wireless networks refer to networks that enable interconnection of various communication devices without wiring, and wireless network technologies cover a wide range, including both global voice and data networks that allow users to establish long-range wireless connections, and infrared and radio-frequency technologies that are optimized for short-range wireless connections.
Currently, wireless networks can be broadly divided into two types: the wireless low-speed network and the wireless high-speed network, wherein, data transmission is mostly carried out through the wireless high-speed network in scenes such as browsing web pages, watching videos and using app applications in the weekdays, and the speed and the bandwidth are not bottleneck factors. However, in the use scene of the intelligent hardware, a lot of wireless low-speed networks are used, for example, in the distribution network scene of the king robot, the king robot transmits the WiFi account and the password to the sound box through short-distance communication technologies such as bluetooth, and the sound box realizes WiFi network connection. In the existing wireless low-speed network communication process, transmission data needs to be sent after UTF-8 encoding, but the encoding mode can cause a larger data expansion rate, and for a wireless low-speed network with a not very large transmission speed and bandwidth, the technical problems of overlong transmission time, low transmission success rate, high retransmission rate and the like can be caused.
Disclosure of Invention
The embodiment of the application provides a data processing method, a data processing device, a storage medium and electronic equipment, which can select a proper coding mode for coding transmission based on the character type of transmission data, reduce the data volume of the transmission data and accelerate the transmission speed.
The embodiment of the application provides a data processing method, which is applied to first electronic equipment and comprises the following steps:
acquiring data to be sent, wherein the data to be sent comprises at least one character;
determining the character type of each character in the data to be sent to obtain a character type group;
determining a dynamic coding strategy of the data to be sent according to the character type group;
and coding the data to be sent according to the dynamic coding strategy.
Wherein, the determining the dynamic encoding strategy of the data to be transmitted according to the character type group includes:
when all the character type groups are digital types, taking a first preset encoding strategy as a dynamic encoding strategy of the data to be transmitted;
when all the character type groups are letter types, taking a second preset coding strategy as a dynamic coding strategy of the data to be sent;
when the character type group comprises a Chinese type, taking a third preset encoding strategy as a dynamic encoding strategy of the data to be sent;
and when the character type group only comprises an alphabet type and a number type, taking a fourth preset encoding strategy as a dynamic encoding strategy of the data to be transmitted.
After encoding the data to be transmitted according to the dynamic encoding strategy, the method further includes:
acquiring data item identification characters corresponding to the data to be sent and strategy identification characters corresponding to the dynamic coding strategy;
generating a checksum corresponding to the data to be sent;
generating message data according to the data item identification characters, the strategy identification characters, the check sum and the coded data to be sent;
and sending the message data to second electronic equipment so that the second electronic equipment decodes the data to be sent from the message data.
Generating message data according to the data item identifier character, the policy identifier character, the checksum and the encoded data to be transmitted, including:
assembling the data item identification characters, the strategy identification characters, the check sums and the coded data to be sent according to a preset sequence to obtain assembled data;
and generating message data according to the assembly data.
The acquiring data to be transmitted includes: acquiring data input by a user in an input window of an input interface, wherein the input interface comprises at least one input window; taking the data input in each input window as a section of data to be sent;
the acquiring of the data item identification character corresponding to the data to be sent includes: determining an input window corresponding to the data to be sent; and acquiring the data item identification characters corresponding to the input window.
The embodiment of the present application further provides a data processing method, applied to a second electronic device, including: receiving message data sent by first electronic equipment;
extracting corresponding strategy identification characters and encoded data from the message data;
determining a dynamic coding strategy corresponding to the extracted strategy identification character as a target coding strategy;
and decoding the extracted encoded data according to the target encoding strategy.
Wherein, after decoding the extracted encoded data according to the target encoding policy, the method further comprises:
extracting a corresponding checksum and a data item identification character from the message data;
generating a checksum corresponding to the decoded encoded data as a target checksum;
when the target checksum is equal to the extracted checksum, corresponding operation is executed according to the decoded encoded data and the extracted data item identification characters;
discarding the decoded encoded data when the target checksum is not equal to the extracted checksum.
An embodiment of the present application further provides a data processing apparatus, applied to a first electronic device, including:
the device comprises an acquisition module, a sending module and a receiving module, wherein the acquisition module is used for acquiring data to be sent, and the data to be sent comprises at least one character;
the first determining module is used for determining the character type of each character in the data to be sent to obtain a character type group;
a second determining module, configured to determine a dynamic encoding policy of the data to be sent according to the character type group;
and the coding module is used for coding the data to be sent according to the dynamic coding strategy.
Wherein the second determination module is to:
when all the character type groups are digital types, taking a first preset encoding strategy as a dynamic encoding strategy of the data to be transmitted;
when all the character type groups are letter types, taking a second preset coding strategy as a dynamic coding strategy of the data to be sent;
when the character type group comprises a Chinese type, taking a third preset encoding strategy as a dynamic encoding strategy of the data to be sent;
and when the character type group only comprises an alphabet type and a number type, taking a fourth preset encoding strategy as a dynamic encoding strategy of the data to be transmitted.
Wherein, the data processing device further comprises a sending module, configured to:
after the coding module codes the data to be sent according to the dynamic coding strategy, acquiring a data item identification character corresponding to the data to be sent and a strategy identification character corresponding to the dynamic coding strategy;
generating a checksum corresponding to the data to be sent;
generating message data according to the data item identification characters, the strategy identification characters, the check sum and the coded data to be sent;
and sending the message data to the second electronic equipment.
Wherein the sending module is specifically configured to:
assembling the data item identification characters, the strategy identification characters, the check sums and the coded data to be sent according to a preset sequence to obtain assembled data;
and generating message data according to the assembly data.
Wherein the obtaining module is specifically configured to: acquiring data input by a user in an input window of an input interface, wherein the input interface comprises at least one input window; taking the data input in each input window as a section of data to be sent;
the sending module is specifically configured to: determining an input window corresponding to the data to be sent; and acquiring the data item identification characters corresponding to the input window.
The embodiment of the present application further provides a data processing method, applied to a second electronic device, including: the receiving module is used for receiving message data sent by the first electronic equipment;
the extraction module is used for extracting corresponding strategy identification characters and encoded data from the message data;
the determining module is used for determining the dynamic coding strategy corresponding to the extracted strategy identification character as a target coding strategy;
and the decoding module is used for decoding the extracted encoded data according to the target encoding strategy.
Wherein, the data processing device further comprises a checking module for:
after the decoding module decodes the extracted encoded data according to the target encoding strategy, extracting a corresponding checksum and a data item identification character from the message data to be decoded;
generating a checksum corresponding to the decoded encoded data as a target checksum;
when the target checksum is equal to the extracted checksum, corresponding operation is executed according to the decoded encoded data and the extracted data item identification characters; discarding the decoded encoded data when the target checksum is not equal to the extracted checksum.
The embodiment of the application also provides a computer readable storage medium, wherein a plurality of instructions are stored in the storage medium, and the instructions are suitable for being loaded by a processor to execute any one of the data processing methods.
The embodiment of the application further provides an electronic device, which comprises a processor and a memory, wherein the processor is electrically connected with the memory, the memory is used for storing instructions and data, and the processor is used for executing the steps in any data processing method.
According to the data processing method, the data processing device, the storage medium and the electronic equipment, data to be sent are obtained, the data to be sent comprise at least one character, the character type of each character in the data to be sent is determined, a character type group is obtained, then a dynamic coding strategy of the data to be sent is determined according to the character type group, and the data to be sent is coded according to the dynamic coding strategy, so that a proper coding mode can be selected for coding based on the character type of the transmitted data, the data quantity of the transmitted data is reduced, the transmission speed is accelerated, the time consumed by transmission is shortened, and the method, the device, the storage medium and the electronic equipment are favorable for using and popularizing a wireless low-speed.
Drawings
The technical solution and other advantages of the present application will become apparent from the detailed description of the embodiments of the present application with reference to the accompanying drawings.
Fig. 1 is a schematic view of a scenario of a data processing system according to an embodiment of the present application.
Fig. 2 is a schematic flow chart of a data processing method according to an embodiment of the present application.
Fig. 3 is a schematic diagram illustrating a selection of a dynamic encoding method according to an embodiment of the present application.
Fig. 4 is a schematic illustration of data expansion rate provided in the embodiment of the present application.
Fig. 5 is another schematic flow chart of the data processing method according to the embodiment of the present application.
Fig. 6 is another schematic flow chart of the data processing method according to the embodiment of the present application.
Fig. 7 is a schematic view of an operation process of the sound box according to the embodiment of the present application to implement WiFi network connection.
Fig. 8 is a schematic structural diagram of a data processing apparatus according to an embodiment of the present application.
Fig. 9 is another schematic structural diagram of a data processing apparatus according to an embodiment of the present application.
Fig. 10 is another schematic structural diagram of a data processing apparatus according to an embodiment of the present application.
Fig. 11 is another schematic structural diagram of a data processing apparatus according to an embodiment of the present application.
Fig. 12 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The embodiment of the application provides a data processing method and device, a storage medium and electronic equipment.
Referring to fig. 1, fig. 1 is a schematic view of a data processing system, where the data processing system may include any one of the data processing apparatuses provided in the embodiments of the present application, and the data processing apparatus may be integrated in an electronic device, and the electronic device may be a device capable of performing wireless network communication, such as a mobile phone, a bluetooth sound, an intelligent robot, and the like.
The electronic equipment can acquire data to be sent, wherein the data to be sent comprises at least one character; determining the character type of each character in the data to be sent to obtain a character type group; determining a dynamic coding strategy of the data to be sent according to the character type group; and coding the data to be sent according to the dynamic coding strategy.
The data to be transmitted is usually a single character string, and the character string is a string of characters composed of at least one character, and the character includes chinese, letters, numbers, operation symbols and/or punctuation marks, etc., which is the smallest data access unit in the data structure. The character types mainly include three types of letter type, number type and chinese type. The dynamic encoding strategy may be artificially set in advance, for example, different encoding modes may be used to encode character strings of different character types in advance, and the encoding mode with the minimum data amount after encoding is selected as the dynamic encoding strategy (equivalent to the optimal encoding mode) corresponding to the character type.
For example, the first electronic device may be a king robot, please refer to fig. 1, in an intelligent home, when the king robot needs to configure a WiFi network for a bluetooth sound, it needs to establish a bluetooth communication connection between the king robot and the bluetooth sound, and then send network configuration data such as a network account and a password of the WiFi network to the bluetooth sound through the bluetooth network, so that the bluetooth sound automatically performs WiFi network connection according to the network account and the password. Because bluetooth transmission belongs to low-speed network channel transmission, compared with other WiFi-like wireless networks, the transmission speed and bandwidth of the bluetooth transmission are limited to a certain extent, if the data amount of the transmitted data is too large, the consumed time is long, for this reason, the king robot needs to encode and compress the data before performing data transmission, the encoding mode depends on the respective character types of the network account and the password, the character strings of different character types adopt different encoding modes, for example, for all character strings that are letters, American Standard Code for Information Interchange (ASCII) encoding can be adopted, for character strings that contain Chinese, GBK (Chinese character Code Specification) encoding can be adopted, and then message data is generated based on the encoded data for transmission, thereby reducing the data amount of the transmitted data as much as possible, the transmission speed is increased.
As shown in fig. 2, fig. 2 is a schematic flowchart of a data processing method provided in an embodiment of the present application, where the data processing method is applied to a first electronic device, and the first electronic device may be a device capable of performing wireless network communication, such as a mobile phone, a tablet computer, and an intelligent robot, and a specific flow may be as follows:
s101, data to be sent is obtained, and the data to be sent comprises at least one character.
The data to be transmitted is usually a single character string, and the character string is a string of characters composed of at least one character, and the character includes chinese, letters, numbers, operation symbols and/or punctuation marks, etc., which is the smallest data access unit in the data structure.
And S102, determining the character type of each character in the data to be sent to obtain a character type group.
The Character types mainly include three types, namely letter types, number types and Chinese types, and the number of bytes occupied by the characters of different Character types after being coded is different in different coding modes, for example, for a single Character of a Chinese type, 2 bytes are occupied in a GBK coding mode, and 3 bytes are occupied in a UTF-8 (8-bit) coding mode.
And S103, determining a dynamic coding strategy of the data to be sent according to the character type group.
Specifically, existing internet networks are roughly divided into two types: the wireless high-speed network mainly refers to a network which uses a wireless high-speed network protocol to realize data transmission, such as a WLAN wireless local area network protocol, and the transmission speed and bandwidth of the wireless high-speed network are relatively high, such as the WLAN wireless local area network protocol. The wireless low-speed network mainly refers to a network for realizing data transmission by using a wireless low-speed network protocol, typical low-speed network protocols comprise an infrared protocol, a bluetooth protocol, an NFC (Near Field Communication) protocol, an 802.05.4/ZigBee violet peak protocol and the like, the transmission speed and bandwidth are relatively small, and once the data volume of the transmitted data is relatively large, the transmission time consumption is too long and the transmission success rate is relatively low, so when the wireless low-speed network is used for data transmission, data coding and compression are often required to be transmitted, in the existing wireless low-speed network, no matter what type of character string the data is, the data is coded by simply adopting a UTF-8 coding mode, the coding is simple and rough, the expansion rate of the coded data is relatively large, the reduction of the data volume is not helpful, and the transmission effect is not good.
For example, the step S103 may specifically include:
when all the character type groups are digital types, taking a first preset encoding strategy as a dynamic encoding strategy of the data to be transmitted;
when all the character types in the character type group are letter types, taking a second preset coding strategy as a dynamic coding strategy of the data to be sent;
when the character type group comprises a Chinese type, taking a third preset coding strategy as a dynamic coding strategy of the data to be sent;
and when the character type group only comprises an alphabetic type and a numeric type, taking a fourth preset encoding strategy as a dynamic encoding strategy of the data to be transmitted.
The first preset encoding strategy, the second preset encoding strategy, the third preset encoding strategy and the fourth preset encoding strategy may be the same or different, and may be set manually or set by the system, for example, the system sets a plurality of character strings in different combination forms, and combines the character strings into a plurality of encoding mode combinations based on the existing various encoding modes and their respective characteristics, each encoding mode combination includes at least one encoding mode, then encodes each character string by using the encoding mode combinations, and selects the optimal encoding mode combination corresponding to each combination form character string by comparing the data size of the encoded data as the corresponding preset encoding strategy.
For example, the first predetermined encoding strategy may be encoding using base64 and then encoding using ASCII, the second predetermined encoding strategy may be encoding using ASCII, the third predetermined encoding strategy may be encoding using GBK, and the fourth predetermined encoding strategy may be encoding using UTF-8.
Referring to fig. 3, if the data to be sent is "staffWiFi", it indicates that all data are of an alphabetical type, ASCII can be directly used for data encoding, and when the data to be sent is "staff 123", it indicates that the data include an alphabetical type and a numeric type, and it can perform data encoding by UTF-8, and when the data to be sent is "1234567", it indicates that all data are of a numeric type, and it can perform data encoding by base64 first and then by ASCII, and when the data to be sent is "strong xq 1123", it indicates that the data include a chinese type, and it can perform data encoding by GBK.
And S104, coding the data to be sent according to the dynamic coding strategy.
For example, for a character string "Tencent", the result of encoding with base64 is "VGVuY 2VudA ═ and the character number is increased by 33% (i.e., the expansion rate is 33%), the result of encoding with ASCII is" Tencent ", the character number is not increased (i.e., the expansion rate is 0%), and for a character string" 123456789 ", the result of encoding with base64 is" HW80V ", and the character number is decreased by 50% (i.e., the expansion rate is-50%).
It should be noted that, for the existing wireless low-speed network directly adopting the UTF-8 coding method, the embodiment flexibly selects an appropriate coding strategy based on the character type, and this coding method can better solve the problem of expansion rate, for example, please refer to fig. 4, where fig. 4 shows the data expansion rate after several character strings with different character combinations are respectively coded by the existing coding method (that is, directly adopting the UTF-8 coding, and indicated by a diagonal frame in fig. 4) and the data expansion rate after being coded by the dynamic coding strategy (indicated by a vertical line frame in fig. 4), for example, for a pure english character string, a pure chinese character string, a pure digital character string, and a mixed chinese character string, the expansion rates of the existing coding methods are 100%, 500%, 100%, and 270%, and the expansion rates of the dynamic coding methods are 10%, 300%, and 300% in turn, 100% and 180%, obviously, after being coded by the dynamic coding mode in this embodiment, the expansion rate is obviously reduced, and the method is very suitable for data transmission of an infinite low-speed network, and of course, also can be suitable for data transmission of a wireless high-speed network.
For example, after the step S104, the data processing method may further include:
acquiring a data item identification character corresponding to the data to be sent and a strategy identification character corresponding to the dynamic coding strategy;
generating a checksum corresponding to the data to be sent;
generating message data according to the data item identification character, the strategy identification character, the checksum and the coded data to be sent;
and sending the message data to second electronic equipment so that the second electronic equipment decodes the data to be sent from the message data.
The checksum (checksum) is mainly used for verifying the integrity and accuracy of transmission data, and a checksum can be obtained by calculating data to be transmitted through a specified verification algorithm. The message data (message) is a data unit exchanged and transmitted in the network, that is, a data block to be sent by a station at a time, which contains the complete data content to be sent, and the data length is not limited and can be changed. The second electronic device may be a device that has established wireless low-speed network communication with the first electronic device, such as a bluetooth speaker, and transmits the message data through the wireless low-speed network.
The data item identification character and the policy identification character are artificially specified in advance, and may be a number or a number string occupying a specified number of bytes (for example, one byte), where the data item identification character is used to indicate a data item to which data to be sent belongs, such as a network account, an account password, or a user account, and may be determined according to an acquisition interface of the data to be sent, for example, the step of acquiring the data item identification character corresponding to the data to be sent specifically includes:
determining an input window corresponding to the data to be sent;
and acquiring the data item identification character corresponding to the input window.
For example, for a network login interface, a network account input box and an account password input box may be arranged on the network login interface, and different input boxes represent different acquisition interfaces and have different data item identification characters.
At this time, the step of acquiring data to be transmitted specifically includes: acquiring data input by a user in an input window of an input interface, wherein the input interface comprises at least one input window; and taking the data input in each input window as a segment of data to be transmitted.
The user can complete data input operation in each input window by adopting modes of character input, voice input or gesture input and the like, and when the user completes the input operation, the input data in different input windows can be taken as different data to be sent and sent in sequence.
Specifically, the generating of the message data according to the data item identifier character, the policy identifier character, the checksum, and the encoded data to be sent includes:
assembling the data item identification character, the strategy identification character, the checksum and the coded data to be sent according to a preset sequence to obtain assembled data;
and generating message data according to the assembly data.
The preset sequence may be set manually, for example, the preset sequence may be a data item identifier character, a policy identifier character, encoded data to be sent, and a checksum in sequence. After the assembled data is generated, the assembled data may be further compressed and encrypted to generate message data. For example, if the data to be sent is the network account name staffWiFi, and the data item identifier corresponding to the network account name is 0, since the data to be sent is of a full-alphabet type, the data to be sent may be encoded by using a second preset encoding policy (e.g., ASCII), assuming xxxxxxx is obtained, and the checksum thereof is calculated, assuming yy occupying two bytes, at this time, if the policy identifier of the second preset encoding policy is 11, the final assembly data may be 110 xxxxxxxyyy, and the total number of bytes of the assembly data is the sum of the data item identifier, the policy identifier, the checksum, and the number of bytes of the encoded data to be sent.
It should be noted that the first electronic device may utilize the wireless low-speed network to transmit data, and may also utilize the network to receive data, and for the received data, decoding is required to obtain the original text.
Therefore, the data processing method provided by the application is applied to the first electronic device, and is beneficial to popularization and use of the wireless low-speed network by obtaining data to be transmitted, wherein the data to be transmitted comprises at least one character, determining the character type of each character in the data to be transmitted to obtain a character type group, then determining the dynamic coding strategy of the data to be transmitted according to the character type group, and coding the data to be transmitted according to the dynamic coding strategy, so that a proper coding mode can be selected for coding based on the character type of the transmitted data, the data volume of the transmitted data is reduced, the transmission speed is increased, the time consumed by transmission is reduced, and the wireless low-speed network is facilitated to use and popularize.
According to the method described in the foregoing embodiment, the present application further provides a data processing method, which is applied to a second electronic device, where the second electronic device is connected to the first electronic device through a wireless network, and the wireless network may be a wireless low-speed network. Referring to fig. 5, fig. 5 is a schematic flow chart of a data processing method provided in the embodiment of the present application, and a specific flow may be as follows:
s201, receiving message data sent by first electronic equipment.
S202, extracting corresponding strategy identification characters and encoded data from the message data.
And S203, determining the extracted dynamic coding strategy corresponding to the strategy identification character as a target coding strategy.
And S204, decoding the extracted encoded data according to the target encoding strategy.
The second electronic device may be any device that establishes a communication connection with the first electronic device via a designated network (e.g., a wireless low-speed network). The message data can be decrypted and decompressed to obtain original assembly data, then the strategy identification characters, the data item identification characters and the check sum are determined from the fixed byte positions in the original assembly data, and the rest data is the encoded data. Generally, the encoding process and the decoding process correspond to each other, and the corresponding decoding method can be determined based on the encoding method.
For example, after decoding the extracted encoded data according to the target encoding policy, the data processing method may further include:
extracting corresponding check sums and data item identification characters from the message data;
generating a checksum corresponding to the decoded encoded data as a target checksum;
when the target checksum is equal to the extracted checksum, corresponding operation is executed according to the decoded encoded data and the extracted data item identification character;
discarding the encoded data after decoding when the target checksum is not equal to the extracted checksum.
The checksum extracted from the message data to be decoded is generated by the target electronic device (sending device) for original data, when the receiving device receives the decoded data, the decoded data can be input into a specified checksum algorithm to obtain an actual checksum, whether the decoded data is complete and accurate is determined by analyzing whether the actual checksum is consistent with the checksum carried in the message, if the actual checksum is inconsistent with the checksum carried in the message, the decoded data is discarded, and if the actual checksum is inconsistent with the checksum, subsequent operations are performed, for example, WiFi network connection is performed through a decoded network account number and a decoded password.
According to the data processing method, the message data sent by the first electronic device are received, the corresponding strategy identification characters and the coded data are extracted from the message data, then the extracted dynamic coding strategy corresponding to the strategy identification characters is determined and used as a target coding strategy, and the extracted coded data are decoded according to the target coding strategy, so that the coded data based on flexible coding of character types can be successfully decoded, the data volume of the transmitted data is favorably reduced, the transmission speed is accelerated, the time consumed by transmission is shortened, and the use and popularization of a wireless low-speed network are favorably realized.
According to the method described in the above embodiment, the data processing method is applied to the first electronic device, which is an imperial robot, and the second electronic device, which is a bluetooth speaker, for example, as described in detail below.
Referring to fig. 6 and fig. 7, fig. 6 is a schematic flow chart of a data processing method according to an embodiment of the present application, where the data processing method includes the following steps:
s301, the first electronic device obtains data input by a user in an input window of an input interface, wherein the input interface comprises at least one input window.
S302, the first electronic device takes the data input in each input window as a section of data to be sent, the data to be sent comprises at least one character, and obtains a data item identification character corresponding to the input window.
In fig. 7, for example, if a user wants to configure a bluetooth speaker network, it may be ensured that the king robot has access to a WiFi network, for example, the king robot is triggered to display a network login interface, the network login interface is provided with a network account number input box and an account number password input box, different input boxes represent different acquisition interfaces and have different data item identification characters, when the user inputs correct contents in the corresponding input boxes and clicks a "confirm" button, the first electronic device may acquire input data in each input box for storage, and then, when the king robot needs to configure a bluetooth speaker network, in addition to establishing the bluetooth connection between the wang robot and the bluetooth speaker, each piece of input data (network account number and account number password) that has been stored is sent to the bluetooth speaker as a separate data segment to be sent.
And S303, the first electronic equipment determines the character type of each character in the data to be sent to obtain a character type group.
S304, when all the character type groups are digital types, the first electronic equipment takes a first preset coding strategy as a dynamic coding strategy of the data to be sent; when all the character types in the character type group are letter types, the first electronic equipment takes a second preset coding strategy as a dynamic coding strategy of the data to be sent; when the character type group comprises a Chinese type, the first electronic equipment takes a third preset coding strategy as a dynamic coding strategy of the data to be sent; and when the character type group only comprises an alphabetic type and a numeric type, the first electronic equipment takes a fourth preset encoding strategy as a dynamic encoding strategy of the data to be transmitted.
S305, the first electronic device encodes the data to be sent according to the dynamic encoding strategy and acquires strategy identification characters corresponding to the dynamic encoding strategy.
The first preset encoding strategy, the second preset encoding strategy, the third preset encoding strategy and the fourth preset encoding strategy are different from each other and have different strategy identification characters. For example, if the data to be sent is staffWiFi, it is indicated that all data are of an alphabetic type, ASCII can be directly used for data encoding, when the data to be sent (for example, a network account name) is "staff 123", it is indicated that all data are of a numeric type, it is indicated that all data are of an alphabetic type and a numeric type, when the data to be sent (for example, an account password) is "1234567", it is indicated that all data are of a numeric type, it is indicated that base64 is used for encoding first, then ASCII is used for data encoding, and when the data to be sent (for example, an account password) is "strong xq 1123", it is indicated that all data are of a chinese type, and GBK is used for.
S306, the first electronic device generates a checksum corresponding to the data to be sent, and assembles the data item identification character, the strategy identification character, the checksum and the coded data to be sent according to a preset sequence to obtain assembled data.
And S307, the first electronic equipment generates message data according to the assembly data and sends the message data to the second electronic equipment.
The preset sequence may be a data item identifier character, a policy identifier character, encoded data to be sent, and a checksum in sequence. For example, if the data to be transmitted is the network account name staffWiFi, and the data item identifier corresponding to the network account name is 0, since the data to be transmitted is of a full-alphabet type, it may be encoded by using a second predetermined encoding policy (e.g., ASCII), assuming xxxxxxx is obtained, and a checksum thereof is calculated, assuming yy occupying two bytes, at this time, if the policy identifier of the second predetermined encoding policy is 11, the final assembly data may be 110 xxxxxxxxxyy.
S308, the second electronic device extracts the corresponding strategy identification characters and the encoded data from the message data.
And S309, the second electronic device determines the extracted dynamic coding strategy corresponding to the strategy identification character as a target coding strategy, and decodes the extracted coded data according to the target coding strategy.
And S310, the second electronic equipment extracts the corresponding checksum and the data item identification character from the message data to be decoded, and generates the checksum corresponding to the decoded encoded data as a target checksum.
For example, before the bluetooth speaker is successfully connected to the WiFi network, the communication between the bluetooth speaker and the king robot is implemented by bluetooth, when the king robot wants to control the bluetooth speaker to access the WiFi network, the information such as the WiFi account number and the password may be encoded and then transmitted to the speaker by bluetooth, at this time, the speaker receiving the encoded data needs to decode, and the decoding is implemented based on the initial encoding.
S311, when the target checksum is equal to the extracted checksum, the second electronic device executes corresponding operation according to the decoded encoded data and the extracted data item identification characters; when the target checksum is not equal to the extracted checksum, the second electronic device discards the decoded encoded data.
For example, when the speaker receives the decoded data, the decoded data may be input into a designated check algorithm to obtain an actual checksum, and whether the decoded data is complete and accurate is determined by analyzing whether the actual checksum is consistent with the checksum carried in the message, if not, the decoded data is discarded, and if so, subsequent operations are performed, such as WiFi network connection according to a WiFi network account and a password.
According to the method described in the above embodiments, the present embodiment will be further described from the perspective of a data processing device, which may be implemented as a separate entity, or may be integrated in an electronic device, such as an imperial robot, a bluetooth speaker, etc.
Referring to fig. 8, fig. 8 specifically illustrates a data processing apparatus provided in the embodiment of the present application, which is applied to a first electronic device, and the data processing apparatus may include: an obtaining module 10, a first determining module 20, a second determining module 30 and an encoding module 40, wherein:
(1) acquisition module 10
The obtaining module 10 is configured to obtain data to be sent, where the data to be sent includes at least one character.
The data to be transmitted is usually a single character string, and the character string is a string of characters composed of at least one character, and the character includes chinese, letters, numbers, operation symbols and/or punctuation marks, etc., which is the smallest data access unit in the data structure.
(2) First determination module 20
The first determining module 20 is configured to determine a character type of each character in the data to be sent, so as to obtain a character type group.
The Character types mainly include three types, namely letter types, number types and Chinese types, and the number of bytes occupied by the characters of different Character types after being coded is different in different coding modes, for example, for a single Character of a Chinese type, 2 bytes are occupied in a GBK coding mode, and 3 bytes are occupied in a UTF-8 (8-bit) coding mode.
(3) Second determination module 30
And a second determining module 30, configured to determine a dynamic encoding policy of the data to be sent according to the character type group.
Specifically, existing internet networks are roughly divided into two types: the wireless high-speed network mainly refers to a network which uses a wireless high-speed network protocol to realize data transmission, such as a WLAN wireless local area network protocol, and the transmission speed and bandwidth of the wireless high-speed network are relatively high, such as the WLAN wireless local area network protocol. The wireless low-speed network mainly refers to a network for realizing data transmission by using a wireless low-speed network protocol, typical low-speed network protocols comprise an infrared protocol, a bluetooth protocol, an NFC (Near Field Communication) protocol, an 802.05.4/ZigBee violet peak protocol and the like, the transmission speed and bandwidth are relatively small, and once the data volume of the transmitted data is relatively large, the transmission time consumption is too long and the transmission success rate is relatively low, so when the wireless low-speed network is used for data transmission, data coding and compression are often required to be transmitted, in the existing wireless low-speed network, no matter what type of character string the data is, the data is coded by simply adopting a UTF-8 coding mode, the coding is simple and rough, the expansion rate of the coded data is relatively large, the reduction of the data volume is not helpful, and the transmission effect is not good.
For example, the second determining module 30 is specifically configured to:
when all the character type groups are digital types, taking a first preset encoding strategy as a dynamic encoding strategy of the data to be transmitted;
when all the character types in the character type group are letter types, taking a second preset coding strategy as a dynamic coding strategy of the data to be sent;
when the character type group comprises a Chinese type, taking a third preset coding strategy as a dynamic coding strategy of the data to be sent;
and when the character type group only comprises an alphabetic type and a numeric type, taking a fourth preset encoding strategy as a dynamic encoding strategy of the data to be transmitted.
The first preset encoding strategy, the second preset encoding strategy, the third preset encoding strategy and the fourth preset encoding strategy may be the same or different, and may be set manually or set by the system, for example, the system sets a plurality of character strings in different combination forms, and combines the character strings into a plurality of encoding mode combinations based on the existing various encoding modes and their respective characteristics, each encoding mode combination includes at least one encoding mode, then encodes each character string by using the encoding mode combinations, and selects the optimal encoding mode combination corresponding to each combination form character string by comparing the data size of the encoded data as the corresponding preset encoding strategy.
For example, the first predetermined encoding strategy may be encoding using base64 and then encoding using ASCII, the second predetermined encoding strategy may be encoding using ASCII, the third predetermined encoding strategy may be encoding using GBK, and the fourth predetermined encoding strategy may be encoding using UTF-8.
Referring to fig. 3, if the data to be sent is staffWiFi, it indicates that all data are in the letter type, ASCII can be directly used for data encoding, when the data to be sent is "staff 123", it indicates that the data include the letter type and the number type, UTF-8 can be used for data encoding, when the data to be sent is "1234567", it indicates that all data are in the number type, base64 can be used for encoding first, then ASCII is used for data encoding, and when the data to be sent is "strong xq 1123", it indicates that the data include the chinese type, and GBK can be used for data encoding.
(4) Encoding module 40
And the encoding module 40 is configured to encode the data to be sent according to the dynamic encoding policy.
For example, for a character string "Tencent", the result of encoding with base64 is "VGVuY 2VudA ═ and the character number is increased by 33% (i.e., the expansion rate is 33%), the result of encoding with ASCII is" Tencent ", the character number is not increased (i.e., the expansion rate is 0%), and for a character string" 123456789 ", the result of encoding with base64 is" HW80V ", and the character number is decreased by 50% (i.e., the expansion rate is-50%).
It should be noted that, for the existing wireless low-speed network directly adopting the UTF-8 coding method, the present embodiment flexibly selects the appropriate coding strategy based on the character type, and this coding method can better solve the problem of the expansion rate, for example, please refer to fig. 4, fig. 4 shows the data expansion rate after several character strings with different character combinations are respectively coded by the existing coding method (i.e. directly adopting the UTF-8 coding) and the data expansion rate after being coded by the dynamic coding strategy, for example, for a pure english character string, a pure chinese character string, a pure digital character string, and a mixed chinese character string, the expansion rates of the existing coding methods are sequentially 100%, 500%, 100%, and 270%, and the expansion rates of the dynamic coding methods are sequentially 10%, 300%, -100%, and 180%, obviously, after being coded by the dynamic coding method in this embodiment, the expansion rate is obviously reduced, and the method is very suitable for data transmission of an infinite low-speed network and is also suitable for data transmission of a wireless high-speed network.
For example, referring to fig. 9, the data processing apparatus further includes a sending module 50 for:
after the encoding module 40 encodes the data to be transmitted according to the dynamic encoding policy, acquiring a data item identifier character corresponding to the data to be transmitted and a policy identifier character corresponding to the dynamic encoding policy;
generating a checksum corresponding to the data to be sent;
generating message data according to the data item identification character, the strategy identification character, the checksum and the coded data to be sent;
and sending the message data to second electronic equipment so that the second electronic equipment decodes the data to be sent from the message data.
The checksum (checksum) is mainly used for verifying the integrity and accuracy of transmission data, and a checksum can be obtained by calculating data to be transmitted through a specified verification algorithm. The message data (message) is a data unit exchanged and transmitted in the network, that is, a data block to be sent by a station at a time, which contains the complete data content to be sent, and the data length is not limited and can be changed. The second electronic device may be a device that has established wireless low-speed network communication with the first electronic device, such as a bluetooth speaker, and transmits the message data through the wireless low-speed network.
The data item identification character and the policy identification character are specified in advance by humans, and may be a number or a number string occupying a specified number of bytes (for example, one byte), where the data item identification character is used to indicate a data item to which data to be sent belongs, such as a network account, an account password, or a user account, and may be determined according to an acquisition interface of the data to be sent, for example, the sending module 50 is specifically configured to: determining an input window corresponding to the data to be sent;
and acquiring the data item identification character corresponding to the input window.
For example, for a network login interface, a network account input box and an account password input box may be arranged on the network login interface, and different input boxes represent different acquisition interfaces and have different data item identification characters.
At this time, the obtaining module 10 is specifically configured to: acquiring data input by a user in an input window of an input interface, wherein the input interface comprises at least one input window; and taking the data input in each input window as a segment of data to be transmitted.
The user can complete data input operation in each input window by adopting modes of character input, voice input or gesture input and the like, and when the user completes the input operation, the input data in different input windows can be taken as different data to be sent and sent in sequence.
Further, the sending module 50 is specifically configured to:
assembling the data item identification character, the strategy identification character, the checksum and the coded data to be sent according to a preset sequence to obtain assembled data;
and generating message data according to the assembly data.
The preset sequence may be set manually, for example, the preset sequence may be a data item identifier character, a policy identifier character, encoded data to be sent, and a checksum in sequence. After the assembled data is generated, the assembled data may be further compressed and encrypted to generate message data. For example, if the data to be sent is the network account name staffWiFi, and the data item identifier corresponding to the network account name is 0, since the data to be sent is of a full-alphabet type, the data to be sent may be encoded by using a second preset encoding policy (e.g., ASCII), assuming xxxxxxx is obtained, and the checksum thereof is calculated, assuming yy occupying two bytes, at this time, if the policy identifier of the second preset encoding policy is 11, the final assembly data may be 110 xxxxxxxyyy, and the total number of bytes of the assembly data is the sum of the data item identifier, the policy identifier, the checksum, and the number of bytes of the encoded data to be sent.
It should be noted that the first electronic device may utilize the wireless low-speed network to transmit data, and may also utilize the network to receive data, and for the received data, decoding is required to obtain the original text.
As can be seen from the above, the data processing apparatus provided in this embodiment is applied to a first electronic device, and obtains data to be transmitted through an obtaining module 10, where the data to be transmitted includes at least one character, a first determining module 20 determines a character type of each character in the data to be transmitted to obtain a character type group, a second determining module 30 then determines a dynamic coding strategy of the data to be transmitted according to the character type group, and a coding module 40 codes the data to be transmitted according to the dynamic coding strategy, so that a suitable coding mode can be selected for coding based on the character type of the data to be transmitted, the data amount of the data to be transmitted is reduced, the transmission speed is increased, the time consumed for transmission is reduced, and the use and popularization of a wireless low-speed network are facilitated.
According to the method described in the above embodiment, the present application also provides another data processing apparatus. Referring to fig. 10, fig. 10 specifically illustrates another data processing apparatus provided in the embodiment of the present application, which is applied to a second electronic device, and the data processing apparatus may include: a receiving module 60, an extracting module 70, a determining module 80 and a decoding module 90, wherein:
a receiving module 60, configured to receive message data sent by a first electronic device;
an extracting module 70, configured to extract corresponding policy identifier characters and encoded data from the message data;
a determining module 80, configured to determine the extracted dynamic encoding policy corresponding to the policy identifier character as a target encoding policy;
and a decoding module 90, configured to decode the extracted encoded data according to the target encoding policy.
The second electronic device may be any device that establishes a communication connection with the first electronic device via a designated network (e.g., a wireless low-speed network). The message data can be decrypted and decompressed to obtain original assembly data, then the strategy identification characters, the data item identification characters and the check sum are determined from the fixed byte positions in the original assembly data, and the rest data is the encoded data. Generally, the encoding process and the decoding process correspond to each other, and the corresponding decoding method can be determined based on the encoding method.
For example, referring to fig. 11, the data processing apparatus further includes a verification module 100 for:
after the decoding module 90 decodes the extracted encoded data according to the target encoding policy, extracting a corresponding checksum and a data item identifier character from the message data;
generating a checksum corresponding to the decoded encoded data as a target checksum;
when the target checksum is equal to the extracted checksum, corresponding operation is executed according to the decoded encoded data and the extracted data item identification character; discarding the encoded data after decoding when the target checksum is not equal to the extracted checksum.
The checksum extracted from the message data is generated by the first electronic device for the original data, when the receiving device receives the decoded data, the second electronic device can input the decoded data into a specified checksum to obtain an actual checksum, whether the decoded data is complete and accurate is determined by analyzing whether the actual checksum is consistent with the checksum carried in the message, if not, the decoded data is discarded, and if so, subsequent operations are executed, for example, WiFi network connection is performed through the decoded network account and the decoded password.
In a specific implementation, the above units may be implemented as independent entities, or may be combined arbitrarily to be implemented as the same or several entities, and the specific implementation of the above units may refer to the foregoing method embodiments, which are not described herein again.
As can be seen from the above, the data processing apparatus provided in this embodiment is applied to a second electronic device, and is configured to receive, by using the receiving module 60, message data sent by a first electronic device, extract a corresponding policy identifier character and encoded data from the message data by using the extracting module 70, determine, by using the determining module 80, a dynamic encoding policy corresponding to the extracted policy identifier character, and use the dynamic encoding policy as a target encoding policy, and decode, by using the decoding module 90, the extracted encoded data according to the target encoding policy, so that encoded data that is flexibly encoded based on character types can be successfully decoded, which is beneficial to reducing data volume of transmission data, increasing transmission speed, reducing time consumed for transmission, and facilitating use and popularization of a wireless low-speed network.
Correspondingly, the embodiment of the invention also provides a data processing system, which comprises any one of the data processing devices provided by the embodiment of the invention, and the data processing device can be integrated in electronic equipment.
The electronic equipment can acquire data to be sent, wherein the data to be sent comprises at least one character;
determining the character type of each character in the data to be sent to obtain a character type group;
determining a dynamic coding strategy of the data to be sent according to the character type group;
and coding the data to be sent according to the dynamic coding strategy.
The specific implementation of each device can be referred to the previous embodiment, and is not described herein again.
Since the data processing system may include any data processing apparatus provided in the embodiment of the present invention, beneficial effects that can be achieved by any data processing apparatus provided in the embodiment of the present invention can be achieved, for details, see the foregoing embodiment, and are not described herein again.
Accordingly, an electronic device according to an embodiment of the present disclosure may include, as shown in fig. 12, a Radio Frequency (RF) circuit 601, a memory 602 including one or more computer-readable storage media, an input unit 603, a display unit 604, a sensor 605, an audio circuit 606, a Wireless Fidelity (WiFi) module 607, a processor 608 including one or more processing cores, and a power supply 609. Those skilled in the art will appreciate that the electronic device configuration shown in fig. 12 does not constitute a limitation of the electronic device and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components. Wherein:
the RF circuit 601 may be used for receiving and transmitting signals during a message transmission or communication process, and in particular, for receiving downlink messages from a base station and then processing the received downlink messages by one or more processors 608; in addition, data relating to uplink is transmitted to the base station. In general, the RF circuit 601 includes, but is not limited to, an antenna, at least one Amplifier, a tuner, one or more oscillators, a Subscriber Identity Module (SIM) card, a transceiver, a coupler, a Low Noise Amplifier (LNA), a duplexer, and the like. In addition, the RF circuit 601 may also communicate with networks and other devices via wireless communications. The wireless communication may use any communication standard or protocol, including but not limited to Global System for Mobile communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, Short Message Service (SMS), and the like.
The memory 602 may be used to store software programs and modules, and the processor 608 executes various functional applications and data processing by operating the software programs and modules stored in the memory 602. The memory 602 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the electronic device, and the like. Further, the memory 602 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. Accordingly, the memory 602 may also include a memory controller to provide the processor 608 and the input unit 603 access to the memory 602.
The input unit 603 may be used to receive input numeric or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control. In particular, in one particular embodiment, input unit 603 may include a touch-sensitive surface as well as other input devices. The touch-sensitive surface, also referred to as a touch display screen or a touch pad, may collect touch operations by a user (e.g., operations by a user on or near the touch-sensitive surface using a finger, a stylus, or any other suitable object or attachment) thereon or nearby, and drive the corresponding connection device according to a predetermined program. Alternatively, the touch sensitive surface may comprise two parts, a touch detection means and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, sends the touch point coordinates to the processor 608, and can receive and execute commands sent by the processor 608. In addition, touch sensitive surfaces may be implemented using various types of resistive, capacitive, infrared, and surface acoustic waves. The input unit 603 may include other input devices in addition to the touch-sensitive surface. In particular, other input devices may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like.
The display unit 604 may be used to display information input by or provided to a user and various graphical user interfaces of the electronic device, which may be made up of graphics, text, icons, video, and any combination thereof. The Display unit 604 may include a Display panel, and optionally, the Display panel may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like. Further, the touch-sensitive surface may overlay the display panel, and when a touch operation is detected on or near the touch-sensitive surface, the touch operation is transmitted to the processor 608 to determine the type of touch event, and the processor 608 then provides a corresponding visual output on the display panel according to the type of touch event. Although in FIG. 12 the touch sensitive surface and the display panel are two separate components to implement input and output functions, in some embodiments the touch sensitive surface may be integrated with the display panel to implement input and output functions.
The electronic device may also include at least one sensor 605, such as a light sensor, motion sensor, and other sensors. In particular, the light sensor may include an ambient light sensor that may adjust the brightness of the display panel according to the brightness of ambient light, and a proximity sensor that may turn off the display panel and/or the backlight when the electronic device is moved to the ear. As one of the motion sensors, the gravity acceleration sensor can detect the magnitude of acceleration in each direction (generally, three axes), can detect the magnitude and direction of gravity when the mobile phone is stationary, and can be used for applications of recognizing the posture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer and tapping), and the like; as for other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, and an infrared sensor, which may be further configured to the electronic device, detailed descriptions thereof are omitted.
Audio circuitry 606, a speaker, and a microphone may provide an audio interface between a user and the electronic device. The audio circuit 606 may transmit the electrical signal converted from the received audio data to a speaker, and convert the electrical signal into a sound signal for output; on the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit 606 and converted into audio data, which is then processed by the audio data output processor 608, and then passed through the RF circuit 601 to be sent to, for example, another electronic device, or output to the memory 602 for further processing. The audio circuitry 606 may also include an earbud jack to provide communication of a peripheral headset with the electronic device.
WiFi belongs to short-distance wireless transmission technology, and the electronic device can help the user send and receive e-mail, browse web pages, access streaming media, etc. through the WiFi module 607, and it provides wireless broadband internet access for the user. Although fig. 12 shows the WiFi module 607, it is understood that it does not belong to the essential constitution of the electronic device, and may be omitted entirely as needed within the scope not changing the essence of the invention.
The processor 608 is a control center of the electronic device, connects various parts of the entire mobile phone by using various interfaces and lines, and performs various functions of the electronic device and processes data by operating or executing software programs and/or modules stored in the memory 602 and calling data stored in the memory 602, thereby performing overall monitoring of the mobile phone. Optionally, processor 608 may include one or more processing cores; preferably, the processor 608 may integrate an application processor, which primarily handles operating systems, user interfaces, applications, etc., and a modem processor, which primarily handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 608.
The electronic device also includes a power supply 609 (e.g., a battery) for powering the various components, which may preferably be logically coupled to the processor 608 via a power management system, such that the power management system may manage charging, discharging, and power consumption. The power supply 609 may also include any component of one or more dc or ac power sources, recharging systems, power failure detection circuitry, power converters or inverters, power status indicators, and the like.
Although not shown, the electronic device may further include a camera, a bluetooth module, and the like, which are not described in detail herein. Specifically, in this embodiment, the processor 608 in the electronic device loads an executable file corresponding to a process of one or more application programs into the memory 602 according to the following instructions, and the processor 608 runs the application programs stored in the memory 602, so as to implement various functions:
acquiring data to be sent, wherein the data to be sent comprises at least one character;
determining the character type of each character in the data to be sent to obtain a character type group;
determining a dynamic coding strategy of the data to be sent according to the character type group;
and coding the data to be sent according to the dynamic coding strategy.
The electronic device can achieve the effective effect that can be achieved by any data processing apparatus provided in the embodiments of the present application, which is detailed in the foregoing embodiments and not described herein again.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by associated hardware instructed by a program, which may be stored in a computer-readable storage medium, and the storage medium may include: read Only Memory (ROM), Random Access Memory (RAM), magnetic or optical disks, and the like.
The data processing method, the data processing apparatus, the storage medium, and the electronic device provided by the embodiments of the present invention are described in detail above, and a specific example is applied in the present disclosure to explain the principle and the implementation of the present invention, and the description of the above embodiments is only used to help understanding the method and the core idea of the present invention; meanwhile, for those skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (15)

1. A data processing method applied to a first electronic device includes:
acquiring data to be sent, wherein the data to be sent comprises at least one character;
determining the character type of each character in the data to be sent to obtain a character type group;
determining a dynamic coding strategy of the data to be sent according to the character type group;
and coding the data to be sent according to the dynamic coding strategy.
2. The data processing method according to claim 1, wherein the determining the dynamic encoding policy of the data to be transmitted according to the character type group comprises:
when all the character type groups are digital types, taking a first preset encoding strategy as a dynamic encoding strategy of the data to be transmitted;
when all the character type groups are letter types, taking a second preset coding strategy as a dynamic coding strategy of the data to be sent;
when the character type group comprises a Chinese type, taking a third preset encoding strategy as a dynamic encoding strategy of the data to be sent;
and when the character type group only comprises an alphabet type and a number type, taking a fourth preset encoding strategy as a dynamic encoding strategy of the data to be transmitted.
3. The data processing method of claim 1, further comprising, after encoding the data to be transmitted according to the dynamic encoding policy:
acquiring data item identification characters corresponding to the data to be sent and strategy identification characters corresponding to the dynamic coding strategy;
generating a checksum corresponding to the data to be sent;
generating message data according to the data item identification characters, the strategy identification characters, the check sum and the coded data to be sent;
and sending the message data to second electronic equipment so that the second electronic equipment decodes the data to be sent from the message data.
4. The data processing method according to claim 3, wherein the generating message data according to the data item identifier character, the policy identifier character, the checksum, and the encoded data to be sent comprises:
assembling the data item identification characters, the strategy identification characters, the check sums and the coded data to be sent according to a preset sequence to obtain assembled data;
and generating message data according to the assembly data.
5. The data processing method according to claim 3, wherein the acquiring data to be transmitted comprises: acquiring data input by a user in an input window of an input interface, wherein the input interface comprises at least one input window; taking the data input in each input window as a section of data to be sent;
the acquiring of the data item identification character corresponding to the data to be sent includes: determining an input window corresponding to the data to be sent; and acquiring the data item identification characters corresponding to the input window.
6. A data processing method applied to a second electronic device includes:
receiving message data sent by first electronic equipment;
extracting corresponding strategy identification characters and encoded data from the message data;
determining a dynamic coding strategy corresponding to the extracted strategy identification character as a target coding strategy;
and decoding the extracted encoded data according to the target encoding strategy.
7. The data processing method according to claim 6, further comprising, after decoding the extracted encoded data according to the target encoding policy:
extracting a corresponding checksum and a data item identification character from the message data;
generating a checksum corresponding to the decoded encoded data as a target checksum;
when the target checksum is equal to the extracted checksum, corresponding operation is executed according to the decoded encoded data and the extracted data item identification characters;
discarding the decoded encoded data when the target checksum is not equal to the extracted checksum.
8. A data processing apparatus, applied to a first electronic device, the data processing apparatus comprising:
the device comprises an acquisition module, a sending module and a receiving module, wherein the acquisition module is used for acquiring data to be sent, and the data to be sent comprises at least one character;
the first determining module is used for determining the character type of each character in the data to be sent to obtain a character type group;
a second determining module, configured to determine a dynamic encoding policy of the data to be sent according to the character type group;
and the coding module is used for coding the data to be sent according to the dynamic coding strategy.
9. The data processing apparatus of claim 8, wherein the second determining module is configured to:
when all the character type groups are digital types, taking a first preset encoding strategy as a dynamic encoding strategy of the data to be transmitted;
when all the character type groups are letter types, taking a second preset coding strategy as a dynamic coding strategy of the data to be sent;
when the character type group comprises a Chinese type, taking a third preset encoding strategy as a dynamic encoding strategy of the data to be sent;
and when the character type group only comprises an alphabet type and a number type, taking a fourth preset encoding strategy as a dynamic encoding strategy of the data to be transmitted.
10. The data processing apparatus of claim 8, further comprising a sending module configured to:
after the coding module codes the data to be sent according to the dynamic coding strategy, acquiring a data item identification character corresponding to the data to be sent and a strategy identification character corresponding to the dynamic coding strategy;
generating a checksum corresponding to the data to be sent;
generating message data according to the data item identification characters, the strategy identification characters, the check sum and the coded data to be sent;
and sending the message data to second electronic equipment so that the second electronic equipment decodes the data to be sent from the message data.
11. The data processing apparatus of claim 10, wherein the sending module is specifically configured to:
assembling the data item identification characters, the strategy identification characters, the check sums and the coded data to be sent according to a preset sequence to obtain assembled data;
and generating message data according to the assembly data.
12. The data processing apparatus of claim 10, wherein the obtaining module is specifically configured to: acquiring data input by a user in an input window of an input interface, wherein the input interface comprises at least one input window; taking the data input in each input window as a section of data to be sent;
the sending module is specifically configured to: determining an input window corresponding to the data to be sent; and acquiring the data item identification characters corresponding to the input window.
13. A data processing apparatus, applied to a second electronic device, the data processing apparatus comprising:
the receiving module is used for receiving message data sent by the first electronic equipment;
the extraction module is used for extracting corresponding strategy identification characters and encoded data from the message data;
the determining module is used for determining the dynamic coding strategy corresponding to the extracted strategy identification character as a target coding strategy;
and the decoding module is used for decoding the extracted encoded data according to the target encoding strategy.
14. A computer-readable storage medium having stored thereon a plurality of instructions adapted to be loaded by a processor to perform the data processing method of any of claims 1 to 5.
15. An electronic device comprising a processor and a memory, the processor being electrically connected to the memory, the memory being configured to store instructions and data, the processor being configured to perform the steps of the data processing method of any one of claims 1 to 5.
CN201911205073.3A 2019-11-29 2019-11-29 Data processing method, data processing device, storage medium and electronic equipment Active CN112888024B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911205073.3A CN112888024B (en) 2019-11-29 2019-11-29 Data processing method, data processing device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911205073.3A CN112888024B (en) 2019-11-29 2019-11-29 Data processing method, data processing device, storage medium and electronic equipment

Publications (2)

Publication Number Publication Date
CN112888024A true CN112888024A (en) 2021-06-01
CN112888024B CN112888024B (en) 2023-03-21

Family

ID=76038943

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911205073.3A Active CN112888024B (en) 2019-11-29 2019-11-29 Data processing method, data processing device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN112888024B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113724418A (en) * 2021-08-26 2021-11-30 广州小鹏自动驾驶科技有限公司 Data processing method and device and readable storage medium
CN114726480A (en) * 2022-03-08 2022-07-08 科大讯飞股份有限公司 Data encoding method and related device, electronic equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100111297A1 (en) * 2008-05-02 2010-05-06 Pauker Matthew J Format-preserving cryptographic systems
CN104123364A (en) * 2014-07-21 2014-10-29 上海迈循信息科技有限公司 Method and device for transmitting and receiving data through mobile terminal
WO2014173288A1 (en) * 2013-04-26 2014-10-30 天地融科技股份有限公司 Encryption/decryption device and information processing method and system
CN104184672A (en) * 2014-09-10 2014-12-03 四川九洲电器集团有限责任公司 Method and device of transmitting message
CN107592116A (en) * 2017-09-21 2018-01-16 咪咕文化科技有限公司 Data compression method, device and storage medium
CN110046331A (en) * 2019-03-20 2019-07-23 北京品友互动信息技术股份公司 Data-encoding scheme and device, storage medium, electronic device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100111297A1 (en) * 2008-05-02 2010-05-06 Pauker Matthew J Format-preserving cryptographic systems
WO2014173288A1 (en) * 2013-04-26 2014-10-30 天地融科技股份有限公司 Encryption/decryption device and information processing method and system
CN104123364A (en) * 2014-07-21 2014-10-29 上海迈循信息科技有限公司 Method and device for transmitting and receiving data through mobile terminal
CN104184672A (en) * 2014-09-10 2014-12-03 四川九洲电器集团有限责任公司 Method and device of transmitting message
CN107592116A (en) * 2017-09-21 2018-01-16 咪咕文化科技有限公司 Data compression method, device and storage medium
CN110046331A (en) * 2019-03-20 2019-07-23 北京品友互动信息技术股份公司 Data-encoding scheme and device, storage medium, electronic device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
陈海生等: "一种基于北斗卫星通信的渔业信息编解码方法", 《计算机应用与软件》 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113724418A (en) * 2021-08-26 2021-11-30 广州小鹏自动驾驶科技有限公司 Data processing method and device and readable storage medium
CN113724418B (en) * 2021-08-26 2023-07-04 广州小鹏自动驾驶科技有限公司 Data processing method, device and readable storage medium
CN114726480A (en) * 2022-03-08 2022-07-08 科大讯飞股份有限公司 Data encoding method and related device, electronic equipment and storage medium
CN114726480B (en) * 2022-03-08 2023-07-25 科大讯飞股份有限公司 Data encoding method and related device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN112888024B (en) 2023-03-21

Similar Documents

Publication Publication Date Title
CN106791892B (en) Method, device and system for live broadcasting of wheelhouses
CN107040609B (en) Network request processing method and device
CN105243638B (en) A kind of method and apparatus uploading image
CN104852885B (en) Method, device and system for verifying verification code
CN106973330B (en) Screen live broadcasting method, device and system
CN106528545B (en) Voice information processing method and device
CN104518945B (en) A kind of transmission, the methods, devices and systems of reception social network information
CN104063362A (en) Character string truncation method and device
CN106293738B (en) Expression image updating method and device
CN106775194B (en) Application interface switching method and device
CN110933706A (en) Network communication setting method, device, storage medium and terminal
CN106203228A (en) Two-dimensional code information transmission method, device and equipment
CN108881778B (en) Video output method based on wearable device and wearable device
CN103607377B (en) Information sharing method, Apparatus and system
CN112888024B (en) Data processing method, data processing device, storage medium and electronic equipment
US9508349B2 (en) Method, system, and terminal device for transmitting information
CN108270764B (en) Application login method, server and mobile terminal
CN107995151B (en) Login verification method, device and system
CN105162670B (en) Routing device connection method and device
CN111897916A (en) Voice instruction recognition method and device, terminal equipment and storage medium
CN113542206B (en) Image processing method, device and computer readable storage medium
CN107315623B (en) Method and device for reporting statistical data
CN109003313B (en) Method, device and system for transmitting webpage picture
CN110443088B (en) Graphic code checking method and device, computer equipment and storage medium
CN113411447B (en) Sound channel switching method and electronic equipment

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