Design and Implementation of IM Software on Smart Phone Terminal

After hundreds of years of development, the phone has been the earliest simple answering and dialing device, becoming a smart phone terminal that integrates many functions such as voice recording, automatic answering, personal information management and dial-up Internet access. The smart phone terminal enables people to process various kinds of information in a more efficient and timely manner to meet the evolving informationization requirements.
IM (Instant Messaging) software is instant messaging software, which is currently the popular killer application on the network, such as Tencent's QQ, Microsoft's MSN, AOL's AIM and ICQ. No matter where you use the device (such as PC, mobile phone, PDA, Web TV, etc.), you can connect to the Internet and send real-time messages and files to other users, even voice and video. By dial-up access to the Internet, basic network functions such as browsers, emails, etc. can be implemented on the prototype of the smartphone terminal. If the client software of IM can be implemented on the smart phone terminal, the user can conduct real-time conversation by telephone, thereby further improving the network function, thereby enhancing the competitiveness of the product in the market.
1 IM software design
1.1 Hardware Platform
The prototype of the smart phone terminal runs on the embedded development board based on the ARM920T core processor S3C2410. The development board is suitable for developing all kinds of high-end handheld, small terminals and various network applications due to its excellent performance and high cost performance. Its standard operating frequency is 203MHz, the FlashROM and SDRAM on the core board are both 64MB, and it supports 1024*768 liquid crystal display, with USB keyboard and mouse, can run embedded Linux operating system. In order to reduce the cost of the whole system, the development board was transformed into a product with 32MB of FlashROM and 32MB of SDRAM during the design process, and it was equipped with a 320*240 liquid crystal display supporting 16-step gray scale.
1.2 Functional design of IM software
In recent years, there have been a lot of popular instant messaging software, and the functions they provide are similar. The fundamental difference between these client softwares is that the communication process between the client and the server is based on different instant messaging protocols. Generally, each instant messaging software has basic functions such as account management, contact management, and instant messaging. On this basis, there are different features, such as voice chat, video chat, and expression management.
Among the many instant messaging software, MSN is one of the most popular software, and its universality and complete functional features have been widely recognized by users. MSN client software developed by third parties has been developed on many platforms. People have already conducted in-depth research and detailed analysis on its protocol content, which has great reference value for developers and can greatly shorten the development cycle. This article describes how to implement some of the basic features of the MSN client, including user login, contact management, and instant messaging and display.
1.3 MSN Protocol and Its Model The MSN protocol is an application layer protocol that uses the C/S model, and its commands are in character form. The client application must send a request to the server within the specified time in the order specified by the protocol, receive the response message, and realize the communication between the server and the client through this mechanism. Since the client software does not always interact with a single server, the MSN protocol requires its clients to establish connections with different servers at different stages and transmit corresponding account or data information. Therefore, it is necessary to first understand the type and role of the MSN server.
The MSN server is divided into two types: Notification Server (NS) and Switch Board Server (SBS). The former is responsible for the user's login and authentication work, including the addition, deletion, modification and status of the contact list, all of which are transmitted through the NS; the latter is used to provide instant communication services, ie the sending and receiving of user chat messages and the transmission of files, etc. It is all implemented by SBS. The communication model of MSN is shown in Figure 1. When the client logs in, it first establishes a connection with the NS, encrypts the user account and password information, and sends it to the NS, and then the NS performs identity verification. If the verification is passed, the NS sends the cookie token of the user to the SBS, and the contact list of the user and the corresponding status information are sent to the client for display by the client software. When the user starts a chat session with the contact, the client establishes a connection with the SBS, and the cookie token obtained from the NS is handed over to the SBS, and the SBS verifies the validity of the cookie token. After the verification is passed, the client can send and receive. Instant messaging and files. Finally, after the user exits the session, the connection with the SBS is closed. At this time, only the connection with the NS exists. The dotted line in the figure indicates the communication process of NS and SBS. Since this process is transparent to the client, it can be considered a black box without concern.

This article refers to the address: http://

1.4 IM software system structure
The system is mainly composed of display interface, login module, contact management and instant messaging.
(1) Display interface interface design can be divided into two parts: login interface and main interface. The login interface provides input for user accounts and passwords. The main interface consists of a menu bar and three windows. In the user status menu, the user can select six states: online, away, busy, etc.; the contact menu implements the addition, deletion, modification, etc. of the contact. The three windows are the contact list window, the message sending window, and the session window. The contact list window lists the nicknames of all contacts and their status information; the message sending window is used to input the content to be sent; the session window displays the message sent by the user and the response message of the other party in order.
(2) The login module establishes a connection with the NS server, transmits the encrypted user account and password information, receives the response information returned by the NS, and extracts the address of the SBS server and the cookie token used to log in to the server from the response information. .
(3) Contact management provides functions such as adding, deleting, and modifying contacts. In MSN, for easy management, contacts can be divided into different queues, such as friends, family members, and business partners. When a new contact is added, the user should be prompted to select the queue to be added, and the contact that has been added and deleted will be directly restored to the original queue. The deletion of contacts is divided into two cases: blocking contacts and completely deleting them. Blocking a contact means putting it in a blocking queue so that the contact cannot see the user's status and can't send an instant message to the user; and deleting the contact completely deletes all information about the contact.
(4) Instant messaging transceiver module Responsible for sending and receiving instant messages. When the user wants to initiate a session with a contact, first create a connection with the SBS server and give the cookie token to it for verification. After the verification is passed, the Socket interface can be called to send information to the SBS server, and the message received from the server is displayed in the session window.
2 IM software implementation steps and key technologies
2.1 Development platform selection
The Linux operating system has become the platform of choice for embedded application development because of its excellent features such as open source, easy customization and extension, multi-hardware platform support and built-in network functions. Therefore, this paper uses a customized embedded Linux system [1].
In addition, this article chose the Qt-Embeded development tool, which is a C++ development package for GUI and application launched by the famous Qt library developer Trolltech for embedded Linux systems. Qt-Embeded has better portability and supports multiple CPU architectures such as ARM, PowerPC, MIPS and Dragonball. At the same time, QMake, QVFB, Qt Designer and many other powerful development support tools support, greatly improving the development efficiency of Qt-Embeded system. Qt Designer is a development support tool for designing and implementing user interfaces and running on multiple platforms to simplify the design of user interfaces. QVFB, the virtual frame buffering technology, is a tool for running and testing embedded applications on a PC.
2.2 IM open source selection
It takes a certain amount of time to implement a complete MSN client software from the ground up. In order to shorten the development cycle and save development costs, this paper adopts the open source project method, which is based on the third-party MSN client software to make it meet the requirements. Another reason for this is that the protocol format of MSN can be further analyzed from these open source software. Even if the MSN protocol has a new version, as long as the software is still available, the new protocol format level used by it will still be adjusted for development. There is an important reference value, which can be used to re-adjust the software without having to analyze the MSN protocol by reverse engineering.
There are many IM client software that support MSN protocol. You must choose an open source system suitable for tailoring and Linux-based. Gaim and Kmess are good choices. Gaim is an instant messaging software designed for the Linux operating system. It can support multiple client communications such as MSN, ICQ, AIM and Yohoo, but its software structure is more complicated. Kmess is also a Linux-based open source system that supports only MSN clients. From a developer's perspective, Kmess is easier to analyze and improve because of its relatively simple structure. So here I chose Kmess as the development blueprint for MSN client software.
2.3 IM open source modification
Although Kmess is an instant messaging software that supports MSN clients based on the Linux platform, it is not directly portable, and a lot of modifications must be made. First of all, Kmess is an application developed based on the KDE environment. The KDE library functions are used extensively in the source code. The KDE library itself has hundreds of megabytes. Due to the limitation of the storage capacity of the prototype, it is impossible to implement the KDE environment on the prototype. Secondly, Kmess is a full-featured MSN client that includes many enhancements such as file transfer, multi-party chat, voice chat, and video chat. Since the current smart phone terminal does not consider implementing these functions, the source code is modified. Tailoring is essential.
In response to the above two problems, the Kmess software has been greatly adjusted, mainly retaining the content related to the MSN protocol processing. The specific adjustments are as follows:
(1) Redesigning the interface part Since the user interface in Kmess is based on the KDE environment, and the prototype is Qt-Embeded, the interface part is basically not used. This article redesigned the login window, main menu, and contacts with Qt designer. Windows, session windows, etc., call Kmess functions in these interfaces.
(2) Replacement of KDE library functions The KDE-based library functions in the source code are implemented using the class functions provided by Qt-Embeded. Since Qt-Embeded has good support for the implementation of some basic functions, it is not difficult to find their corresponding implementation methods. The only exception is the implementation of SSL.
(3) Trimming part of the source code to analyze the source structure of Kmess, delete the functional parts that do not need to be implemented, and build the architecture that you need. Because of the close relationship between the modules of Kmess, it is not a simple way to eliminate the class functions that implement these enhancements. First of all, we must clarify the hierarchy of Kmess and the relationship between modules and modules. Only after a clear understanding of the overall structure can we begin the tailoring work.
2.4 IM network security implementation
During the login process, the user must send an account and password to the NS server to pass the verification. Only the legitimate registered user can use the instant messaging function, so the user account and password must be encrypted. The MSN client uses SSL (Secure Socket Layer) technology to ensure the security of account information. SSL, the Secure Sockets Layer, is a thin layer between the application layer and the TCP layer. The two parties using the SSL protocol can negotiate the encryption algorithm and the encryption key on an insecure common channel, and encrypt the data of the application layer into ciphertext using the negotiated algorithm and key, and then transmit it on the network. In this way, even if the third party intercepts the ciphertext, since there is no decryption algorithm and key, the plaintext data cannot be decrypted, thereby ensuring the security of the network data.
2.5 Application Migration
Since it is quite difficult to develop and debug an application on a prototype, it is necessary to perform simulation development on the PC before downloading it to the prototype.
(1) Communication between the PC and the prototype The PC exchanges data with the prototype through the serial port. In Linux, the serial device files are usually /dev/ttyS0 and /dev/ttyS1, which represent serial 1 and serial 2. First open the serial port with the open command, then configure the serial port according to the specific application, set the baud rate, calibration method, data bit, stop bit and flow control parameters. After the setting is completed, the MINICOM serial communication program can be used to complete the download of the application and upload of the debugging result between the PC and the prototype.
(2) cross-compilation of the application The whole development process is divided into two phases: In the first phase, the developer uses Qt-Embeded for application development in the PC environment, and generates object code that can be executed on the PC through the gcc compiler. Then use QVFB to simulate the running effect of the prototype, after constant adjustment until the user's requirements are met; in the second stage, according to the different CPU architecture, the application implemented on the PC is adjusted accordingly, then use arm-Linux- Gcc re-compiles the program into code that can be executed on the prototype, and finally downloads the code into the Flash of the prototype to complete the development of instant messaging software on the prototype. Since QVFB has been used to simulate the operation of the software on the PC, downloading to the prototype can basically ensure the correctness of the software, thus greatly improving the development efficiency.
(3) Cross-compilation of the OpenSSL library The OpenSSL library is called as the target code, so the porting of the OpenSSL library is also required. First, the OpenSSL library needs to be cross-compiled on the PC to generate the binary files used on the target platform and then loaded into the target platform. In order to enable the OpenSSL library to run on the ARM embedded platform, first add a patch called "opensslForARM.Makefile.patch" to the OpenSSL Makefile, and then compile the executable code with arm-Linux-gcc.
(4) Registration of OpenSSL library After cross-compilation of OpenSSL, MINICOM is used to download it to the prototype, but the OpenSSL library function cannot be used normally. This is because only registered libraries in Linux can be shared dynamic link libraries. The shared library under Linux uses a cache-like mechanism to store the directory information of the shared library first in /etc/ld.so.cache. The application needs to find it in this file when it needs to connect. If it can't find it, go to the path of ld.so.conf and look it up. The dynamic link library management command ldconfig searches for a shareable dynamic link library in the default directories (/lib and /usr/lib) and the directories listed in the dynamic library configuration file /etc/ld.so.conf. Create the connection and cache files needed by the dynamic loader (ld.so) and place the sorted list of dynamic link library names in the default file /etc/ld.so.cache. The user first downloads ldconfig to the prototype, then specifies the path to OpenSSL in the ld.so.conf file, and the ldconfig command automatically completes the entire registration process.
3 Conclusion
To construct the MSN client software on the smart phone terminal, first consider the characteristics of the target platform and the limited resources, choose to implement the most basic and most commonly used functions; then, with the existing open source results, choose a suitable open source. The project, and adjust and debug its interface part and related library functions to meet the running requirements of the target platform; finally, the executable code on the target platform is generated by cross-compilation method and downloaded to the smart phone terminal. Making full use of the existing open source results can not only greatly simplify the analysis and implementation process of the MSN-specific protocol, but also further reduce the software development cost, shorten the software development cycle, and make the smart phone terminal have better cost performance.

Gear Reducer Motor

Gear Reducer Motor is a small precision reducer, and the size and specification can be customized below 38mm. Shenzhen shun cheong electrical co., LTD. 15 years engaged in the design, development, manufacture Dc Gear Motor, products applicable to the smart home, widely used in intelligent robot voice interaction, children's education escort robot, intelligent sweeping machine robot, intelligent robot adaptability, independent motor, intelligent medical robot project.


20GA180 Gear Reducer Motor 25GA370 Gear Reducer Motor

Application field:

Gear Reducer MotorGear Reducer MotorGear Reducer Motor



Method of use: the best stable in horizontal plane, installed on the gear reducer motor output shaft parts, cannot use a hammer to knock,knock prone to press into the gear reducer motor drive, may cause damage to internal components, and cannot be used in the case of blocked.


Gear Motor0

Operating temperature range:

Gear reducer motor should be used at a temperature of -10~60℃.

The figures stated in the catalog specifications are based on use at ordinary room temperature catalog specifications re based on use at ordinary room temperature (approximately20~25℃.

If a geared motor is used outside the prescribed temperature range,the grease on the gearhead area will become unable to function normally and the motor will become unable to start.Depending on the temperature conditions ,it may be possible to deal with them by changing the grease of the motor's parts.Please feel free to consult with us about this.

Storage temperature range:

Gear reducer motor should be stored ta a temperature of -15~65℃.

In case of storage outside this range,the grease on the gearhead area will become unable to function normally and the motor will become unable to start.

Service life:

The longevity of gear reducer motor is greatly affected by the load conditions , the mode of operation,the environment of use ,etc.Therefore,it is necessary to check the conditions under which the product will actually be used .The following conditions will have a negative effect on longevity.Please consult with us should any of them apply.

●Use with a load that exceeds the rated torque

●Frequent starting

●Momentary reversals of turning direction

●Impact loads

●Long-term continuous operation

●Forced turning using the output shaft

●Use in which the permitted overhang load or the permitted thrust load is exceeded

●A pulse drive ,e.g.,a short break,counter electromotive force,PWM control

●Use of a voltage that is nonstandard as regards the rated voltage

●Use outside the prescribed temperature or relative-humidity range,or in a special environment.

●Please consult with us about these or any other conditions of use that may apply,so that we can be sure that you select the most appropriate model.

when it come to volume production,we're a major player as well .each month,we rurn out 600000 units,all of which are compliant with the rohs directive.Have any questions or special needed, please contact us, we have the engineer group and best sales department to service to you Looking forward to your inquiry. Welcome to our factory.

gear reducer motor

Gear Reducer Motor,Reducer Motor,Gear Reducer Stepper Motor,Dc Reducer Gear Motor

Shenzhen Shunchang Motor Co., LTD. , https://www.scgearmotor.com