sensors data get/set from android emulator console

emulator console sensor cmd

模拟器启动后telnet进入模拟器console

telenet 127.0.0.1:5554

help
Android console command help:

    help|h|?         print a list of commands
    event            simulate hardware events
    geo              Geo-location commands
    gsm              GSM related commands
    cdma             CDMA related commands
    kill             kill the emulator instance
    network          manage network settings
    power            power related commands
    quit|exit        quit control session
    redir            manage port redirections
    sms              SMS related commands
    avd              control virtual device execution
    window           manage emulator window
    qemu             QEMU-specific commands
    sensor           manage emulator sensors

try 'help ' for command-specific help
OK


help sensor
allows you to request the emulator sensors

available sub-commands:
   sensor status           list all sensors and their status.
   sensor get              get sensor values
   sensor set              set sensor values

OK


sensor status
acceleration: enabled.
magnetic-field: enabled.
orientation: enabled.
temperature: enabled.
proximity: enabled.
OK



sensor get orientation
orientation = 0:0:0
OK

sensor get magnetic-field
magnetic-field = 0:0:0
OK

sensor get temperature
temperature = 0:0:0
OK

sensor get acceleration
acceleration = 0:9.77622:0.813417
OK

sensor get proximity
proximity = 1:0:0
OK

这里设置的数据,通过《sensors data sent to / requested from android HAL》所说流程传递给Android HAL

sensor data xfer