Sensor interface processing method and apparatus
A technology of sensor interface and processing method, applied in multi-channel programming device, program control device, electrical digital data processing and other directions, can solve the problems of simple function, poor flexibility, and inability to meet other sensors.
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
example 1
[0092] Example 1: Assume that the sensor needs to be called to realize the vibration function.
[0093] The function is: the phone vibrates (Vibrate) for 1 second, stops for 0.5 seconds, and then vibrates for 2 seconds: (the fourth parameter is an array)
[0094] Executed JavaScript code:
[0095] window.getSensorData("Vibrate", "vibrate", false, [1000,500,2000]);
[0096] The get function means to obtain the data of the vibration sensor.
[0097] The execution flow of this application example is as follows: image 3 shown, including:
[0098] Step 301, the browser executes the JS code, and when the getSensorDataDirect function in the code is executed, the 4 passed parameters ("Vibrate", "vibrate", false, [1000, 500, 2000]) are obtained.
[0099] Step 302 , according to the obtained parameter 1 "Vibrate", look up the parameter comparison table, and find the operation set for acquiring or setting data corresponding to the sensor that Vibrate needs to operate.
[0100] Step...
example 2
[0105] Example 2: Assume that the sensor needs to be called to realize the event of changing the discharge time of the registered power supply and display it: (callback parameter)
[0106] In this example, the charging attribute is used to indicate whether it is currently charging, 0 indicates charging, and 1 indicates discharging. Time represents the charging or discharging time. When charging is 0, time indicates the charging time; when it is 1, time indicates the time required for discharging. ondischargingtimechange indicates an event that is triggered when the battery level changes. showDischargingtime is the function called after the event is triggered, that is, the registered callback function.
[0107] Executed JavaScript code: functionshowDischargingtime(param) / / Realize the event of changing the discharge time of the registered power supply and display it
[0108]
[0109] The execution flow of this application example is as follows: Figure 4 shown, including:...
PUM
Login to View More Abstract
Description
Claims
Application Information
Login to View More 