From: http://hi.baidu.com/jasonzang1982/blog/item/060b0b3b5ad073f9b211c79d.html
Te: Terminal Equipment
MS: Mobile Station
Allows a number of simultaneous sessions over a normal Serial Asynchronous interface.
1. Te sends at + cmux = 0 to notify ms to enter MUX mode through physical channels;
2. Ms response OK indicates consent;
3. Te sends samb0, 1, 2, 3 in sequence, and creates a value ranging from 0 ~ 3 logical channel;
4. Ms responded to UA and agreed;
5. Te sends the command uih (1, "At/R/N") on channel 1 ");
6. Ms also responds to uih (1, "OK/R/N") on channel 1 ").
0710 six packages are defined in total (excluding error recover Mode)
1. Set asynchronous balanced mode (sabm) -- establish a logical channel;
2. Command disconnect (disc) command-cancel the logical channel;
3. unnumbered acknowledgement (UA) response-establish a channel for response;
4. Disconnected mode (DM) response-response to cancel the logical channel;
5. unnumbered information with header check (uih );
6. unnumbered information (UI ).
0710 three modes are supported: basic, advanced, and advance with error recovery.
Basic: flag (1 byte) adderss (1 byte) Control (1 byte) length (1 ~ 2 byte) Info (length specifies the length, variable) FCS (1 byte) flag (1 byte ).
Flag is fixed to 0xf9;
Adderss logical channel number, similar to MAC address. bit1 is E/A, bit2 is C/R, bit3 ~ 8 is the logical channel number. E/
1 indicates whether the current byte is the last byte of the item. Here, it can only be 1; C/R indicates whether the command sender is the channel initiator, and 1
For example, if the Logical Channel 1 established by te sends a command package to the channel, the adderss value is 0x7, and the ms response adderss value is also 0x7;
Control is the package type mentioned above, where bit5 is P/F, which can be roughly understood as follows: Samb, disc package and its response time, P/F is 1 (when the response is DM, this bit can be 0 or 1 );
Length is the length of info items, and bit is defined as E/A, L1, L2 ,..., l7, (l8 ,..., l15). When the length is less than 128, E/A is 1, and the info class of the second byte is not encoded depends on the domain package type;
The difference between the check code, uih, and UI package is here. uih does not encode the info item, but only adderss, control, and length.
The advanced mode package is in the format of flag (1 byte) adderss (1 byte) Control (1 byte) Info (not long) FCS (1 byte) flag (1 byte)
The flag is fixed to 0x7e;
The difference between the two modes is that the advanced mode does not have a length, but adopts a specific format encoding to determine when the package ends. The sender encodes other items except the flag and encounters 0x7e, 0x7d and other characters are inserted before it, and the receiver removes the corresponding 0x7d. in this case, a separate 0x7e indicates the end and start of the package.