In order to realize the somatosensory operation by using the mature sensor technology of Android mobile device, the somatosensory application system based on Android mobile device sensor is designed. The architecture of the system is versatile and not limited to programs that can be fixed in a PC. The system includes a mobile terminal (Android) program and a middleware platform under the Windows platform. The Android platform device is used as an input device, and data is collected by various sensors, and sent to the middleware platform of the PC through WIFI, after receiving. Customizable to the corresponding operating instructions to control different applications or games in the computer.
1, the overall design of the systemThe system adopts the client/server (C/S) architecture, and uses the PC or the computing device with strong running capacity as the server to communicate with the Android mobile phone and issue command operations. Android mobile phone as a client, through a friendly user interface, guide users to select the appropriate sensor type (currently including multiple sensors in the smart phone), such as setting the type of user operation is dynamic (acceleration application) or competitive (support Application of force).
1.1, communication between the server and the Android phoneThe main problems that need to be solved between the communication between the server and the Android mobile phone are: the stability and efficiency of data transmission, the identification method of the user operation mode and the user's action quantization method.
1.1.1, data transmission
In the system, the server and the client use Socket to communicate through the User Datagram (UDP) protocol, and the transmission speed is fast and there is no delay. Although the UDP protocol has the problem that datagrams are easily lost and cannot guarantee that each datagram is transmitted accurately, the data generated by the user's actions is continuous for the operation of the motion sense, even if some of the datagrams are lost, the user experience is also lost. Nothing serious. For example, to control the car to turn left, the user action must have a range, in this range, in fact, has sent a lot of left-left datagrams, losing one or two datagrams has little effect on the user experience.
There are two datagram classes in Java: DatagramSocket (class for end-to-end communication) and DatagramPacket (datagram class for communication data). Clients A and B in the program can send and receive DatagramPackets by calling DatagramSocket, as shown in Figure 1. Shown.
Figure 1 UDP communication mode
1.1.2, user operation pattern recognition
On the basis of determining the mobile communication transmission protocol, the multi-touch function and the sensor function of the mobile device need to be integrated into the powerful computing function of the server, that is, the integration of the information space and the physical space is realized, so the instruction issued by the mobile device needs to be changed. An operation that the server can recognize.
The premise of identification is that the user needs to guide the mode of operation, such as using a touch screen or a sensor, and the Android sensor includes various sensors such as illumination, temperature, acceleration, pressure, gravity, geomagnetism, etc., so when the state mode of the Android mobile body sense is changed, The PC client should be notified for identification so that the correct operation mapping can be performed.
The message format sent by the notification status change in the system is: state+n. Where state is a fixed string and n is a contracted number. The state change class StateChangedInformer inherits the base class Transmission and sends a status message to the PC.
Commonly used user operations belong to different modes of application, such as the handle mode belongs to the multi-touch screen mode application, while the slide (PPT), racing, etc. control applications belonging to the sensor mode.
1.1.3, motion data quantification
The user needs to implement double-clicking, long-pressing, and arcing on the screen (circle style as shown on the left side of Figure 2). These user operations must be quantized into digital signals to be processed. The button of the handle has two states of pressing and popping, defining the corresponding number of the number and the keyboard, encapsulating the sending method thereof, and realizing the remote control function on the basis of the existing data transmission.
Figure 2 user interface
51V Battery Pack,Portable Battery Box,Portable Battery Bank,Ac Battery Pack
Zhejiang Casnovo Materials Co., Ltd. , https://www.casnovo-new-energy.com