比亚迪唐DM APP接口开发

本文介绍了一款基于Android平台的比亚迪汽车状态监测应用,通过调用比亚迪提供的各类硬件设备API,实时获取并显示车辆的速度、油门深浅、发动机转速、油箱油位、冷却液位、总功率、变速箱挡位、雷达状态及轮胎气压等关键信息。
package com.byd.user.helloworld;

import android.Manifest;
import android.hardware.bydauto.ac.AbsBYDAutoAcListener;
import android.hardware.bydauto.ac.BYDAutoAcDevice;
import android.hardware.bydauto.bodywork.BYDAutoBodyworkDevice;
import android.hardware.bydauto.engine.BYDAutoEngineDevice;
import android.hardware.bydauto.sensor.BYDAutoSensorDevice;
import android.hardware.bydauto.speed.AbsBYDAutoSpeedListener;
import android.hardware.bydauto.speed.BYDAutoSpeedDevice;
import android.hardware.bydauto.gearbox.BYDAutoGearboxDevice;
import android.hardware.bydauto.radar.BYDAutoRadarDevice;
import android.hardware.bydauto.tyre.BYDAutoTyreDevice;
import android.os.Bundle;
import android.provider.MediaStore;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.Switch;
import android.widget.TextView;
import android.widget.Toast;

import static android.content.pm.PackageManager.PERMISSION_GRANTED;
import static android.hardware.bydauto.ac.BYDAutoAcDevice.getInstance;
import static android.hardware.bydauto.tyre.BYDAutoTyreDevice.TYRE_COMMAND_AREA_LEFT_FRONT;
import static android.hardware.bydauto.tyre.BYDAutoTyreDevice.TYRE_COMMAND_AREA_RIGHT_FRONT;
import static android.hardware.bydauto.tyre.BYDAutoTyreDevice.TYRE_COMMAND_AREA_LEFT_REAR;
import static android.hardware.bydauto.tyre.BYDAutoTyreDevice.TYRE_COMMAND_AREA_RIGHT_REAR;
public class MainActivity extends AppCompatActivity
{
    private BYDAutoBodyworkDevice mBodyworkDevice = null;
    private BYDAutoAcDevice mAcDevice = null;
    private BYDAutoSpeedDevice autoSpeed = null;
    private BYDAutoEngineDevice autoEngine = null;
    private BYDAutoGearboxDevice autoGearbox=null;
    private BYDAutoRadarDevice autoRadar=null;
    private BYDAutoTyreDevice autoTyre=null;
    private TextView xSpeed,xYoumen,xZhuansu,xYouwei,xCoolant,xPower,xAutoGear,xMGear,xRadar,xTyre;
    private Button btn;

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        btn = (Button)findViewById(R.id.btnRef);
        btn.setOnClickListener(new View.OnClickListener()
        {
            @Override
            public void onClick(View view)
            {
                xSpeed = (TextView) findViewById(R.id.txtSpeed);
                xYoumen=(TextView) findViewById(R.id.txtYouMen);
                xZhuansu=(TextView) findViewById(R.id.txtZhuanSu);
                xYouwei=(TextView) findViewById(R.id.txtYouWei);
                xCoolant=(TextView) findViewById(R.id.txtCoolant);
                xPower=(TextView) findViewById(R.id.txtPower);
                xAutoGear=(TextView) findViewById(R.id.txtAutoGear);
                xMGear=(TextView) findViewById(R.id.txtMGear);
                xRadar=(TextView) findViewById(R.id.txtRadar);
                xTyre=(TextView) findViewById(R.id.txtTyre);
                if (autoSpeed == null) autoSpeed = BYDAutoSpeedDevice.getInstance(MainActivity.this);
                if (autoEngine==null)  autoEngine=BYDAutoEngineDevice.getInstance(MainActivity.this);
                if (autoGearbox==null)  autoGearbox=BYDAutoGearboxDevice.getInstance(MainActivity.this);
                if (autoRadar==null)  autoRadar=BYDAutoRadarDevice.getInstance(MainActivity.this);
                if (autoTyre==null)  autoTyre=BYDAutoTyreDevice.getInstance(MainActivity.this);
                xSpeed.setText("速度:" + String.valueOf(autoSpeed.getCurrentSpeed())+"KM/H");
                xYoumen.setText("油门:"+autoSpeed.getAccelerateDeepness());
                xZhuansu.setText("发动机转速:"+autoEngine.getEngineSpeed());
                xYouwei.setText("燃油油位:"+autoEngine.getOilLevel());
                xCoolant.setText("冷却液位:"+autoEngine.getEngineCoolantLevel());
                xPower.setText("总功率:"+autoEngine.getEnginePower()+"KW");
                xAutoGear.setText("自动变速箱挡位:"+autoGearbox.getGearboxAutoModeType());
                xMGear.setText("手动变速箱挡位"+autoGearbox.getGearboxManualModeLevel());//双离合好像有两个
                xRadar.setText("雷达状态:"+autoRadar.getAllRadarProbeStates());//八个雷达探头状态
                xTyre.setText("胎神之压:"
                        +" LFront "+autoTyre.getTyrePressureValue(TYRE_COMMAND_AREA_LEFT_FRONT)
                        +"Kpa RFront "+autoTyre.getTyrePressureValue(TYRE_COMMAND_AREA_RIGHT_FRONT)
                        +"Kpa ---Lrear "+autoTyre.getTyrePressureValue(TYRE_COMMAND_AREA_LEFT_REAR)
                        +"Kpa Rrear "+autoTyre.getTyrePressureValue(TYRE_COMMAND_AREA_RIGHT_REAR)+"Kpa"
                );
            }
        });
    }
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.byd.user.helloworld">

    <!--车辆信息类的权限  COMMON必须要动态注册-->
    <uses-permission android:name="android.permission.BYDAUTO_BODYWORK_COMMON"/>
    <!--车辆信息类获取权限-->
    <uses-permission android:name="android.permission.BYDAUTO_BODYWORK_GET"/>
    <!--空调类的权限-->
    <uses-permission android:name="android.permission.BYDAUTO_AC_COMMON"/>
    <!--空调类获取的权限-->
    <uses-permission android:name="android.permission.BYDAUTO_AC_GET"/>
    <!--空调类获取设置权限-->
    <uses-permission android:name="android.permission.BYDAUTO_AC_SET"/>
    <!--传感器类获取的权限-->
    <uses-permission android:name="android.permission.BYDAUTO_SENSOR_GET"/>
    <!-- 速度权限-->
    <uses-permission android:name="android.permission.BYDAUTO_SPEED_GET"/>
    <!-- 发动机权限-->
    <uses-permission android:name="android.permission.BYDAUTO_ENGINE_COMMON"/>
    <uses-permission android:name="android.permission.BYDAUTO_ENGINE_GET"/>
    <uses-permission android:name="android.permission.BYDAUTO_GEARBOX_GET"/>
    <uses-permission android:name="android.permission.BYDAUTO_RADAR_GET"/>
    <uses-permission android:name="android.permission.BYDAUTO_TYRE_GET"/>
    <uses-permission android:name="android.permission.BYDAUTO_TYRE_COMMON"/>
    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name"
            android:theme="@style/AppTheme.NoActionBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">









        <TableLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1">

            <TableRow
                android:layout_width="match_parent"
                android:layout_height="match_parent" />

            <Button
                android:id="@+id/btnRef"
                android:layout_width="wrap_content"
                android:layout_height="70px"
                android:layout_weight="1"
                android:text="Button"
                tools:text="刷新" />
            <TableRow
                android:layout_width="match_parent"
                android:layout_height="match_parent" />

            <TextView
                android:id="@+id/txtSpeed"
                android:layout_width="wrap_content"
                android:layout_height="70px"
                android:layout_weight="1"
                android:text="TextView" />
            <TableRow
                android:layout_width="match_parent"
                android:layout_height="match_parent" />
            <TextView
                android:id="@+id/txtYouMen"
                android:layout_width="wrap_content"
                android:layout_height="70px"
                android:layout_weight="1"
                android:text="TextView" />
            <TableRow
                android:layout_width="match_parent"
                android:layout_height="match_parent" />
            <TextView
                android:id="@+id/txtZhuanSu"
                android:layout_width="wrap_content"
                android:layout_height="70px"
                android:layout_weight="1"
                android:text="TextView" />
            <TableRow
                android:layout_width="match_parent"
                android:layout_height="match_parent" />
            <TextView
                android:id="@+id/txtYouWei"
                android:layout_width="wrap_content"
                android:layout_height="70px"
                android:layout_weight="1"
                android:text="TextView" />
            <TableRow
                android:layout_width="match_parent"
                android:layout_height="match_parent" />
            <TextView
                android:id="@+id/txtCoolant"
                android:layout_width="wrap_content"
                android:layout_height="70px"
                android:layout_weight="1"
                android:text="TextView" />
            <TableRow
                android:layout_width="match_parent"
                android:layout_height="match_parent" />
            <TextView
                android:id="@+id/txtPower"
                android:layout_width="wrap_content"
                android:layout_height="70px"
                android:layout_weight="1"
                android:text="TextView" />

            <TableRow
                android:layout_width="match_parent"
                android:layout_height="match_parent" />
            <TextView
                android:id="@+id/txtAutoGear"
                android:layout_width="wrap_content"
                android:layout_height="70px"
                android:layout_weight="1"
                android:text="TextView" />
            <TableRow
                android:layout_width="match_parent"
                android:layout_height="match_parent" />
            <TextView
                android:id="@+id/txtMGear"
                android:layout_width="wrap_content"
                android:layout_height="70px"
                android:layout_weight="1"
                android:text="TextView" />
            <TableRow
                android:layout_width="match_parent"
                android:layout_height="match_parent" />
            <TextView
                android:id="@+id/txtRadar"
                android:layout_width="wrap_content"
                android:layout_height="70px"
                android:layout_weight="1"
                android:text="TextView" />
            <TableRow
                android:layout_width="match_parent"
                android:layout_height="match_parent" />
            <TextView
                android:id="@+id/txtTyre"
                android:layout_width="wrap_content"
                android:layout_height="70px"
                android:layout_weight="1"
                android:text="TextView" />
        </TableLayout>


</LinearLayout>

<think>好的,用户让我介绍一下比亚迪唐DM-P 2021款。首先,我需要确认用户指的是哪一年的车型,因为唐DM-P可能有不同的年款。2021款可能指的是该车型在2021年的版本,不过比亚迪有时候会更新车型,所以需要核实准确的信息。 接下来,我应该先回忆一下比亚迪唐DM-P的基本情况。唐系列是比亚迪的旗舰SUV,DM-P代表的是双模插电式混合动力系统中的性能取向版本,而DM-i则是更注重燃油经济性。DM-P通常配备更强的动力系统,比如更大的电机和发动机组合,提供更高的性能表现。 然后,我需要确认2021款唐DM-P的具体配置。可能包括发动机型号、电动机功率、电池容量、纯电续航里程、加速性能、驱动方式(比如是否四驱)、充电时间、车内科技配置以及安全功能等。同时,还要注意是否有特别的设计特点或者技术亮点,比如刀片电池的应用,这是比亚迪的一个重要卖点,因为它提高了电池的安全性。 另外,用户可能关心这款车的市场定位、价格区间、竞争对手以及用户评价。比如,唐DM-P在同级别中的优势是什么,相比其他品牌如特斯拉、理想等的插电混动或增程式车型有什么不同。同时,可能需要提到它的燃油经济性,尽管是性能版,但混动系统在油耗上还是比传统燃油车有优势。 还要考虑用户可能的深层需求。比如,他们可能对新能源车感兴趣,关注续航、充电便利性、政策补贴、保养成本等。或者他们可能对比亚迪品牌的技术进步有好奇心,比如DM-p系统的技术细节,如何实现高性能和低油耗的结合。 需要确保信息的准确性,比如发动机参数、电池数据等不能有错误。如果有不确定的地方,应该查阅可靠的资料或官方网站进行确认。同时,用中文清晰有条理地组织内容,分点介绍,让用户容易理解。 最后,检查是否有遗漏的重要信息,比如车型的尺寸、内部空间、智能驾驶辅助系统、娱乐系统等,这些都是消费者在购车时会考虑的因素。另外,如果2021款有特别的版本或限量版,也应该提及。</think>比亚迪唐DM-P 2021款是比亚迪旗下的一款高性能插电式混合动力(PHEV)中型SUV,主打动力性能与新能源技术的结合。以下是其核心信息梳理: --- ### **一、动力系统** - **混动架构**:DM-P(Dual Mode - Power)平台,以性能为导向。 - **发动机**:1.5T或2.0T涡轮增压发动机(具体视配置),搭配前置BSG电机辅助。 - **电机布局**:后桥搭载大功率驱动电机,部分版本为双电机四驱。 - **综合功率**:最高可达**431kW**,峰值扭矩**900N·m**,0-100km/h加速约**4.3秒**(性能版数据)。 - **电池技术**:采用比亚迪**刀片电池**(磷酸铁锂),安全性更高,电池容量约**18.5kWh**。 - **纯电续航**:NEDC工况下约**100公里**,支持纯电模式驾驶。 --- ### **二、设计与配置** - **外观**:延续比亚迪Dragon Face家族设计,贯穿式LED尾灯、大尺寸轮毂(22英寸可选),运动感强。 - **内饰**:15.6英寸可旋转中控屏、DiLink智能网联系统、全液晶仪表、麂皮座椅、氛围灯等。 - **空间**:7座布局(2+3+2),第三排可折叠扩展后备箱空间。 - **智能驾驶**:DiPilot辅助系统,包含自适应巡航、车道保持、自动泊车等功能。 --- ### **三、性能与技术亮点** - **全时电四驱**:通过电机实现快速扭矩分配,提升操控稳定性。 - **能量回收**:支持多档可调制动能量回收,优化续航。 - **充电兼容性**:支持快充(30%-80%约30分钟)和家用220V充电。 - **油耗表现**:馈电油耗约6.5L/100km(NEDC),兼顾性能与经济性。 --- ### **四、市场定位与竞品** - **价格区间**:2021款指导价约**28.98万-31.48万元**(具体因配置差异)。 - **竞品车型**:理想ONE(增程式)、大众途观L PHEV、丰田汉兰达混动等。 - **核心优势**:高性能加速、长纯电续航、刀片电池安全性、比亚迪三电技术积累。 --- ### **五、用户评价** - **好评点**:动力强劲、配置丰富、纯电通勤成本低、空间实用。 - **争议点**:馈电状态发动机噪音略明显、第三排空间适合短途乘坐。 --- ### **总结** 唐DM-P 2021款适合追求动力性能与新能源体验的用户,尤其适合家庭使用场景。其DM-P系统在提供驾驶激情的同时,兼顾了日常通勤的纯电经济性,是当时比亚迪技术实力的代表性产品。后续比亚迪推出了更新版本(如2022/2023款),建议购车前对比最新款配置及价格。
评论 10
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

xcagy

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值