Cable test, mobile Terminal program description

Source: Internet
Author: User

Overall Features:

1. The mobile app connects to the test device via Bluetooth.

2. Sends a 48-byte hexadecimal number via Bluetooth.

3. Receive 48-byte hexadecimal numbers via Bluetooth.

4. Parses a 48-byte hexadecimal number to generate a text file.

5. Administration of text files.

48-byte hexadecimal number

Format:

Number of bytes: variable length, test data bytes plus 8.

Three parts: header, data, tail

0XDD,0XDD,0XDD,

0x**,

0x00,

0xfe,0xff,0xff,0xff,

..................

0x55,0x55,0x55

Send:

0XDD,0XDD,0XDD,

0X30,

0x00,

0xff,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,

0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,

0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,

0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,

0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,

0x55,0x55,0x55

Only the specified one in the data area is 0.

Receive:

0XDD,0XDD,0XDD,

0X30,

0X09,

0xff,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,

0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,

0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,

0xff,0xff,0xff,0xff,0xff,0xff,0xfc,0xff,

0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,

0x55,0x55,0x55

The received data is 0 by a number of bits.

Send partial structure:

The subscript is the line order, and the byte content is divided into two parts.

The value of the first byte represents the offset of the byte in which the line is located, and 1 in the second byte represents the bit where the line is located.

unsigned char code indexline[30][2]=

{

2,2,//p2.1

2,4,//p2.2

2,1,//p2.0

2,8,//p2.3

3,128,//p3.7

2,16,//p2.4

3,64,//p3.6

2,32,//p2.5

3,32,//p3.5

2,64,//p2.6

3,16,//p3.4

2,128,//p2.7

3,8,//p3.3

3,4,//p3.2

1,128,//p1.7

0,128,//p0.7

1,64,//p1.6

0,64,//p0.6

1,32,//p1.5

0,32,//p0.5

1,16,//p1.4

0,16,//p0.4

1,8,//p1.3

0,8,//p0.3

1,4,//p1.2

0,4,//p0.2

//p1.1.

0,2,//p0.1

//p1.0,

0,1//p0.0

};

The current design of the wiring harness is in accordance with 30 lines a group, occupies 4 bytes. Data area total 40 bytes, maximum number of lines (digits) 300.

In the data area where the data is sent, send and receive in turn ... 100 ... The detection signal. Determine the corresponding data according to the number before sending.

Cases:

First send the test data of number 1, first determine the first 30-line group. Again from Indexline[30][2] The first line array is labeled as 0, the corresponding element is: "2, 2,". Description is the byte offset in the first 30-wire group is 2, the bit offset is 2, and this bit is 0.

0XDD,0XDD,0XDD,

0X30,

0x00,

0xff,0xfb,0xff,0xff,//0XFD, 1111 1011

0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,

0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,

0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,

0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,

0xff,0xff,0xff,0xff,

0x55,0x55,0x55

Cases:

The first one to send the test data for number 56 is to determine the 2nd (56/20) 30-wire group first. From Indexline[30][2], the 26th (56%30) line array is labeled as 25, the corresponding element is: "1, 4,". Description is the byte offset in the 2nd 30-wire Group is 1, the bit offset is 4, and this bit is 0.

0XDD,0XDD,0XDD,

0X30,

0x00,

0XFF, 0xff,0xff,0xff,0xff,0xef,0xff,0xff,//0xef, 1110 1111

0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,

0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,

0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,

0x55,0x55,0x55

Cases:

The following data is received:

0XDD,0XDD,0XDD,

0X30,

0X09,

0xff,0xfe,0xff,0xff,//1-----30 29

0XFF,0XFF,0XFF,0XFF,//31---60

0XFF,0XFF,0X7F,0XFF,//61---90

0XFF,0XFF,0XFF,0XFF,//91---120

0xff,0xff,0xff,0xff,//121

0xff,0xff,0xff,0xff,//151

0xff,0xff,0xff,0xff,//181

0xff,0xff,0xfc,0xff,//211

0xff,0xff,0xff,0xff,

0xff,0xff,0xff,0xff,

0x55,0x55,0x55

The received data is 0 by a number of bits.

The 10th byte of the data area, the offset in this group is 2, 0111 1111, the highest, and the offset is 7.

10th byte 8th bit.

The description is in the 3rd 30-wire Group. Tabular learned that in this group, the 12th line, the entire alignment of the midline sequence number is 72.

The second one contains 0 of the data 0xfc–〉1111 1100. Line 211,213 respectively.

The data received in this time, the digit corresponding to 0 detected is: 29,211,213.

Save the text "29,211,213." In the text.

Cable test, mobile Terminal program description

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.