Summary of Serial Communication Knowledge in mobile development and summary of Serial Communication Knowledge

Source: Internet
Author: User

Summary of Serial Communication Knowledge in mobile development and summary of Serial Communication Knowledge

Summary of mobile development Serial Communication Knowledge the original APP only displays append in the text box when it receives serial data. There are no other functions. Very helpless, many things need to be explored by themselves, for example, the 115200 baud rate in communication, generally 7200 characters of information can be transmitted per second (the communication efficiency is assumed to be 50% ), the baud rate of the transmitting and receiving modules must be set to the same, so that garbled characters are not received.

Serial Communication will definitely cause information loss. This factor must be taken into account when designing an APP. In the APP, I added the functions of saving text, running in the background, and clearing after receiving.

How does the receiving module Save the received data? initially, it uses a sub-thread to receive data, convert it into string data, and then sends it to handler for processing through asynchronous message processing mechanism. Later, it uses bundle to transmit information, because more than one information needs to be transmitted, use msg Only. obj: only one message can be transmitted. Even if you forcibly define a public class, two member variables are assigned to it to pass the required information through the new public class method. Although the obj type can be transformed up, then use msg. obj is transferred out, and in handler, the information is re-restored through the downward transformation, which is syntactically fluent. However, in actual operation, the APP will be stuck and I don't know what's going on.

The best way is to use new bundler to transmit information. This can be executed smoothly in actual operations. How can I determine that the receiving data is stopped? I used the counter method to solve the problem. I defined a common type of count variable at the beginning of the program. Every time I read an empty string, I added one variable. When the variable was increased to 20, then you can start the clear operation. The whole process took me two months. First, I spent a month watching videos on java basics and android syntax, And then I practiced for half a month. Every time I tried to find a new method and a new method, then make mistakes, make mistakes, and then make mistakes during verification. After a lot of despair, the final result is barely acceptable, because the final solution is a comprehensive synthesis of my previous mistakes, my biggest experience is that I don't have to work hard. I have to ask more experts around me. Sometimes I can't get through the Internet for a long time, and others will solve it all at once. After all, you are not the first person to encounter this problem (especially when you are a newbie ). However, you must have your own ideas and knowledge points that can be answered by others. However, the completion of project functions depends on yourself, and on your own project problems, others generally do not think hard.

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.