CN110049003A - The method and device that AT instruction is divided by frame - Google Patents

The method and device that AT instruction is divided by frame Download PDF

Info

Publication number
CN110049003A
CN110049003A CN201910156450.2A CN201910156450A CN110049003A CN 110049003 A CN110049003 A CN 110049003A CN 201910156450 A CN201910156450 A CN 201910156450A CN 110049003 A CN110049003 A CN 110049003A
Authority
CN
China
Prior art keywords
character
frame
state
code
status
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.)
Pending
Application number
CN201910156450.2A
Other languages
Chinese (zh)
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.)
Shanghai Innovation Medical Technology Co Ltd
Original Assignee
Shanghai Innovation Medical 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 Shanghai Innovation Medical Technology Co Ltd filed Critical Shanghai Innovation Medical Technology Co Ltd
Priority to CN201910156450.2A priority Critical patent/CN110049003A/en
Publication of CN110049003A publication Critical patent/CN110049003A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/0001Systems modifying transmission characteristics according to link quality, e.g. power backoff
    • H04L1/0006Systems modifying transmission characteristics according to link quality, e.g. power backoff by adapting the transmission format
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/0001Systems modifying transmission characteristics according to link quality, e.g. power backoff
    • H04L1/0006Systems modifying transmission characteristics according to link quality, e.g. power backoff by adapting the transmission format
    • H04L1/0007Systems modifying transmission characteristics according to link quality, e.g. power backoff by adapting the transmission format by modifying the frame length
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/06Notations for structuring of protocol data, e.g. abstract syntax notation one [ASN.1]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/22Parsing or analysis of headers

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Quality & Reliability (AREA)
  • Computer Security & Cryptography (AREA)
  • Communication Control (AREA)

Abstract

The invention discloses AT instructions by the method and device of frame segmentation, divides the Echo Frame of AT command set, the code of each Echo Frame is made to enter one of N kind state;N is positive integer.Preferably, N can be 6, at this time the code of Echo Frame possibly into state have 6 kinds.This 6 kinds of states may include: original state, preprocessed state 1, preprocessed state 2, content frame collection status, content frame collects completion status, frame collects success status.The present invention carries out abstract analysis by the frame structure to AT command set, state switching is carried out using code of the state machine to Echo Frame, divide the different frame received when receiving data while can be, and the data frame after segmentation is supplied to protocol analysis layer as a whole and carries out protocol analysis, thus effectively shield the data for not meeting frame structure, it avoids it from being transmitted to protocol analysis layer from data link layer, reduces the occupancy of CPU, improve the execution efficiency of code.

Description

The method and device that AT instruction is divided by frame
Technical field
The present invention relates to the method and devices that the technical field of communications protocol more particularly to AT instruction are divided by frame.
Background technique
AT command set is a kind of communications protocol, host by specific communication modes (RS232 UART SPI EathNet) Send slave with the mode of " frame " for the plain code information for describing certain command/parameter, slave does AT command set, carry out parsing and Response.
The slave of the prior art can not shield the invalid data in AT command set, lead to not meet the data of frame structure from number It is transmitted to protocol analysis layer according to link layer, causes the occupancy of CPU high, the execution efficiency of code is low.
Summary of the invention
For overcome the deficiencies in the prior art, the purpose of the present invention is to provide AT instructions by the method and dress of frame segmentation It sets, it is intended to which the slave for solving the prior art can not shield invalid data in AT command set, lead to the data for not meeting frame structure It is transmitted to protocol analysis layer from data link layer, causes the occupancy of CPU high, the low problem of the execution efficiency of code.
The purpose of the present invention is implemented with the following technical solutions:
A kind of method that AT instruction is divided by frame, comprising:
The Echo Frame for dividing AT command set, makes the code of each Echo Frame enter one of N kind state;N is positive integer.
On the basis of the above embodiments, it is preferred that N=6.
On the basis of the above embodiments, it is preferred that N kind state includes: original state, preprocessed state 1, pretreatment shape State 2, content frame collection status, content frame collect completion status, frame collects success status.
On the basis of the above embodiments, it is preferred that the method specifically includes:
Code receive in the initial state r character, then enter preprocessed state 1;
Code received under preprocessed state 1 n character, then enter preprocessed state 2;
Code receives other character under preprocessed state 2, then enters content frame collection status;The other character Including be not belonging to r, n character other ASCII character characters;
Code received under content frame collection status n character or other character, then maintain content frame collection status; Code received under content frame collection status r character, then enter content frame collect completion status;
Code content frame collect completion status under receive n character, then enter frame collect success status;
Code, automatically into preprocessed state 2 is arrived, waits to be received after adjusting back frame analytical function under frame collects success status Next Echo Frame of<STATUS>character or AT command set.
On the basis of the above embodiments, it is preferred that the method also includes:
Code receive in the initial state n character or other character, then maintain original state;
Code received under preprocessed state 1 r character, then maintain preprocessed state 1;Code is under preprocessed state 1 Other character is received, then enters original state;
Code received under preprocessed state 2 r character, then enter preprocessed state 1;Code is under preprocessed state 2 Receive n character, then enter original state;
Code received under content frame collection status n character, then enter original state;
Code content frame collect completion status under receive r character, then enter preprocessed state 1;Code is in content frame It collects and receives other character under completion status, then enter original state.
A kind of device that AT instruction is divided by frame, described device are used for:
The Echo Frame for dividing AT command set, makes the code of each Echo Frame enter one of N kind state;N is positive integer.
On the basis of the above embodiments, it is preferred that N=6.
On the basis of the above embodiments, it is preferred that N kind state includes: original state, preprocessed state 1, pretreatment shape State 2, content frame collection status, content frame collect completion status, frame collects success status.
On the basis of the above embodiments, it is preferred that described device is for executing:
Code receive in the initial state r character, then enter preprocessed state 1;
Code received under preprocessed state 1 n character, then enter preprocessed state 2;
Code receives other character under preprocessed state 2, then enters content frame collection status;The other character Including be not belonging to r, n character other ASCII character characters;
Code received under content frame collection status n character or other character, then maintain content frame collection status; Code received under content frame collection status r character, then enter content frame collect completion status;
Code content frame collect completion status under receive n character, then enter frame collect success status;
Code, automatically into preprocessed state 2 is arrived, waits to be received after adjusting back frame analytical function under frame collects success status Next Echo Frame of<STATUS>character or AT command set.
On the basis of the above embodiments, it is preferred that described device is also used to execute:
Code receive in the initial state n character or other character, then maintain original state;
Code received under preprocessed state 1 r character, then maintain preprocessed state 1;Code is under preprocessed state 1 Other character is received, then enters original state;
Code received under preprocessed state 2 r character, then enter preprocessed state 1;Code is under preprocessed state 2 Receive n character, then enter original state;
Code received under content frame collection status n character, then enter original state;
Code content frame collect completion status under receive r character, then enter preprocessed state 1;Code is in content frame It collects and receives other character under completion status, then enter original state.
Compared with prior art, the beneficial effects of the present invention are:
The invention discloses AT instructions by the method and device of frame segmentation, is abstracted by the frame structure to AT command set Analysis carries out state switching to the code of Echo Frame using state machine, divides while can be when receiving data and to receive Different frame, and the data frame after segmentation is supplied to protocol analysis layer as a whole and carries out protocol analysis, thus effectively The data for not meeting frame structure are shielded, it is avoided to be transmitted to protocol analysis layer from data link layer, reduce the occupancy of CPU Rate improves the execution efficiency of code.
Detailed description of the invention
Present invention will be further explained below with reference to the attached drawings and examples.
Fig. 1 shows a kind of flow diagram of method that AT instruction is divided by frame provided in an embodiment of the present invention.
Specific embodiment
In the following, being described further in conjunction with attached drawing and specific embodiment to the present invention, it should be noted that not Under the premise of conflicting, new implementation can be formed between various embodiments described below or between each technical characteristic in any combination Example.
" frame " structure of AT command set has different definition according to different definition person, but substantially usage is essentially identical.
In the present invention, " frame " structure of AT command set uses following format:
1. command format
AT+<str>\r
A) AT+:AT instruction prefixes;
B)<str>: instruction, parameter character string can be sky and can show character (ASCII character: 0x20~0x7f), but not It can be AT+ character string;
C) r: carriage return end mark, ASCII character: 0x0d;
2. responding format
\r\n<str>\r\n[<STATUS>\r\n]
A) r: carriage return end mark, ASCII character: 0x0d;
B) n: newline, ASCII character: 0x0a;
C)<str>: the instruction of corresponding command format, parameter character string, it cannot You r and n character;
D)<STATUS>: instruction execution state, cannot have r and n character, but can be not present;It is subsequent when it be not present R n be also not present.
Specific embodiment one
The embodiment of the invention provides a kind of AT instructions by the method for frame segmentation, comprising:
The Echo Frame for dividing AT command set, makes the code of each Echo Frame enter one of N kind state;N is positive integer.
Without limitation to N, N can be 6 to the embodiment of the present invention.At this time the code of Echo Frame possibly into state have 6 kinds.
This 6 kinds of states may include: original state, preprocessed state 1, preprocessed state 2, content frame collection status, frame Content collecting completion status, frame collect success status.
As shown in Figure 1, for above-mentioned 6 kinds of states, way of the present invention when dividing Echo Frame can be specifically included following Processing:
Code receive in the initial state r character, then enter preprocessed state 1;
Code received under preprocessed state 1 n character, then enter preprocessed state 2;
Code receives other character under preprocessed state 2, then enters content frame collection status;The other character Including be not belonging to r, n character other ASCII character characters;
Code received under content frame collection status n character or other character, then maintain content frame collection status; Code received under content frame collection status r character, then enter content frame collect completion status;
Code content frame collect completion status under receive n character, then enter frame collect success status;
Code, automatically into preprocessed state 2 is arrived, waits to be received after adjusting back frame analytical function under frame collects success status Next Echo Frame of<STATUS>character or AT command set.
As shown in Figure 1, the method can also include:
Code receive in the initial state n character or other character, then maintain original state;
Code received under preprocessed state 1 r character, then maintain preprocessed state 1;Code is under preprocessed state 1 Other character is received, then enters original state;
Code received under preprocessed state 2 r character, then enter preprocessed state 1;Code is under preprocessed state 2 Receive n character, then enter original state;
Code received under content frame collection status n character, then enter original state;
Code content frame collect completion status under receive r character, then enter preprocessed state 1;Code is in content frame It collects and receives other character under completion status, then enter original state.
The embodiment of the present invention carries out abstract analysis by the frame structure to AT command set, using state machine to the generation of Echo Frame Code carries out state switching, and the minimum unit " frame " that communications protocol is cut in the data link layer for receiving code is supplied to agreement solution Layer is analysed, while masking invalid data;It divides the different frame received when receiving data while the present invention can be, and will divide Data frame after cutting is supplied to protocol analysis layer as a whole and carries out protocol analysis, thus effectively shields and does not meet frame The data of structure avoid it from being transmitted to protocol analysis layer from data link layer, reduce the occupancy of CPU, improve code Execution efficiency.
In above-mentioned specific embodiment one, provides AT and instruct the method divided by frame, corresponding, the application AT instruction is also provided by the device of frame segmentation.Since Installation practice is substantially similar to embodiment of the method, so describing to compare Simply, the relevent part can refer to the partial explaination of embodiments of method.Installation practice described below is only schematical.
Specific embodiment two
The embodiment of the invention provides a kind of AT instructions by the device of frame segmentation, and described device is used for:
The Echo Frame for dividing AT command set, makes the code of each Echo Frame enter one of N kind state;N is positive integer.
In the embodiment of the present invention, N can be 6.
In the embodiment of the present invention, N kind state may include: original state, preprocessed state 1, preprocessed state 2, in frame Hold collection status, content frame collects completion status, frame collects success status.
Described device can be used for executing:
Code receive in the initial state r character, then enter preprocessed state 1;
Code received under preprocessed state 1 n character, then enter preprocessed state 2;
Code receives other character under preprocessed state 2, then enters content frame collection status;The other character Including be not belonging to r, n character other ASCII character characters;
Code received under content frame collection status n character or other character, then maintain content frame collection status; Code received under content frame collection status r character, then enter content frame collect completion status;
Code content frame collect completion status under receive n character, then enter frame collect success status;
Code, automatically into preprocessed state 2 is arrived, waits to be received after adjusting back frame analytical function under frame collects success status Next Echo Frame of<STATUS>character or AT command set.
Described device can be also used for executing:
Code receive in the initial state n character or other character, then maintain original state;
Code received under preprocessed state 1 r character, then maintain preprocessed state 1;Code is under preprocessed state 1 Other character is received, then enters original state;
Code received under preprocessed state 2 r character, then enter preprocessed state 1;Code is under preprocessed state 2 Receive n character, then enter original state;
Code received under content frame collection status n character, then enter original state;
Code content frame collect completion status under receive r character, then enter preprocessed state 1;Code is in content frame It collects and receives other character under completion status, then enter original state.
The embodiment of the present invention carries out abstract analysis by the frame structure to AT command set, using state machine to the generation of Echo Frame Code carries out state switching, and the minimum unit " frame " that communications protocol is cut in the data link layer for receiving code is supplied to agreement solution Layer is analysed, while masking invalid data;It divides the different frame received when receiving data while the present invention can be, and will divide Data frame after cutting is supplied to protocol analysis layer as a whole and carries out protocol analysis, thus effectively shields and does not meet frame The data of structure avoid it from being transmitted to protocol analysis layer from data link layer, reduce the occupancy of CPU, improve code Execution efficiency.
The present invention is from using in purpose, and in efficiency, the viewpoints such as progressive and novelty are illustrated, the practical progress having Property, having met the function that Patent Law is emphasized promotes and uses important document, and more than the present invention explanation and attached drawing are only of the invention Preferred embodiment not limits to the present invention with this, therefore, it is all with the present invention construct, device, the approximations such as feature, thunder With, i.e., all according to equivalent replacement made by present patent application range or modification etc., the patent application that should all belong to of the invention is protected Within the scope of shield.
It should be noted that in the absence of conflict, the feature in embodiment and embodiment in the present invention can phase Mutually combination.Although present invention has been a degree of descriptions, it will be apparent that, in the item for not departing from the spirit and scope of the present invention Under part, the appropriate variation of each condition can be carried out.It is appreciated that the present invention is not limited to the embodiments, and it is attributed to right and wants The range asked comprising the equivalent replacement of each factor.It will be apparent to those skilled in the art that can as described above Various other corresponding changes and deformation are made in technical solution and design, and all these change and deformation is all answered Within this is belonged to the protection scope of the claims of the invention.

Claims (10)

1. a kind of AT instruction is by the method for frame segmentation characterized by comprising
The Echo Frame for dividing AT command set, makes the code of each Echo Frame enter one of N kind state;N is positive integer.
2. AT instruction according to claim 1 is by the method for frame segmentation, which is characterized in that N=6.
3. AT instruction according to claim 2 is by the method for frame segmentation, which is characterized in that N kind state includes: initial shape State, preprocessed state 1, preprocessed state 2, content frame collection status, content frame collect completion status, frame collects success status.
4. AT instruction according to claim 3 is by the method for frame segmentation, which is characterized in that the method specifically includes:
Code receive in the initial state r character, then enter preprocessed state 1;
Code received under preprocessed state 1 n character, then enter preprocessed state 2;
Code receives other character under preprocessed state 2, then enters content frame collection status;The other character includes Be not belonging to r, n character other ASCII character characters;
Code received under content frame collection status n character or other character, then maintain content frame collection status;Code Received under content frame collection status r character, then enter content frame collect completion status;
Code content frame collect completion status under receive n character, then enter frame collect success status;
Code frame collect success status under adjust back frame analytical function after, automatically into arrive preprocessed state 2, wait it is to be received < Next Echo Frame of STATUS > character or AT command set.
5. AT instruction according to claim 4 is by the method for frame segmentation, which is characterized in that the method also includes:
Code receive in the initial state n character or other character, then maintain original state;
Code received under preprocessed state 1 r character, then maintain preprocessed state 1;Code receives under preprocessed state 1 To other character, then enter original state;
Code received under preprocessed state 2 r character, then enter preprocessed state 1;Code receives under preprocessed state 2 To n character, then enter original state;
Code received under content frame collection status n character, then enter original state;
Code content frame collect completion status under receive r character, then enter preprocessed state 1;Code is collected in content frame Other character is received under completion status, then enters original state.
6. a kind of AT instruction is by the device of frame segmentation, which is characterized in that described device is used for:
The Echo Frame for dividing AT command set, makes the code of each Echo Frame enter one of N kind state;N is positive integer.
7. AT instruction according to claim 6 is by the device of frame segmentation, which is characterized in that N=6.
8. AT instruction according to claim 7 is by the device of frame segmentation, which is characterized in that N kind state includes: initial shape State, preprocessed state 1, preprocessed state 2, content frame collection status, content frame collect completion status, frame collects success status.
9. AT instruction according to claim 8 is by the device of frame segmentation, which is characterized in that described device is for executing:
Code receive in the initial state r character, then enter preprocessed state 1;
Code received under preprocessed state 1 n character, then enter preprocessed state 2;
Code receives other character under preprocessed state 2, then enters content frame collection status;The other character includes Be not belonging to r, n character other ASCII character characters;
Code received under content frame collection status n character or other character, then maintain content frame collection status;Code Received under content frame collection status r character, then enter content frame collect completion status;
Code content frame collect completion status under receive n character, then enter frame collect success status;
Code frame collect success status under adjust back frame analytical function after, automatically into arrive preprocessed state 2, wait it is to be received < Next Echo Frame of STATUS > character or AT command set.
10. AT instruction according to claim 9 is by the device of frame segmentation, which is characterized in that described device is also used to execute:
Code receive in the initial state n character or other character, then maintain original state;
Code received under preprocessed state 1 r character, then maintain preprocessed state 1;Code receives under preprocessed state 1 To other character, then enter original state;
Code received under preprocessed state 2 r character, then enter preprocessed state 1;Code receives under preprocessed state 2 To n character, then enter original state;
Code received under content frame collection status n character, then enter original state;
Code content frame collect completion status under receive r character, then enter preprocessed state 1;Code is collected in content frame Other character is received under completion status, then enters original state.
CN201910156450.2A 2019-03-01 2019-03-01 The method and device that AT instruction is divided by frame Pending CN110049003A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910156450.2A CN110049003A (en) 2019-03-01 2019-03-01 The method and device that AT instruction is divided by frame

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910156450.2A CN110049003A (en) 2019-03-01 2019-03-01 The method and device that AT instruction is divided by frame

Publications (1)

Publication Number Publication Date
CN110049003A true CN110049003A (en) 2019-07-23

Family

ID=67274494

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910156450.2A Pending CN110049003A (en) 2019-03-01 2019-03-01 The method and device that AT instruction is divided by frame

Country Status (1)

Country Link
CN (1) CN110049003A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101035372A (en) * 2007-02-15 2007-09-12 重庆重邮信科股份有限公司 Fast matching method of AT instruction identifier
CN101119522A (en) * 2007-08-22 2008-02-06 中兴通讯股份有限公司 Method for simulating AT command report
CN103634163A (en) * 2013-09-27 2014-03-12 国家电网公司 Method for testing interchangeability of remote communication unit of acquisition terminal
CN105279070A (en) * 2015-10-14 2016-01-27 安徽四创电子股份有限公司 Bus communication method for time synchronization device and bus communication device for time synchronization device
CN105760134A (en) * 2016-02-03 2016-07-13 四川九洲电器集团有限责任公司 Data processing method and electronic equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101035372A (en) * 2007-02-15 2007-09-12 重庆重邮信科股份有限公司 Fast matching method of AT instruction identifier
CN101119522A (en) * 2007-08-22 2008-02-06 中兴通讯股份有限公司 Method for simulating AT command report
CN103634163A (en) * 2013-09-27 2014-03-12 国家电网公司 Method for testing interchangeability of remote communication unit of acquisition terminal
CN105279070A (en) * 2015-10-14 2016-01-27 安徽四创电子股份有限公司 Bus communication method for time synchronization device and bus communication device for time synchronization device
CN105760134A (en) * 2016-02-03 2016-07-13 四川九洲电器集团有限责任公司 Data processing method and electronic equipment

Similar Documents

Publication Publication Date Title
CN106878395B (en) A kind of electric car charging monitoring system based on mobile terminal
CN110247967A (en) Intelligent networking gateway and its data intelligence processing method
CN107070589A (en) A kind of electric energy meter adaptive approach, device and electric energy meter based on object-oriented agreement and legacy protocol
CN105812346B (en) A kind of data interactive method of serial equipment and ethernet device
CN110049003A (en) The method and device that AT instruction is divided by frame
CN106412296B (en) Terminal equipment control method and device
WO2005008414A3 (en) Method and apparatus for parallel action processing
CN106357781A (en) Method and system for establishing resource service calling interface
CN114448922A (en) Message grading processing method, device, equipment and storage medium
CN106843808B (en) A kind of instruction analytic method of compatible different-format type
CN105429820B (en) Deep-packet detection system based on software defined network and method
CN104715188B (en) A kind of application implementation method and device based on binding terminal
CN109672728A (en) A kind of large-scale distributed clustered node information fast acquiring method
CN104598428A (en) Data processing system
CN105554732B (en) The synchronous method and terminal and smart card of WLAN data
CN108597253A (en) Air traffic control flow control information extraction method and device
CN111030904B (en) Multi-path CAN bus message real-time processing method under multi-level communication
CN110020265A (en) A kind of the short message URL analysis system and method for big data based on memory
CN103491159A (en) Work order analysis asynchronous calling service method and system
CN205485483U (en) Intelligence servo driver
CN109392153A (en) The method of user equipment and its acquisition beam information, computer-readable medium
CN103546879A (en) SIM (subscriber identity module) data processing method and system
CN203135914U (en) Gateway device based on Web
CN111352671A (en) Virtualization management system of finite state machine
CN211180964U (en) POS machine is handled to mobile business

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
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20190723

WD01 Invention patent application deemed withdrawn after publication