carpower

车载android 电源管理 车载音响电源管理器_definitely的技术博客_51CTO博客

03-06 13:49:51.577036  1792  1792 I wm_on_top_resumed_gained_called: [42747891,com.android.car.settings.FallbackHome,topWhenResuming]
--------- switch to system
03-06 13:49:51.577063  1691  1747 D ICarImpl: initBootUser(): 
--------- switch to events
03-06 13:49:51.577219  1691  1747 I car_service_on_user_lifecycle: [1,-10000,0]
--------- switch to system
03-06 13:49:51.577448  1691  2012 I CAR.POWER: Received AP_POWER_STATE_REQ=ON(0) param=0
--------- switch to events
03-06 13:49:51.577581  1691  2012 I car_pwr_mgr_state_req: [0,0]

--------- switch to system
02-29 12:42:01.854359  1697  1982 I CAR.POWER: Received AP_POWER_STATE_REQ=ABANDONED(10) param=0
--------- switch to events
02-29 12:42:01.854502  1697  1982 I car_pwr_mgr_state_req: [10,0]

packages/services/Car/service/src/com/android/car/hal/PowerHalService.java

hardware/interfaces/automotive/vehicle/2.0/types.hal


    /**
     * Property to control power state of application processor
     *
     * It is assumed that AP's power state is controlled by a separate power
     * controller.
     *
     * For configuration information, VehiclePropConfig.configArray can have bit flag combining
     * values in VehicleApPowerStateConfigFlag.
     *
     *   int32Values[0] : VehicleApPowerStateReq enum value
     *   int32Values[1] : additional parameter relevant for each state,
     *                    0 if not used.
     *
     * @change_mode VehiclePropertyChangeMode:ON_CHANGE
     * @access VehiclePropertyAccess:READ
     */
    AP_POWER_STATE_REQ = (
        0x0A00
        | VehiclePropertyGroup:SYSTEM
        | VehiclePropertyType:INT32_VEC
        | VehicleArea:GLOBAL),


enum VehicleApPowerStateReq : int32_t {
    /**
     * This requests Android to enter its normal operating state.
     * This may be sent after the AP has reported
     * VehicleApPowerStateReport#DEEP_SLEEP_EXIT,
     * VehicleApPowerStateReport#SHUTDOWN_CANCELLED, or
     * VehicleApPowerStateReport#WAIT_FOR_VHAL.
     */
    ON = 0,

    /**
     * The power controller issues this request to shutdown the system.
     * This may be sent after the AP has reported
     * VehicleApPowerStateReport#DEEP_SLEEP_EXIT,
     * VehicleApPowerStateReport#ON,
     * VehicleApPowerStateReport#SHUTDOWN_CANCELLED,
     * VehicleApPowerStateReport#SHUTDOWN_POSTPONE,
     * VehicleApPowerStateReport#SHUTDOWN_PREPARE, or
     * VehicleApPowerStateReport#WAIT_FOR_VHAL.
     *
     * int32Values[1] : One of VehicleApPowerStateShutdownParam.
     *                  This parameter indicates if the AP should shut
     *                  down fully or sleep. This parameter also
     *                  indicates if the shutdown should be immediate
     *                  or if it can be postponed. If the shutdown can
     *                  be postponed, AP requests postponing by sending
     *                  VehicleApPowerStateReport#SHUTDOWN_POSTPONE.
     */
    SHUTDOWN_PREPARE = 1,

    /**
     * Cancel the shutdown.
     * This may be sent after the AP has reported
     * VehicleApPowerStateReport#SHUTDOWN_POSTPONE or
     * VehicleApPowerStateReport#SHUTDOWN_PREPARE.
     * After receiving this request, the AP will report
     * VehicleApPowerStateReport#WAIT_FOR_VHAL in preparation to going ON.
     */
    CANCEL_SHUTDOWN = 2,
                                    


    /**
     * Completes the shutdown process.
     * This may be sent after the AP has reported
     * VehicleApPowerStateReport#DEEP_SLEEP_ENTRY or
     * VehicleApPowerStateReport#SHUTDOWN_START. The AP will not report new
     * state information after receiving this request.
     */
    FINISHED = 3,

    STANDBY = 4,

    SCREEN_SAVER = 5,

    TEMPORARY_WORKING = 6,

    REMOTE_BOOT = 7,

    OVER_VOLTAGE = 8,

    LOW_VOLTAGE = 9,

    ABANDONED = 0xa,

    PLAYING_BOOTANIMATION = 11,

    OTA = 0xc,
};

   /**
     * Property to report power state of application processor
     *
     * It is assumed that AP's power state is controller by separate power
     * controller.
     *
     *   int32Values[0] : VehicleApPowerStateReport enum value
     *   int32Values[1] : Time in ms to wake up, if necessary.  Otherwise 0.

     *
     * @change_mode VehiclePropertyChangeMode:ON_CHANGE
     * @access VehiclePropertyAccess:READ_WRITE
     */
    AP_POWER_STATE_REPORT = (
        0x0A01
        | VehiclePropertyGroup:SYSTEM
        | VehiclePropertyType:INT32_VEC
        | VehicleArea:GLOBAL),

enum VehicleApPowerStateReport : int32_t {
    /**
     * The device has booted. CarService has initialized and is ready to accept commands
     * from VHAL. The user is not logged in, and vendor apps and services are expected to
     * control the display and audio.
     * After reporting this state, AP will accept VehicleApPowerStateReq#ON or
     * VehicleApPowerStateReq#SHUTDOWN_PREPARE. Other power state requests are ignored.
     */
    WAIT_FOR_VHAL = 0x1,

    /**
     * AP is ready to suspend.
     * The AP will not send any more state reports after this.
     * After reporting this state, AP will accept VehicleApPowerStateReq#FINISHED.
     * Other power state requests are ignored.
     *
     * int32Values[1]: Time to turn AP back on, in seconds. Power controller should turn on
     *                 AP after the specified time has elapsed, so AP can run tasks like
     *                 update. If this value is 0, no wake up is requested. The power
     *                 controller may not necessarily support timed wake-up.
     */
    DEEP_SLEEP_ENTRY = 0x2,

    /**
     * AP is exiting from deep sleep state.
     * After reporting this state, AP will accept VehicleApPowerStateReq#ON or
     * VehicleApPowerStateReq#SHUTDOWN_PREPARE. Other power state requests are ignored.
     */
    DEEP_SLEEP_EXIT = 0x3,


    /**
     * AP sends this message repeatedly while cleanup and idle tasks execute.
     * After reporting this state, AP will accept VehicleApPowerStateReq#SHUTDOWN_PREPARE
     * requesting immediate shutdown or VehicleApPowerStateReq#CANCEL_SHUTDOWN. Other
     * power state requests are ignored.
     *
     * int32Values[1]: Time to postpone shutdown in ms. Maximum value is
     *                 5000 ms.
     *                 If AP needs more time, it will send another SHUTDOWN_POSTPONE
     *                 message before the previous one expires.
     */
    SHUTDOWN_POSTPONE = 0x4,

    /**
     * AP is ready to shutdown.
     * The AP will not send any more state reports after this.
     * After reporting this state, AP will accept VehicleApPowerStateReq#FINISHED.
     * Other power state requests are ignored.
     *
     * int32Values[1]: Time to turn AP back on, in seconds. Power controller should turn on
     *                 AP after the specified time has elapsed so AP can run tasks like
     *                 update. If this value is 0, no wake up is specified. The power
     *                 controller may not necessarily support timed wake-up.
     */
    SHUTDOWN_START = 0x5,

    /**
     * AP is entering its normal operating state.
     * After reporting this state, AP will accept VehicleApPowerStateReq#SHUTDOWN_PREPARE.
     * Other power state requests are ignored.
     */
    ON = 0x6,
 


    /**
     * AP is preparing to shut down. In this state, Garage Mode is active and idle
     * tasks are allowed to run.
     * After reporting this state, AP will accept VehicleApPowerStateReq#SHUTDOWN_PREPARE
     * requesting immediate shutdown or VehicleApPowerStateReq#CANCEL_SHUTDOWN. Other
     * power state requests are ignored.
     */
    SHUTDOWN_PREPARE = 0x7,

    /**
     * AP has stopped preparing to shut down.
     * After reporting this state, AP will accept VehicleApPowerStateReq#ON or
     * VehicleApPowerStateReq#SHUTDOWN_PREPARE. Other power state requests are ignored.
     */
    SHUTDOWN_CANCELLED = 0x8,

    /**
     * AP now is over voltage mode, notify to disable usb
     */
    OVER_VOLTAGE = 0x9,

    /**
     * AP now is normal mode(such as ON、STANDBY、SCREENSAVER、REMOTE_BOOT、TEMPORARY_WORKING),
     * notify to enable usb
     */
    NORMAL = 0xa,
};


    /**
     * Property to report bootup reason for the current power on. This is a
     * static property that will not change for the whole duration until power
     * off. For example, even if user presses power on button after automatic
     * power on with door unlock, bootup reason must stay with
     * VehicleApPowerBootupReason#USER_UNLOCK.
     *
     * int32Values[0] must be VehicleApPowerBootupReason.
     *
     * @change_mode VehiclePropertyChangeMode:STATIC
     * @access VehiclePropertyAccess:READ
    */
    AP_POWER_BOOTUP_REASON = (
        0x0A02
        | VehiclePropertyGroup:SYSTEM
        | VehiclePropertyType:INT32
        | VehicleArea:GLOBAL),
 

dumpsys car_service   get-power-state

  • 10
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
#include<iostream> #include<string> using namespace std; class Car{ private: string ID;//车辆编号 string Model;//车辆型号 int Power;//车辆功率 string Color;//车辆颜色 double Price;//车辆价格 public: void setID(string carID){ ID = carID; } string getID(){ return ID; } void setModel(string carModel){ Model = carModel; } string getModel(){ return Model; } void setPower(int carPower){ Power = carPower; } int getPower(){ return Power; } void setColor(string carColor){ Color = carColor; } string getColor(){ return Color; } void setPrice(double carPrice){ Price = carPrice; } double getPrice(){ return Price; } void Display(){//显示车辆属性信息 cout<<"编号"<<ID<<"的"<<Model<<"汽车的颜色是"<<Color<<"色,功率为"<<Power<<"马力,价格为"<<Price<<"元"<<endl; } }; int main(){ Car car1, car2; string ID, Model, Color; int Power; double Price; //获取车辆1的信息 cout<<"请输入车辆1的编号:"; getline(cin, ID); car1.setID(ID); cout<<"请输入车辆1的型号:"; getline(cin, Model); car1.setModel(Model); cout<<"请输入车辆1的颜色:"; getline(cin, Color); car1.setColor(Color); cout<<"请输入车辆1的功率:"; cin>>Power; car1.setPower(Power); cout<<"请输入车辆1的价格:"; cin>>Price; car1.setPrice(Price); cin.ignore();//清除缓存区 cout<<endl; //获取车辆2的信息 cout<<"请输入车辆2的编号:"; getline(cin, ID); car2.setID(ID); cout<<"请输入车辆2的型号:"; getline(cin, Model); car2.setModel(Model); cout<<"请输入车辆2的颜色:"; getline(cin, Color); car2.setColor(Color); cout<<"请输入车辆2的功率:"; cin>>Power; car2.setPower(Power); cout<<"请输入车辆2的价格:"; cin>>Price; car2.setPrice(Price); //显示车辆信息 car1.Display(); car2.Display(); return 0; }

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值