CARPLAY版本整理
This commit is contained in:
25
MXC_A27-PCB4.5-270T/app/carlink/CP/include/audio_callbacks.h
Normal file
25
MXC_A27-PCB4.5-270T/app/carlink/CP/include/audio_callbacks.h
Normal file
@ -0,0 +1,25 @@
|
||||
#ifndef _AUDIO_CALLBACKS_H
|
||||
#define _AUDIO_CALLBACKS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef int (*audio_start_callback_f)(void *ctx, int handle, int type, int rate, int bits, int channels);
|
||||
typedef void (*audio_stop_callback_f)(void *ctx, int handle, int type);
|
||||
typedef void ( *audio_reset_DSP_mode_callback_f)(void *ctx, int mode);
|
||||
|
||||
typedef struct audio_callbacks
|
||||
{
|
||||
audio_start_callback_f audio_start_callback;
|
||||
audio_stop_callback_f audio_stop_callback;
|
||||
audio_reset_DSP_mode_callback_f audio_reset_DSP_mode_callback;
|
||||
void *ctx;
|
||||
}audio_callbacks_t;
|
||||
|
||||
void audio_register_callbacks(void *cb);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
272
MXC_A27-PCB4.5-270T/app/carlink/CP/include/carplay.h
Normal file
272
MXC_A27-PCB4.5-270T/app/carlink/CP/include/carplay.h
Normal file
@ -0,0 +1,272 @@
|
||||
#ifndef __CARPLAY_IF_H_H
|
||||
#define __CARPLAY_IF_H_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*#ifndef CARLINK_LINK_TYPE
|
||||
#define CARLINK_LINK_TYPE
|
||||
typedef enum
|
||||
{
|
||||
CARPLAY = 0x00,
|
||||
CARLIFE,
|
||||
ANDROID_CARLIFE,
|
||||
ANDROID_MIRROR = 3,
|
||||
IOS_CARLIFE,
|
||||
ANDROID_AUTO = 5,
|
||||
ECLINK = 0x06,
|
||||
CARPLAY_WIRELESS
|
||||
}Link_TYPE;
|
||||
#endif*/
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CALL_ACCEPT = 2,
|
||||
CALL_DROP = 3,
|
||||
}CALL;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MEDIA_NONE = 0,
|
||||
MEDIA_PLAY,
|
||||
MEDIA_PAUSE,
|
||||
MEDIA_PLAY_PAUSE,
|
||||
MEDIA_NEXT,
|
||||
MEDIA_PREVIOUS
|
||||
}MEDIA;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
AUDIO_MEDIA = 0,
|
||||
AUDIO_TELEPHONE,
|
||||
AUDIO_RECOGNITION,
|
||||
AUDIO_ALERT,
|
||||
AUDIO_REC,
|
||||
AUDIO_ALT,
|
||||
AUDIO_AUX_IN,
|
||||
AUDIO_AUX_OUT
|
||||
} AUDIO_TYPE;
|
||||
|
||||
/*
|
||||
|
||||
typedef enum _IAP2_LINK_STATUS
|
||||
{
|
||||
IAP2_INIT = -1,
|
||||
IAP2_USB_HOST_INSERTED,
|
||||
IAP2_USB_HOST_REMOVE,
|
||||
IAP2_USB_SWITCH_FAIL,
|
||||
IAP2_CONNECT,
|
||||
IAP2_DISCONNECT,
|
||||
}IAP2_LINK_STATUS;*/
|
||||
|
||||
#ifndef AirplayModeStateAlias
|
||||
#define AirplayModeStateAlias
|
||||
|
||||
typedef int CarplayEntity;
|
||||
#define CarplayEntity_NotApplicable 0
|
||||
#define CarplayEntity_Controller 1
|
||||
#define CarplayEntity_Accessory 2
|
||||
|
||||
typedef int CarplayTransferType;
|
||||
#define CarplayTransferType_NotApplicable 0
|
||||
#define CarplayTransferType_Take 1 // Transfer ownership permanently.
|
||||
#define CarplayTransferType_Untake 2 // Release permanent ownership.
|
||||
#define CarplayTransferType_Borrow 3 // Transfer ownership temporarily.
|
||||
#define CarplayTransferType_Unborrow 4 // Release temporary ownership.
|
||||
|
||||
|
||||
typedef int CarplayTransferPriority;
|
||||
#define CarplayTransferPriority_NotApplicable 0
|
||||
#define CarplayTransferPriority_NiceToHave 100 // Transfer succeeds only if constraint is <= Anytime.
|
||||
#define CarplayTransferPriority_UserInitiated 500 // Transfer succeeds only if constraint is <= UserInitiated.
|
||||
|
||||
|
||||
typedef int CarplayConstraint;
|
||||
#define CarplayConstraint_NotApplicable 0
|
||||
#define CarplayConstraint_Anytime 100 // Resource may be taken/borrowed at any time.
|
||||
#define CarplayConstraint_UserInitiated 500 // Resource may be taken/borrowed if user initiated.
|
||||
#define CarplayConstraint_Never 1000 // Resource may never be taken/borrowed.
|
||||
|
||||
|
||||
typedef int CarplayTriState;
|
||||
#define CarplayTriState_NotApplicable 0
|
||||
#define CarplayTriState_False -1
|
||||
#define CarplayTriState_True 1
|
||||
|
||||
|
||||
typedef int CarplaySpeechMode;
|
||||
#define CarplaySpeechMode_NotApplicable 0
|
||||
#define CarplaySpeechMode_None -1 // No speech-related states are active.
|
||||
#define CarplaySpeechMode_Speaking 1 // Device is speaking to the user.
|
||||
#define CarplaySpeechMode_Recognizing 2 // Device is recording audio to recognize speech from the user.
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CarplayEntity entity;
|
||||
CarplaySpeechMode mode;
|
||||
|
||||
}CarPlaySpeechState;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CarplayEntity screen; // Owner of the screen.
|
||||
CarplayEntity permScreen; // Permanent owner of screen.
|
||||
CarplayEntity mainAudio; // Owner of main audio.
|
||||
CarplayEntity permMainAudio; // Permanent owner of main audio.
|
||||
CarplayEntity phoneCall; // Owner of phone call.
|
||||
CarPlaySpeechState speech; // Owner of speech and its mode.
|
||||
CarplayEntity turnByTurn; // Owner of navigation.
|
||||
|
||||
} CarPlayModeState;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
typedef void ( *CarplaySessionStarted_f )(void *ctx);
|
||||
typedef void ( *CarplaySessionStop_f )(void *ctx);
|
||||
typedef void ( *CarplaySessionModesChanged_f )(void *ctx, const CarPlayModeState * inState);
|
||||
typedef void ( *CarplaySessionRequestUI_f )(void *ctx);
|
||||
typedef void ( *CarplaySessionDuckAudio_f)(void *ctx, double inDurationSecs, double inVolume);
|
||||
typedef void ( *CarplaySessionUnduckAudio_f)(void *ctx, double inDurationSecs);
|
||||
typedef void ( *CarplayDisableBtSession_f)(void *ctx);
|
||||
typedef void ( *CarplayNotifyDeviceName_f)(void *ctx, const char *name, int len);
|
||||
typedef void ( *CarplayBonjourServiceFound_f)(void *ctx, char phone_bt_mac[6]);
|
||||
typedef void ( *CarplayViewAreaUpdateNotify_f)(void *ctx, int index);
|
||||
//typedef void ( *CarplayMsgNotify_f)(void *ctx, int id, int para1, int para2, const char* msg, int msgLen);
|
||||
typedef void ( *CarplayMsgNotify_f)(void *ctx, const char* msg, int msgLen);
|
||||
|
||||
typedef struct carplay_session_callbacks
|
||||
{
|
||||
CarplaySessionStarted_f SessionStarted;
|
||||
CarplaySessionStop_f SessionStop;
|
||||
CarplaySessionModesChanged_f SessionModesChanged;
|
||||
CarplaySessionRequestUI_f SessionRequestUI;
|
||||
CarplaySessionDuckAudio_f SessionDuckAudio;
|
||||
CarplaySessionUnduckAudio_f SessionUnduckAudio;
|
||||
CarplayDisableBtSession_f DisableBtSession;
|
||||
CarplayNotifyDeviceName_f NotifyDeviceName;
|
||||
CarplayBonjourServiceFound_f BonjourServiceFound;
|
||||
CarplayViewAreaUpdateNotify_f ViewAreaUpdateNotify;
|
||||
|
||||
CarplayMsgNotify_f MsgNotify;
|
||||
void *ctx;
|
||||
}carplay_session_callbacks_t;
|
||||
|
||||
typedef carplay_session_callbacks_t carplaySessionCbs;
|
||||
|
||||
/*
|
||||
* @brief 初始化carplay的基本信息,整个程序的生命周期里面调用一次;
|
||||
*/
|
||||
int carplay_init();
|
||||
void carplay_uninit();
|
||||
/*
|
||||
* @brief 注册carplay plugin的回调函数;
|
||||
* @param cbs指向carplay_session_callbacks_t类型的变量;
|
||||
*/
|
||||
void carplay_register_callbacks(void *cbs);
|
||||
/*
|
||||
* @brief 启动carplay;
|
||||
*/
|
||||
int carplay_start();
|
||||
|
||||
void start_carplay_client_connect();
|
||||
/*
|
||||
* @brief 停止carplay;
|
||||
*/
|
||||
void carplay_stop();
|
||||
/*
|
||||
* @brief 设置要连接手机的蓝牙mac地址,无线连接的时候使用;
|
||||
* @param bt_addr 蓝牙mac地址;
|
||||
*/
|
||||
void carplay_wl_set_iphone_mac_addr(char bt_addr[6]);
|
||||
|
||||
/*
|
||||
* @brief 发送电话按键给苹果;
|
||||
* @param button 类型见enum CALL;
|
||||
*/
|
||||
void Telephone_button_Update(unsigned button);
|
||||
/*
|
||||
* @brief 发送多媒体按键给苹果;
|
||||
* @param button 类型见enum MEDIA;
|
||||
*/
|
||||
void Media_button_Update(unsigned button);
|
||||
/*
|
||||
* @brief 发送siri按键给苹果;
|
||||
* @param button 1表示按下启动siri,0表示释放来结束siri;
|
||||
*/
|
||||
void send_siri_cmd(int button);
|
||||
void send_single_touchscreen_x_y_2_carplay(unsigned short x, unsigned short y, unsigned char pressed);
|
||||
void send_mul_touchscreen_x_y_2_carplay(
|
||||
unsigned char finger_idx1, unsigned char pressed1,
|
||||
unsigned short x1, unsigned short y1,
|
||||
unsigned char finger_idx2, unsigned char pressed2,
|
||||
unsigned short x2, unsigned short y2
|
||||
);
|
||||
/*
|
||||
* @brief 发送旋钮信息给苹果;
|
||||
*/
|
||||
void KnobUpdate(char gSelectButtonPressed,
|
||||
char gHomeButtonPressed,
|
||||
char gBackButtonPressed,
|
||||
double gXPosition,
|
||||
double gYPosition,
|
||||
char gWheelPositionRelative
|
||||
);
|
||||
|
||||
/*
|
||||
* @brief 请求iphone启动一个应用;
|
||||
* @param bundleId app的包名;
|
||||
* @param alert app启动的时候时候弹出警告对话框;
|
||||
*/
|
||||
int apple_app_launcher(char * bundleId, char alert);
|
||||
|
||||
/*
|
||||
* @brief 要求iphone发送关键帧;
|
||||
*/
|
||||
void force_key_frame();
|
||||
/*
|
||||
* @brief 设置夜间模式;
|
||||
* @param inNightMode 1表示进入夜间模式,0表示退出夜间模式
|
||||
*/
|
||||
void set_night_mode(char inNightMode);
|
||||
|
||||
/*
|
||||
* @brief 请求苹果手机输出视频数据;
|
||||
*/
|
||||
void request_UI(char *url);
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void borrow_screen(int priority, int unborrow_constraint);
|
||||
void unborrow_screen(void);
|
||||
void take_screen(int priority, int take_constraint, int borrow_constraint);
|
||||
void untake_screen(void);
|
||||
void borrow_audio(int priority, int unborrow_constraint);
|
||||
void unborrow_audio(void);
|
||||
void take_audio(int priority, int take_constraint, int borrow_constraint);
|
||||
void untake_audio(void);
|
||||
void carplay_send_change_modes(CarplayTransferType inScreenType,
|
||||
CarplayTransferPriority inScreenPriority,
|
||||
CarplayConstraint inScreenTake,
|
||||
CarplayConstraint inScreenBorrow,
|
||||
CarplayTransferType inAudioType,
|
||||
CarplayTransferPriority inAudioPriority,
|
||||
CarplayConstraint inAudioTake,
|
||||
CarplayConstraint inAudioBorrow,
|
||||
CarplayTriState inPhone,
|
||||
CarplaySpeechMode inSpeech,
|
||||
CarplayTriState inTurnByTurn);
|
||||
|
||||
int carplay_ipc_start();
|
||||
void carplay_ipc_stop();
|
||||
void process_play_stream(int handle, void *buffer, int len, int frames, unsigned long long timestamp);
|
||||
void process_record_stream(int handle, void *buffer, int len, int frames, unsigned long long timestamp);
|
||||
|
||||
int carplay_get_iphone_ip_addr(char *ipaddr);
|
||||
void carplay_wl_set_iphone_mac_addr(char bt_addr[6]);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
80
MXC_A27-PCB4.5-270T/app/carlink/CP/include/iap.h
Normal file
80
MXC_A27-PCB4.5-270T/app/carlink/CP/include/iap.h
Normal file
@ -0,0 +1,80 @@
|
||||
#ifndef __IAP_H_H
|
||||
#define __IAP_H_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum _IAP2_LINK_STATUS
|
||||
{
|
||||
IAP2_INIT = -1,
|
||||
IAP2_USB_HOST_INSERTED,
|
||||
IAP2_CONNECT,
|
||||
IAP2_ID_OK,
|
||||
IAP2_USB_HOST_REMOVE,
|
||||
IAP2_USB_SWITCH_FAIL,
|
||||
IAP2_ID_FAIL,
|
||||
IAP2_DISCONNECT
|
||||
}IAP2_LINK_STATUS;
|
||||
|
||||
typedef void (*iap2_link_status_cb_f)(void *ctx, IAP2_LINK_STATUS status);
|
||||
typedef void (*iap2_msg_time_update_cb_f)(void *ctx, long long time, int zone_offset);
|
||||
typedef void (*iap2_msg_time_zone_update_cb_f)(void *ctx, long long time, int16_t zone, int8_t daylightOff);
|
||||
typedef void (*iap2_msg_gps_cb_f)(void *ctx, unsigned char session, int start);
|
||||
typedef void (*iap2_msg_gps_gprmc_data_status_cb_f)(void *ctx, int value_a, int value_v, int value_x);
|
||||
typedef void (*iap2_msg_identify_cb_f)(void *ctx, int type, int ok);
|
||||
typedef void (*iap2_msg_wl_carplay_update_cb_f)(void *ctx, int status);
|
||||
typedef int (*iap2_usb_switch_cb_f)(void *ctx, int state);
|
||||
typedef int (*iap2_write_data_cb_f)(void *ctx, char *buf, int len);
|
||||
typedef void (*iap2_msg_language_update_cb_f)(void *ctx, const char *lang);
|
||||
typedef void (*iap2_msg_call_state_update_cb_f)(void *ctx,
|
||||
const char *remoteId,
|
||||
const char *displayName,
|
||||
int status,
|
||||
int direction,
|
||||
const char *uuid,
|
||||
const char *addrBookId,
|
||||
const char *label,
|
||||
int service);
|
||||
|
||||
typedef void (*iap2_msg_nowplaying_update_cb_f)(void *ctx,
|
||||
int playback_status, int elapsed_time,
|
||||
uint8_t* media_item_title, int media_item_title_len,
|
||||
uint8_t* media_item_album_title, int media_item_album_title_len,
|
||||
uint8_t* media_item_artist, int media_item_artist_len,
|
||||
int song_length_ms);
|
||||
|
||||
typedef void (*iap2_msg_msg_json_cb_f)(void *ctx, const char* buf, int len);
|
||||
typedef struct iap2_callbacks_st
|
||||
{
|
||||
iap2_link_status_cb_f iap2_link_status_cb;
|
||||
iap2_msg_time_update_cb_f iap2_msg_time_update_cb;
|
||||
iap2_msg_gps_cb_f iap2_msg_gps_cb;
|
||||
iap2_msg_gps_gprmc_data_status_cb_f iap2_msg_gps_gprmc_data_status_cb;
|
||||
iap2_msg_identify_cb_f iap2_msg_identify_cb;
|
||||
iap2_msg_wl_carplay_update_cb_f iap2_msg_wl_carplay_update_cb;
|
||||
iap2_msg_language_update_cb_f iap2_msg_language_update_cb;
|
||||
iap2_msg_call_state_update_cb_f iap2_msg_call_state_update_cb;
|
||||
iap2_usb_switch_cb_f iap2_usb_switch_cb;
|
||||
iap2_write_data_cb_f iap2_write_data_cb;
|
||||
iap2_msg_time_zone_update_cb_f iap2_msg_time_zone_update_cb;
|
||||
iap2_msg_nowplaying_update_cb_f iap2_msg_nowplaying_update_cb;
|
||||
iap2_msg_msg_json_cb_f iap2_msg_msg_json_cb;
|
||||
|
||||
void *ctx;
|
||||
}iap2_callbacks;
|
||||
|
||||
void iap2_register_callbacks(iap2_callbacks *pcb);
|
||||
int iap2_start();
|
||||
int iap2_start_wifi_session();
|
||||
int force_iap2_bt_start();
|
||||
void iap2_stop();
|
||||
int apple_send_pascd(unsigned char session, char *data);
|
||||
int iap2_read_data_proc(char *buf, int len);
|
||||
int apple_start_update_call_state(int start);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
154
MXC_A27-PCB4.5-270T/app/carlink/CP/include/mycommon.h
Normal file
154
MXC_A27-PCB4.5-270T/app/carlink/CP/include/mycommon.h
Normal file
@ -0,0 +1,154 @@
|
||||
#ifndef MYCOMMON_H_H
|
||||
#define MYCOMMON_H_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifndef CARLINK_LINK_TYPE
|
||||
#define CARLINK_LINK_TYPE
|
||||
typedef enum
|
||||
{
|
||||
CARPLAY = 0x00,
|
||||
CARLIFE,
|
||||
ANDROID_CARLIFE,
|
||||
ANDROID_MIRROR = 3,
|
||||
IOS_CARLIFE,
|
||||
ANDROID_AUTO = 5,
|
||||
ECLINK = 0x06,
|
||||
CARPLAY_WIRELESS,
|
||||
AUTO_WIRELESS
|
||||
}Link_TYPE;
|
||||
#endif
|
||||
|
||||
//general function
|
||||
typedef enum __USB_MODE
|
||||
{
|
||||
UNDEFINED = 0,
|
||||
HOST,
|
||||
PERIPHERAL,
|
||||
OTG
|
||||
}USB_MODE;
|
||||
|
||||
#define LOGV(...) printf(__VA_ARGS__); printf("\r\n");
|
||||
|
||||
struct view_area
|
||||
{
|
||||
short w;
|
||||
short h;
|
||||
short x;
|
||||
short y;
|
||||
};
|
||||
|
||||
typedef struct __carplay_cfg_info
|
||||
{
|
||||
char *iap2_name;
|
||||
char *iap2_modelIdentifier;
|
||||
char *iap2_manfacturer;
|
||||
char *iap2_serialnumber;
|
||||
char *iap2_sw_ver;
|
||||
char *iap2_hw_ver;
|
||||
char *iap2_vehicleInfo_name;
|
||||
char *iap2_product_uuid;
|
||||
char *iap2_usb_serial_num;
|
||||
|
||||
char *manfacturer;
|
||||
char *oem_icon_label;
|
||||
char *oem_icon_path;
|
||||
char *os_info;
|
||||
char *iOSVersionMin;
|
||||
char *limited_ui_elements;
|
||||
char *guuid;
|
||||
char *devid;
|
||||
char link_type;
|
||||
char btmac[6];
|
||||
bool oem_icon_visible;
|
||||
bool limited_ui;
|
||||
bool right_hand_driver;
|
||||
bool night_mode;
|
||||
bool has_knob;
|
||||
bool has_telbutton;
|
||||
bool has_mediabutton;
|
||||
bool has_proxsensor;
|
||||
bool has_EnhancedReqCarUI;
|
||||
bool has_ETCSupported;
|
||||
bool HiFiTouch;
|
||||
bool LoFiTouch;
|
||||
unsigned short usb_country_code;
|
||||
unsigned short tp_verndor_code;
|
||||
unsigned short tp_product_code;
|
||||
unsigned short tel_verndor_code;
|
||||
unsigned short tel_product_code;
|
||||
unsigned short knob_verndor_code;
|
||||
unsigned short knob_product_code;
|
||||
unsigned short proxsensor_verndor_code;
|
||||
unsigned short proxsensor_product_code;
|
||||
short width;//pixel
|
||||
short height;
|
||||
short fps;
|
||||
short screen_width_phy;//mm
|
||||
short screen_height_phy;
|
||||
|
||||
char encrypt_ic_i2c_bus_num;
|
||||
char encrypt_ic_addr;
|
||||
char usb_idx;
|
||||
char need_sw_aec;
|
||||
char aec_delay;
|
||||
bool tvout_enable;
|
||||
|
||||
bool use_remote_audio;
|
||||
char video_type;
|
||||
short icurrent;
|
||||
int duck_vol;
|
||||
|
||||
char enable_iap_carplay_sess;
|
||||
char *keychain_path_dir;
|
||||
|
||||
char* wifi_ssid;
|
||||
char* wifi_passwd;
|
||||
char* public_key;
|
||||
char* src_version;
|
||||
char ip_v4_addr[4];
|
||||
char wifi_channel;
|
||||
short net_port;
|
||||
|
||||
char carplay_net_ready;
|
||||
char disable_bonjour;
|
||||
char iap_carplay_rej;
|
||||
|
||||
bool enable_enhanced_siri;
|
||||
bool enable_single_ui;
|
||||
bool disable_carplay_audio;
|
||||
|
||||
short mfi_ic_i2c_bus_num;
|
||||
short mfi_ic_addr;
|
||||
|
||||
bool is_old_carplay_ver;
|
||||
|
||||
struct view_area area[3];
|
||||
char view_area_index;
|
||||
|
||||
}carplay_cfg_info;
|
||||
|
||||
#if 0
|
||||
typedef struct __auto_cfg_info
|
||||
{
|
||||
short width;//pixel
|
||||
short height;
|
||||
short fps;
|
||||
char* wifi_ssid;
|
||||
char* wifi_passwd;
|
||||
char wifi_channel;
|
||||
bool disable_carplay_audio;
|
||||
|
||||
} auto_cfg_info;
|
||||
#endif
|
||||
|
||||
extern carplay_cfg_info *g_link_info;
|
||||
//extern auto_cfg_info *g_auto_link_info;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
26
MXC_A27-PCB4.5-270T/app/carlink/CP/include/video_callbacks.h
Normal file
26
MXC_A27-PCB4.5-270T/app/carlink/CP/include/video_callbacks.h
Normal file
@ -0,0 +1,26 @@
|
||||
#ifndef _VIDEO_CALLBACKS_H
|
||||
#define _VIDEO_CALLBACKS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
typedef int (*video_start_callback_f)(void *ctx);
|
||||
typedef void (*video_stop_callback_f)(void *ctx);
|
||||
typedef int (*video_proc_data_callback_f)(void *ctx, char *buf, int len);
|
||||
|
||||
typedef struct video_callbacks
|
||||
{
|
||||
video_start_callback_f video_start_callback;
|
||||
video_stop_callback_f video_stop_callback;
|
||||
video_proc_data_callback_f video_proc_data_callback;
|
||||
void *ctx;
|
||||
}video_callbacks_t;
|
||||
|
||||
void video_register_callbacks(void *cb);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
BIN
MXC_A27-PCB4.5-270T/app/carlink/CP/lib/carplay.a
Normal file
BIN
MXC_A27-PCB4.5-270T/app/carlink/CP/lib/carplay.a
Normal file
Binary file not shown.
574
MXC_A27-PCB4.5-270T/app/carlink/CP/src/carlink_cp.c
Normal file
574
MXC_A27-PCB4.5-270T/app/carlink/CP/src/carlink_cp.c
Normal file
@ -0,0 +1,574 @@
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
#include "iap.h"
|
||||
#include "carplay.h"
|
||||
#include "audio_callbacks.h"
|
||||
#include "video_callbacks.h"
|
||||
#include "carlink_cp.h"
|
||||
//#include "DispatchLite.h"
|
||||
#include "mycommon.h"
|
||||
#include "ff_sfdisk.h"
|
||||
#include "carlink_video.h"
|
||||
#include "carlink_cp_priv.h"
|
||||
|
||||
#include "os_adapt.h"
|
||||
#include <FreeRTOS_POSIX.h>
|
||||
#include <task.h>
|
||||
#include "carlink_common.h"
|
||||
#include "board.h"
|
||||
|
||||
#if CARLINK_CP
|
||||
|
||||
struct carplay_ctx
|
||||
{
|
||||
struct ICalinkEventCallbacks carlinkEventCB;
|
||||
|
||||
int mPhoneCarplayFlag;
|
||||
bool mInitDone;
|
||||
bool mBTConnected;
|
||||
bool mIapReady;
|
||||
bool mCarplayConnected;
|
||||
char mLocalBTMac[6];
|
||||
char mRemoteBTMac[6];
|
||||
char mIp[32];
|
||||
char mPhoneWifiMac[18];
|
||||
};
|
||||
|
||||
struct carplay_ctx g_cp_handle;
|
||||
static bool g_cp_disable = false;
|
||||
|
||||
|
||||
static void carplay_init_parameter();
|
||||
void start_mdnsd();
|
||||
void start_mdnsd_posix();
|
||||
void stop_mdnsd_posix();
|
||||
|
||||
static void carplay_notify_event(struct carlink_event *ev, enum CARLINK_EVENT_TYPE type, bool disable_filter)
|
||||
{
|
||||
ev->link_type = CARLINK_CARPLAY_WIRELESS;
|
||||
ev->disable_filter = disable_filter;
|
||||
ev->type = type;
|
||||
carlink_notify_event(ev);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void iap2_link_status(void *ctx, IAP2_LINK_STATUS status){}
|
||||
static int iap2_write_data(void *ctx, char *buf, int len)
|
||||
{
|
||||
(void)ctx;
|
||||
return carlink_iap_data_write((unsigned char *)buf, len);
|
||||
}
|
||||
extern uint32_t tire_front_time;
|
||||
extern uint32_t tire_rear_time;
|
||||
extern uint32_t fml_stamp_to_time(uint32_t timep , uint16_t time[]);
|
||||
extern void Send_list_set_time(uint32_t sum);
|
||||
static void iap2_msg_time_update(void *ctx, long long time, int zone_offset){
|
||||
(void)ctx;
|
||||
printf("iap2_msg_time_update %lld , %d\r\n",time,zone_offset);
|
||||
uint16_t time_transfer[6];
|
||||
uint32_t sum = (uint32_t)time;
|
||||
|
||||
tire_rear_time = sum;
|
||||
tire_front_time = sum;
|
||||
fml_stamp_to_time(sum,time_transfer);
|
||||
Send_list_set_time(sum);
|
||||
}
|
||||
static void iap2_msg_gps(void *ctx, unsigned char session, int start){}
|
||||
static void iap2_msg_gps_gprmc_data_status(void *ctx, int value_a, int value_v, int value_x){}
|
||||
static void iap2_msg_identify(void *ctx, int type, int ok)
|
||||
{
|
||||
if (ok && !g_link_info->enable_iap_carplay_sess) {
|
||||
start_mdnsd_posix();
|
||||
}
|
||||
}
|
||||
static void iap2_msg_wl_carplay_update(void *ctx, int status)//<2F>ֻ<EFBFBD><D6BB><EFBFBD>"Carplay<61><79><EFBFBD><EFBFBD>"<22>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
{
|
||||
struct carplay_ctx* pctx = (struct carplay_ctx*)ctx;
|
||||
|
||||
pctx->mPhoneCarplayFlag = status;
|
||||
printf("%s:%d status:%d %d\r\n", __func__, __LINE__, status, pctx->mPhoneCarplayFlag);
|
||||
}
|
||||
//static void iap2_msg_language_update(void *ctx, const char *lang){}
|
||||
|
||||
static void carplay_session_started(void *ctx)
|
||||
{
|
||||
struct carlink_event ev = {0};
|
||||
printf("%s is called\r\n", __func__);
|
||||
carplay_notify_event(&ev, CARLINK_EVENT_MSG_SESSION_CONNECT, 0);
|
||||
}
|
||||
|
||||
static void carplay_session_Stop(void *ctx)
|
||||
{
|
||||
struct carlink_event ev = {0};
|
||||
printf("%s is called\r\n", __func__);
|
||||
carplay_notify_event(&ev, CARLINK_EVENT_MSG_SESSION_STOP, 0);
|
||||
}
|
||||
|
||||
static void carplay_session_modes_changed(void *ctx, const CarPlayModeState * inState){}
|
||||
static void carplay_session_requestUI(void *ctx)
|
||||
{
|
||||
carplay_send_change_modes(CarplayTransferType_Take, CarplayTransferPriority_UserInitiated,
|
||||
CarplayConstraint_UserInitiated, CarplayConstraint_Anytime,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0);
|
||||
}
|
||||
|
||||
static void carplay_session_duck_audio(void *ctx, double inDurationSecs, double inVolume){}
|
||||
static void carplay_session_unduck_audio(void *ctx, double inDurationSecs){}
|
||||
//static void carplay_session_notify_device_name(void *ctx, const char *name, int len){}
|
||||
|
||||
static void carplay_disable_bt_session(void *ctx)
|
||||
{
|
||||
struct carlink_event ev = {0};
|
||||
|
||||
(void)ctx;
|
||||
|
||||
if (g_link_info->disable_carplay_audio)
|
||||
return;
|
||||
carplay_notify_event(&ev, CARLINK_EVENT_MSG_DISABLE_BT, 0);
|
||||
}
|
||||
|
||||
static int audio_start_callback_impl(void *ctx, int handle, int type, int rate, int bits, int channels)
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
ret = carlink_cp_audio_start(handle, type, rate, bits, channels);
|
||||
return ret;
|
||||
}
|
||||
static void audio_stop_callback_impl(void *ctx, int handle, int type)
|
||||
{
|
||||
carlink_cp_audio_stop(handle, type);
|
||||
}
|
||||
//extern char key_value;
|
||||
|
||||
static int video_start_callback_impl(void *ctx)
|
||||
{
|
||||
h264_dec_ctx_init();
|
||||
set_carlink_display_state(1);
|
||||
//key_value = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void video_stop_callback_impl(void *ctx)
|
||||
{
|
||||
//key_value = 0;
|
||||
printf("%s:%d\r\n", __func__, __LINE__);
|
||||
set_carlink_display_state(0);
|
||||
}
|
||||
static int video_proc_data_callback_impl(void *ctx, char *buf, int len)
|
||||
{
|
||||
video_frame_s* frame = NULL;
|
||||
//printf("video_proc_data len:%d\r\n", len);
|
||||
|
||||
get_retry:
|
||||
frame = get_h264_frame_buf();
|
||||
if (NULL == frame) {
|
||||
//printf("h264 frame is empty\r\n");
|
||||
vTaskDelay(pdMS_TO_TICKS(10));
|
||||
goto get_retry;
|
||||
//continue;
|
||||
}
|
||||
|
||||
memcpy(frame->cur, buf, len);
|
||||
frame->len = len;
|
||||
|
||||
notify_h264_frame_ready(&frame);
|
||||
return 0;
|
||||
}
|
||||
static void carplay_viewArea_update_notify(void *ctx, int index){}
|
||||
static void resetDspMode(void *ctx, int mode){}
|
||||
static void carplay_msg_notify(void*ctx, const char* buf, int len){}
|
||||
|
||||
void test_carplay_modules();
|
||||
|
||||
static void start_cp(struct carplay_ctx* pctx)
|
||||
{
|
||||
if (!pctx->mInitDone)
|
||||
return;
|
||||
//if (pctx->mBTConnected)
|
||||
// return;
|
||||
if (!pctx->mIapReady)
|
||||
return;
|
||||
|
||||
if (pctx->mCarplayConnected)
|
||||
return;
|
||||
|
||||
if (g_cp_disable)
|
||||
return;
|
||||
|
||||
g_link_info->enable_iap_carplay_sess = 1;
|
||||
if (g_link_info->enable_iap_carplay_sess == 0) {
|
||||
g_link_info->is_old_carplay_ver = 1;
|
||||
} else {
|
||||
g_link_info->is_old_carplay_ver = 0;
|
||||
}
|
||||
g_link_info->wifi_passwd = (char *)carlink_get_wifi_passwd();
|
||||
g_link_info->wifi_ssid = (char *)carlink_get_wifi_ssid();
|
||||
g_link_info->wifi_channel = 36;
|
||||
|
||||
{
|
||||
char ip[4] = {0};
|
||||
carlink_get_ap_ip_addr(ip);
|
||||
g_link_info->ip_v4_addr[0] = ip[0];
|
||||
g_link_info->ip_v4_addr[1] = ip[1];
|
||||
g_link_info->ip_v4_addr[2] = ip[2];
|
||||
g_link_info->ip_v4_addr[3] = ip[3];
|
||||
}
|
||||
|
||||
carplay_start();
|
||||
}
|
||||
|
||||
uint8_t carplay_flag = 0;
|
||||
static void carlink_cp_input_event_proc(const struct carlink_event *ev)
|
||||
{
|
||||
uint8_t key = ev->u.para[0];
|
||||
bool pressed = (bool)ev->u.para[1];
|
||||
//printf("key %d %d\n", key, (int)pressed);
|
||||
|
||||
#if 0
|
||||
if (key == 19) {//right
|
||||
if (!pressed)
|
||||
KnobUpdate(0, 0, 0, 0, 0, 0);
|
||||
else
|
||||
KnobUpdate(0, 0, 0, 1.0, 0, 0);
|
||||
} else if (key == 20) {
|
||||
if (!pressed)
|
||||
KnobUpdate(0, 0, 0, 0, 0, 0);
|
||||
else
|
||||
KnobUpdate(0, 0, 0, -1.0, 0, 0);
|
||||
}if (key == 18) {//up
|
||||
if (!pressed)
|
||||
KnobUpdate(0, 0, 0, 0, 0, 0);
|
||||
else
|
||||
KnobUpdate(0, 0, 0, 0, 1.0, 0);
|
||||
} else if (key == 17) {//down
|
||||
if (!pressed)
|
||||
KnobUpdate(0, 0, 0, 0, 0, 0);
|
||||
else
|
||||
KnobUpdate(0, 0, 0, 0, -1.0, 0);
|
||||
} else if (key == 27) {
|
||||
KnobUpdate(1, 0, 0, 0, 0, 0);
|
||||
}
|
||||
#else
|
||||
|
||||
if (key == 19) {//right
|
||||
if (!pressed)
|
||||
request_UI("maps:");
|
||||
} else if (key == 20) {
|
||||
if (!pressed)
|
||||
request_UI("music:");
|
||||
} else if (key == 18) {//left
|
||||
if (pressed)
|
||||
KnobUpdate(0, 0, 0, 0, 0, 1);
|
||||
|
||||
} else if (key == 17) {//right
|
||||
if (pressed)
|
||||
KnobUpdate(0, 0, 0, 0, 0, -1);
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
static void onEventCarplay(void* ctx, const struct carlink_event *ev)
|
||||
{
|
||||
enum CARLINK_EVENT_TYPE type;
|
||||
struct carplay_ctx* pctx = (struct carplay_ctx*)ctx;
|
||||
|
||||
if (NULL == ev)
|
||||
return;
|
||||
if (ev->link_type != CARLINK_CARPLAY_WIRELESS && !ev->disable_filter)// skip not aa event
|
||||
return;
|
||||
|
||||
type = ev->type;
|
||||
|
||||
|
||||
switch (type) {
|
||||
case CARLINK_EVENT_KEY_EVENT:
|
||||
if (!pctx->mCarplayConnected)
|
||||
break;
|
||||
carlink_cp_input_event_proc(ev);
|
||||
break;
|
||||
case -1: {
|
||||
break;
|
||||
}
|
||||
case CARLINK_EVENT_INIT_DONE:
|
||||
pctx->mInitDone = true;printf("%s:%d\r\n", __func__, __LINE__);
|
||||
start_cp(pctx);
|
||||
break;
|
||||
case CARLINK_EVENT_BT_CONNECT: {
|
||||
break;
|
||||
}
|
||||
case CARLINK_EVENT_BT_IAP_READY: {
|
||||
pctx->mIapReady = true;
|
||||
printf("%s:%d\r\n", __func__, __LINE__);
|
||||
start_cp(pctx);
|
||||
break;
|
||||
}
|
||||
case CARLINK_EVENT_BT_DISCONNECT: {
|
||||
printf("bt disconnect, iap disconnect %d %d\r\n", pctx->mIapReady, pctx->mPhoneCarplayFlag);
|
||||
if (pctx->mIapReady && !pctx->mPhoneCarplayFlag) {
|
||||
//<2F>ֻ<EFBFBD><D6BB><EFBFBD>"Carplay<61><79><EFBFBD><EFBFBD>"<22>رգ<D8B1>ͬʱƻ<CAB1><C6BB><EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD>ر<EFBFBD><D8B1>ˣ<EFBFBD>ִ<EFBFBD><D6B4>һ<EFBFBD><D2BB>carplay stop
|
||||
carplay_stop();
|
||||
}
|
||||
pctx->mIapReady = false;
|
||||
break;
|
||||
}
|
||||
case CARLINK_EVENT_WIFI_CONNECT: {
|
||||
break;
|
||||
}
|
||||
case CARLINK_EVENT_MSG_SESSION_CONNECT: {
|
||||
printf("CARLINK_EVENT_MSG_SESSION_CONNECT\r\n");
|
||||
pctx->mCarplayConnected = 1;
|
||||
carplay_flag = 1;
|
||||
break;
|
||||
}
|
||||
case CARLINK_EVENT_MSG_SESSION_STOP: {
|
||||
if (0 == pctx->mCarplayConnected) {
|
||||
printf("carplay connect timeout!\n");
|
||||
if (pctx->mPhoneCarplayFlag) {
|
||||
carlink_restart_bt_wifi();
|
||||
}
|
||||
} else {
|
||||
pctx->mCarplayConnected = 0;
|
||||
carplay_flag = 0;
|
||||
carlink_bt_open();
|
||||
printf("%s:%d\r\n", __func__, __LINE__);
|
||||
start_cp(pctx);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CARLINK_EVENT_MSG_DISABLE_BT: {
|
||||
printf("%s:%d status:%d\r\n", __func__, __LINE__, pctx->mPhoneCarplayFlag);
|
||||
carlink_bt_close();
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void carplay_iap_data_read(void* ctx, const void* buf, int len)
|
||||
{
|
||||
struct carplay_ctx* pctx = (struct carplay_ctx*)ctx;
|
||||
|
||||
if (!pctx->mIapReady)
|
||||
return;
|
||||
|
||||
iap2_read_data_proc((char*)buf, len);
|
||||
}
|
||||
|
||||
|
||||
static void taskInitCarlinkCpProc(void* param)
|
||||
{
|
||||
struct carplay_ctx* pctx = &g_cp_handle;
|
||||
struct carlink_event ev = {0};
|
||||
int ret = -1;
|
||||
#if 0
|
||||
carplay_init_parameter();
|
||||
carlink_bt_wifi_init();
|
||||
//start_mdnsd();
|
||||
vTaskDelay(pdMS_TO_TICKS(2000));
|
||||
carplay_modules_test();
|
||||
vTaskDelete(NULL);
|
||||
return;
|
||||
#endif
|
||||
|
||||
(void)param;
|
||||
|
||||
|
||||
iap2_callbacks iap2_cbs;
|
||||
memset((void *)&iap2_cbs, 0, sizeof(iap2_cbs));
|
||||
iap2_cbs.iap2_link_status_cb = iap2_link_status;
|
||||
iap2_cbs.iap2_write_data_cb = iap2_write_data;
|
||||
iap2_cbs.iap2_msg_time_update_cb = iap2_msg_time_update;
|
||||
iap2_cbs.iap2_msg_gps_cb = iap2_msg_gps;
|
||||
iap2_cbs.iap2_msg_gps_gprmc_data_status_cb = iap2_msg_gps_gprmc_data_status;
|
||||
iap2_cbs.iap2_msg_identify_cb = iap2_msg_identify;
|
||||
iap2_cbs.iap2_msg_wl_carplay_update_cb = iap2_msg_wl_carplay_update;
|
||||
iap2_cbs.iap2_msg_msg_json_cb = carplay_msg_notify;
|
||||
iap2_cbs.ctx = (void *)(pctx);
|
||||
iap2_register_callbacks(&iap2_cbs);
|
||||
|
||||
carplaySessionCbs carplay_cbs;
|
||||
memset((void *)&carplay_cbs, 0, sizeof(carplay_cbs));
|
||||
carplay_cbs.SessionStarted = carplay_session_started;
|
||||
carplay_cbs.SessionStop = carplay_session_Stop;
|
||||
carplay_cbs.SessionModesChanged = carplay_session_modes_changed;
|
||||
carplay_cbs.SessionRequestUI = carplay_session_requestUI;
|
||||
carplay_cbs.SessionDuckAudio = carplay_session_duck_audio;
|
||||
carplay_cbs.SessionUnduckAudio = carplay_session_unduck_audio;
|
||||
carplay_cbs.DisableBtSession = carplay_disable_bt_session;
|
||||
carplay_cbs.ViewAreaUpdateNotify = carplay_viewArea_update_notify;
|
||||
carplay_cbs.MsgNotify = carplay_msg_notify;
|
||||
carplay_cbs.ctx = (void *)(pctx);
|
||||
carplay_register_callbacks((void *)(&carplay_cbs));
|
||||
|
||||
video_callbacks_t video_cbs;
|
||||
memset((void *)&video_cbs, 0, sizeof(video_cbs));
|
||||
video_cbs.video_start_callback = video_start_callback_impl;
|
||||
video_cbs.video_stop_callback = video_stop_callback_impl;
|
||||
video_cbs.video_proc_data_callback = video_proc_data_callback_impl;
|
||||
video_cbs.ctx = NULL;
|
||||
video_register_callbacks((void *)(&video_cbs));
|
||||
|
||||
audio_callbacks_t audio_cbs;
|
||||
memset((void *)&audio_cbs, 0, sizeof(audio_cbs));
|
||||
audio_cbs.audio_start_callback = audio_start_callback_impl;
|
||||
audio_cbs.audio_stop_callback = audio_stop_callback_impl;
|
||||
audio_cbs.audio_reset_DSP_mode_callback = resetDspMode;
|
||||
audio_cbs.ctx = NULL;
|
||||
audio_register_callbacks((void *)(&audio_cbs));
|
||||
|
||||
set_carlink_display_info(0, 0, CARLINK_VIDEO_WIDTH, CARLINK_VIDEO_HEIGHT);
|
||||
set_carlink_video_info(CARLINK_VIDEO_WIDTH, CARLINK_VIDEO_HEIGHT, 30);
|
||||
carplay_init_parameter();
|
||||
|
||||
ret = carlink_common_init();
|
||||
if (0 != ret) {
|
||||
printf("%s:%d failed\n", __func__, __LINE__);
|
||||
}
|
||||
|
||||
pctx->carlinkEventCB.onEvent = onEventCarplay;
|
||||
pctx->carlinkEventCB.rfcomm_data_read = carplay_iap_data_read;
|
||||
pctx->carlinkEventCB.cb_ctx = (void*)pctx;
|
||||
|
||||
carlink_register_event_callbacks(&pctx->carlinkEventCB);
|
||||
|
||||
#if 1
|
||||
carlink_bt_wifi_init();
|
||||
carplay_init();
|
||||
|
||||
carplay_notify_event(&ev, CARLINK_EVENT_INIT_DONE, 0);
|
||||
#else
|
||||
carplay_modules_test();
|
||||
#endif
|
||||
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
|
||||
static void carplay_init_parameter()
|
||||
{
|
||||
g_link_info->link_type = CARPLAY_WIRELESS;
|
||||
|
||||
g_link_info->iap2_name = IAP2NAME;
|
||||
g_link_info->iap2_modelIdentifier = IAP2MODEID;
|
||||
g_link_info->iap2_manfacturer =MANFACTURER;
|
||||
g_link_info->iap2_serialnumber = SERIALNUMBER;
|
||||
g_link_info->iap2_sw_ver = SWVER;
|
||||
g_link_info->iap2_hw_ver = HWVER;
|
||||
g_link_info->iap2_vehicleInfo_name = VEHICLENAME;
|
||||
g_link_info->iap2_product_uuid = "101375-0068";
|
||||
|
||||
g_link_info->manfacturer = MANFACTURER;
|
||||
g_link_info->oem_icon_label = OEMICONLABEL;
|
||||
g_link_info->oem_icon_path = OEMICONPATH;
|
||||
g_link_info->os_info = OSINFO;
|
||||
g_link_info->iOSVersionMin = iOS_VER_MIN;
|
||||
g_link_info->limited_ui_elements = LIMITEDUIELEMENTS;
|
||||
g_link_info->guuid = DEFAULTUUID;
|
||||
g_link_info->devid = DEFAULTDEVID;
|
||||
|
||||
g_link_info->oem_icon_visible = 0;//ISOEMICONVISIBLE;
|
||||
g_link_info->limited_ui = ISLIMITEDUI;
|
||||
g_link_info->right_hand_driver = ISRIGHTHANDDRIVER;
|
||||
g_link_info->night_mode = 0;
|
||||
g_link_info->has_knob = HAS_KNOB;
|
||||
g_link_info->has_telbutton = 1;
|
||||
g_link_info->has_mediabutton = 1;
|
||||
g_link_info->has_proxsensor = HAS_PROXSENSOR;
|
||||
g_link_info->has_EnhancedReqCarUI = HAS_EnhancedRequestCarUI;
|
||||
g_link_info->has_ETCSupported = HAS_ETC;
|
||||
g_link_info->HiFiTouch = 1;
|
||||
g_link_info->LoFiTouch = 0;
|
||||
|
||||
g_link_info->usb_country_code = kUSBCountryCodeUS;
|
||||
g_link_info->tp_verndor_code = kUSBVendorTouchScreen;
|
||||
g_link_info->tp_product_code = kUSBProductTouchScreen;
|
||||
g_link_info->tel_verndor_code = kUSBVendorTeleButtons;
|
||||
g_link_info->tel_product_code = kUSBProductTeleButtons;
|
||||
g_link_info->knob_verndor_code = kUSBVendorKnobButtons;
|
||||
g_link_info->knob_product_code = kUSBProductKnobButtons;
|
||||
g_link_info->proxsensor_verndor_code = kUSBVendorProxSensor;
|
||||
g_link_info->proxsensor_product_code = kUSBProductProxSensor;
|
||||
|
||||
g_link_info->width = CARLINK_VIDEO_WIDTH;//pixel
|
||||
g_link_info->height = CARLINK_VIDEO_HEIGHT;
|
||||
g_link_info->fps = 30;
|
||||
g_link_info->screen_width_phy = CARLINK_VIDEO_WIDTH;
|
||||
g_link_info->screen_height_phy = CARLINK_VIDEO_HEIGHT;
|
||||
|
||||
g_link_info->icurrent = 1000;
|
||||
g_link_info->enable_iap_carplay_sess = 1;
|
||||
g_link_info->keychain_path_dir = "/sf";
|
||||
g_link_info->is_old_carplay_ver = 0;
|
||||
g_link_info->enable_single_ui = 1;
|
||||
|
||||
g_link_info->disable_carplay_audio = 1;//1. audio is stream to bt;
|
||||
|
||||
//g_link_info->mfi_ic_addr = 0x22; //cp2.0
|
||||
g_link_info->mfi_ic_addr = 0x20; //cp3.0
|
||||
g_link_info->mfi_ic_i2c_bus_num = 0;
|
||||
|
||||
g_link_info->area[0].w = CARLINK_VIDEO_WIDTH;
|
||||
g_link_info->area[0].h = CARLINK_VIDEO_HEIGHT;
|
||||
g_link_info->area[0].x = 0;
|
||||
g_link_info->area[0].y = 0;
|
||||
|
||||
g_link_info->area[1].w = 1024;
|
||||
g_link_info->area[1].h = 600;
|
||||
g_link_info->area[1].x = 0;
|
||||
g_link_info->area[1].y = 0;
|
||||
|
||||
g_link_info->view_area_index = 0;
|
||||
|
||||
}
|
||||
|
||||
void carplay_modules_test();
|
||||
int carlink_cp_init()
|
||||
{
|
||||
xTaskCreate(taskInitCarlinkCpProc, "CpinitThread", 1024 * 32, NULL, configMAX_PRIORITIES / 4, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void carlink_cp_enable(int enable)
|
||||
{
|
||||
if (enable) {
|
||||
g_cp_disable = false;
|
||||
} else {
|
||||
g_cp_disable = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//int mdnsd_task();
|
||||
static void taskMdnsdProc(void* param)
|
||||
{
|
||||
//mdnsd_task();
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
|
||||
void start_mdnsd()
|
||||
{
|
||||
|
||||
xTaskCreate(taskMdnsdProc, "CpinitThread", 2048 * 4, NULL, 2, NULL);
|
||||
}
|
||||
|
||||
#else
|
||||
int carlink_cp_init()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void carlink_cp_enable(int enable)
|
||||
{
|
||||
(void)enable;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
7
MXC_A27-PCB4.5-270T/app/carlink/CP/src/carlink_cp.h
Normal file
7
MXC_A27-PCB4.5-270T/app/carlink/CP/src/carlink_cp.h
Normal file
@ -0,0 +1,7 @@
|
||||
#ifndef _CARLINK_CP_H_
|
||||
#define _CARLINK_CP_H_
|
||||
|
||||
int carlink_cp_init();
|
||||
void carlink_cp_enable(int enable);
|
||||
|
||||
#endif
|
216
MXC_A27-PCB4.5-270T/app/carlink/CP/src/carlink_cp_audio_impl.c
Normal file
216
MXC_A27-PCB4.5-270T/app/carlink/CP/src/carlink_cp_audio_impl.c
Normal file
@ -0,0 +1,216 @@
|
||||
#include <FreeRTOS_POSIX.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <task.h>
|
||||
#include "os_adapt.h"
|
||||
#include "carlink_cp_priv.h"
|
||||
#include "carplay.h"
|
||||
#include "board.h"
|
||||
#include "audio.h"
|
||||
|
||||
|
||||
struct cp_audio_ctx
|
||||
{
|
||||
int handle;
|
||||
int type;
|
||||
int rate;
|
||||
int bits;
|
||||
int channels;
|
||||
|
||||
int start;
|
||||
int input;
|
||||
|
||||
struct audio_device *play_handle;
|
||||
struct audio_device *rec_handle;
|
||||
|
||||
pthread_t play_pid;
|
||||
pthread_t *play_pid_ptr;
|
||||
pthread_t rec_pid;
|
||||
pthread_t *rec_pid_ptr;
|
||||
};
|
||||
|
||||
struct audio_node
|
||||
{
|
||||
struct cp_audio_ctx entity;
|
||||
int isUse;
|
||||
};
|
||||
static struct audio_node gnode[8];
|
||||
static pthread_mutex_t g_node_lock = { \
|
||||
.xIsInitialized = pdFALSE, \
|
||||
.xMutex = { { 0 } }, \
|
||||
.xTaskOwner = NULL, \
|
||||
.xAttr = { .iType = 0 } \
|
||||
};
|
||||
|
||||
uint64_t UpTicks( void );
|
||||
|
||||
|
||||
static struct cp_audio_ctx* get_free_audio_node()
|
||||
{
|
||||
int i;
|
||||
struct cp_audio_ctx *pctx = NULL;
|
||||
struct audio_node* ptr= gnode;
|
||||
|
||||
pthread_mutex_lock(&g_node_lock);
|
||||
for (i = 0; i < ARRAY_SIZE(gnode); i++) {
|
||||
if (!ptr[i].isUse) {
|
||||
ptr[i].isUse = 1;
|
||||
pctx = &ptr[i].entity;
|
||||
break;
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&g_node_lock);
|
||||
return pctx;
|
||||
}
|
||||
|
||||
static struct cp_audio_ctx* get_audio_node_by_handle(int handle)
|
||||
{
|
||||
int i;
|
||||
struct cp_audio_ctx *pctx = NULL;
|
||||
struct audio_node* ptr= gnode;
|
||||
|
||||
pthread_mutex_lock(&g_node_lock);
|
||||
for (i = 0; i < ARRAY_SIZE(gnode); i++) {
|
||||
if (ptr[i].isUse) {
|
||||
struct cp_audio_ctx *tmp = &ptr[i].entity;
|
||||
if (tmp->handle == handle) {
|
||||
pctx = tmp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&g_node_lock);
|
||||
return pctx;
|
||||
}
|
||||
|
||||
|
||||
static void release_audio_node(struct cp_audio_ctx *pctx)
|
||||
{
|
||||
int i;
|
||||
struct audio_node* ptr= gnode;
|
||||
if (NULL == pctx)
|
||||
return;
|
||||
|
||||
memset((void*)pctx, 0, sizeof(struct cp_audio_ctx));
|
||||
pthread_mutex_lock(&g_node_lock);
|
||||
for (i = 0; i < ARRAY_SIZE(gnode); i++) {
|
||||
if (pctx == &ptr[i].entity) {
|
||||
ptr[i].isUse = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&g_node_lock);
|
||||
}
|
||||
|
||||
static void * _AudioStreamRecordThread( void *inArg )
|
||||
{
|
||||
struct cp_audio_ctx* pctx = (struct cp_audio_ctx*)inArg;
|
||||
(void)pctx;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
static void * _AudioStreamPlayThread( void *inArg )
|
||||
{
|
||||
struct cp_audio_ctx* pctx = (struct cp_audio_ctx*)inArg;
|
||||
uint8_t buffer[960];
|
||||
int buffer_len = 960;
|
||||
int frame;
|
||||
|
||||
frame = 960 / (pctx->channels * pctx->channels / 8);
|
||||
|
||||
process_play_stream(pctx->handle, buffer, buffer_len, frame, UpTicks());
|
||||
|
||||
while(pctx->start) {
|
||||
process_play_stream(pctx->handle, buffer, buffer_len, frame, UpTicks());
|
||||
audio_dev_write(pctx->play_handle, buffer, buffer_len);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
int carlink_cp_audio_start(int handle, int type, int rate, int bits, int channels)
|
||||
{
|
||||
int ret = -1;
|
||||
struct cp_audio_ctx* pctx = NULL;
|
||||
struct audio_caps caps = {0};
|
||||
pthread_attr_t attr;
|
||||
pthread_attr_init(&attr);
|
||||
pthread_attr_setstacksize(&attr, 4096 * 12);
|
||||
|
||||
pctx = get_free_audio_node();
|
||||
if (NULL == pctx) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
pctx->bits = bits;
|
||||
pctx->channels = channels;
|
||||
pctx->rate = rate;
|
||||
pctx->type = type;
|
||||
pctx->handle = handle;
|
||||
|
||||
if (type == AUDIO_TELEPHONE || type == AUDIO_RECOGNITION) {
|
||||
pctx->input = 1;
|
||||
}
|
||||
|
||||
pctx->play_handle = audio_dev_open(AUDIO_FLAG_REPLAY);
|
||||
caps.main_type = AUDIO_TYPE_OUTPUT;
|
||||
caps.sub_type = AUDIO_DSP_PARAM;
|
||||
caps.udata.config.samplerate = rate;
|
||||
caps.udata.config.channels = channels;
|
||||
caps.udata.config.samplebits = bits;
|
||||
audio_dev_configure(pctx->play_handle, &caps);
|
||||
|
||||
pctx->start = 1;
|
||||
if (pctx->input) {
|
||||
pctx->rec_handle = audio_dev_open(AUDIO_FLAG_RECORD);
|
||||
caps.main_type = AUDIO_TYPE_OUTPUT;
|
||||
caps.sub_type = AUDIO_DSP_PARAM;
|
||||
caps.udata.config.samplerate = rate;
|
||||
caps.udata.config.channels = channels;
|
||||
caps.udata.config.samplebits = bits;
|
||||
audio_dev_configure(pctx->play_handle, &caps);
|
||||
ret = pthread_create( &pctx->rec_pid, &attr, _AudioStreamRecordThread, (void*)pctx );
|
||||
if (ret == 0) {
|
||||
pctx->rec_pid_ptr = &pctx->rec_pid;
|
||||
}
|
||||
}
|
||||
|
||||
ret = pthread_create( &pctx->play_pid, &attr, _AudioStreamPlayThread, (void*)pctx );
|
||||
if (ret == 0) {
|
||||
pctx->play_pid_ptr = &pctx->play_pid;
|
||||
}
|
||||
|
||||
//exit:
|
||||
return ret;
|
||||
}
|
||||
|
||||
void carlink_cp_audio_stop(int handle, int type)
|
||||
{
|
||||
struct cp_audio_ctx *pctx = NULL;
|
||||
|
||||
pctx = get_audio_node_by_handle(handle);
|
||||
|
||||
if (NULL == pctx || !pctx->start)
|
||||
return;
|
||||
|
||||
pctx->start = 0;
|
||||
|
||||
if (pctx->play_pid_ptr) {
|
||||
pthread_join(pctx->play_pid, NULL);
|
||||
pctx->play_pid_ptr = NULL;
|
||||
}
|
||||
|
||||
if (pctx->rec_pid_ptr) {
|
||||
pthread_join(pctx->rec_pid, NULL);
|
||||
pctx->rec_pid_ptr = NULL;
|
||||
}
|
||||
|
||||
release_audio_node(pctx);
|
||||
}
|
||||
|
393
MXC_A27-PCB4.5-270T/app/carlink/CP/src/carlink_cp_bt_wifi.c
Normal file
393
MXC_A27-PCB4.5-270T/app/carlink/CP/src/carlink_cp_bt_wifi.c
Normal file
@ -0,0 +1,393 @@
|
||||
//#include "os_adapt.h"
|
||||
#include <FreeRTOS_POSIX.h>
|
||||
#include <task.h>
|
||||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include "board.h"
|
||||
#include "timer.h"
|
||||
#include "iot_wifi.h"
|
||||
#include "mmcsd_core.h"
|
||||
#include "carlink_utils.h"
|
||||
#include "console.h"
|
||||
#include "fsc_bt.h"
|
||||
#include "iap.h"
|
||||
|
||||
#if !defined(USE_LWIP) || !USE_LWIP
|
||||
#error "Carplay need lwip!"
|
||||
#endif
|
||||
|
||||
#include "ethernet.h"
|
||||
#include "tcpip.h"
|
||||
#include "lwip/apps/lwiperf.h"
|
||||
#include "dhcp.h"
|
||||
|
||||
#include "carlink_video.h"
|
||||
#include "mycommon.h"
|
||||
#include "wifi_conf.h"
|
||||
#include "carlink_cp_priv.h"
|
||||
//#define USE_WLAN_STA
|
||||
|
||||
|
||||
static char g_cp_bt_mac[13] = {0};
|
||||
static bool g_cp_bt_mac_ready = false;
|
||||
|
||||
static uint8_t cp_ap_ssid[64] = {"ap63011"};
|
||||
static uint8_t cp_ap_passwd[16] = {"88888888"};
|
||||
extern int wps_connect_done;
|
||||
|
||||
|
||||
static const uint8_t ucIPAddress[4] = {192, 168, 13, 1};
|
||||
static const uint8_t ucNetMask[4] = {255, 255, 255, 0};
|
||||
static const uint8_t ucGatewayAddress[4] = {0, 0, 0, 0};
|
||||
static int lwip_tcpip_init_done_flag = 0;
|
||||
|
||||
//static int g_bt_iap_ready = 0;
|
||||
//static int g_dhcp_client_cp_ready = 0;
|
||||
|
||||
static struct netif gnetif[4];
|
||||
|
||||
extern int wifi_add_custom_ie(void *cus_ie, int ie_num);
|
||||
int mmcsd_wait_sdio_ready(int32_t timeout);
|
||||
static void cp_reset_wifi_ap_info(const char *prefex);
|
||||
static void cp_start_wlan();
|
||||
extern err_t dhcp_server_start(struct netif *netif, ip4_addr_t *start, ip4_addr_t *end);
|
||||
extern err_t wlan_ethernetif_init(struct netif *netif);
|
||||
#define lwip_ipv4_addr(addr) ((addr[0]) | (addr[1] << 8) | (addr[2] << 16) | (addr[3] << 24))
|
||||
|
||||
|
||||
static void tcpip_init_done(void *arg)
|
||||
{
|
||||
(void)arg;
|
||||
//lwip_tcpip_init_done_flag = 1;
|
||||
}
|
||||
|
||||
void lwiperf_report_cb_impl(void *arg, enum lwiperf_report_type report_type,
|
||||
const ip_addr_t* local_addr, u16_t local_port, const ip_addr_t* remote_addr, u16_t remote_port,
|
||||
u32_t bytes_transferred, u32_t ms_duration, u32_t bandwidth_kbitpsec)
|
||||
{
|
||||
(void)arg;
|
||||
|
||||
printf("lwiperf_report_cb_impl bytes:%d %d ms \r\n", bytes_transferred, ms_duration);
|
||||
}
|
||||
|
||||
int cp_wlan_tcp_ip_is_ready()
|
||||
{
|
||||
return lwip_tcpip_init_done_flag;
|
||||
}
|
||||
|
||||
//dd3000a0400000020022020961726B6D6963726F0003064C696E75780004030102030606ffffffffffff070666fadde250c0
|
||||
static u8 carplay_vendor_ie[] = {
|
||||
0xdd, 0x30, 0x00, 0xa0, 0x40, 0x00, 0x00, 0x02, 0x00, 0x22, 0x02, 0x09, 0x61, 0x72, 0x6B, 0x6D,
|
||||
0x69, 0x63, 0x72, 0x6F, 0x00, 0x03, 0x06, 0x4C, 0x69, 0x6E, 0x75, 0x78, 0x00, 0x04, 0x03, 0x01,
|
||||
0x02, 0x03, 0x06, 0x06, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x06, 0x66, 0xfa, 0xdd, 0xe2,
|
||||
0x50, 0xc0
|
||||
};
|
||||
rtw_custom_ie_t carplay_ie[1] = {{carplay_vendor_ie, PROBE_RSP | BEACON}};
|
||||
|
||||
void carplay_add_vendor_ie()
|
||||
{
|
||||
wifi_add_custom_ie((void *)carplay_ie, 1);
|
||||
}
|
||||
|
||||
void carplay_ie_replace_bt_mac(const char* btmac_str, int btmac_str_len)
|
||||
{
|
||||
char btmac[6] = {0};
|
||||
string2hex((char *)btmac_str, btmac_str_len, btmac, 6);
|
||||
memcpy((void*)g_link_info->btmac, (void*)btmac, 6);
|
||||
//sscanf(btmac_str, "%02x%02x%02x%02x%02x%02x", btmac[0], btmac[1], btmac[2], btmac[3], btmac[4], btmac[5]);
|
||||
carplay_vendor_ie[36] = btmac[0];
|
||||
carplay_vendor_ie[37] = btmac[1];
|
||||
carplay_vendor_ie[38] = btmac[2];
|
||||
carplay_vendor_ie[39] = btmac[3];
|
||||
carplay_vendor_ie[40] = btmac[4];
|
||||
carplay_vendor_ie[41] = btmac[5];
|
||||
//memcpy((void*)(carplay_vendor_ie + 36), (void*)btmac, 6);
|
||||
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < sizeof(carplay_vendor_ie); i++) {
|
||||
printf("0x%02x, ", carplay_vendor_ie[i]);
|
||||
}printf("\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(USE_WLAN_STA)
|
||||
static void dump_ip_addr(const char *msg, const ip_addr_t *server_addr)
|
||||
{
|
||||
printf("%s %d.%d.%d.%d \r\n", msg,
|
||||
ip4_addr1_16(ip_2_ip4(server_addr)), ip4_addr2_16(ip_2_ip4(server_addr)), ip4_addr3_16(ip_2_ip4(server_addr)), ip4_addr4_16(ip_2_ip4(server_addr)));
|
||||
}
|
||||
|
||||
static void cp_dhcp_client_status_callback(struct netif *netif, int status, const ip_addr_t *server_addr)
|
||||
{
|
||||
if (&gnetif[0] == netif) {
|
||||
dump_ip_addr("dhcp server ip :", (const ip_addr_t *)server_addr);
|
||||
dump_ip_addr("dhcp client ip :", (const ip_addr_t *)&netif->ip_addr);
|
||||
dump_ip_addr("dhcp client netmask:", (const ip_addr_t *)&netif->netmask);
|
||||
dump_ip_addr("dhcp client gw :", (const ip_addr_t *)&netif->gw);
|
||||
ip_addr_t *server_addr1 = (ip_addr_t *)&netif->ip_addr;
|
||||
g_link_info->ip_v4_addr[0] = ip4_addr1_16(ip_2_ip4(server_addr1));
|
||||
g_link_info->ip_v4_addr[1] = ip4_addr2_16(ip_2_ip4(server_addr1));
|
||||
g_link_info->ip_v4_addr[2] = ip4_addr3_16(ip_2_ip4(server_addr1));
|
||||
g_link_info->ip_v4_addr[3] = ip4_addr4_16(ip_2_ip4(server_addr1));
|
||||
//g_dhcp_client_cp_ready = 1;
|
||||
|
||||
//if (g_bt_iap_ready)
|
||||
//carplay_start();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void restart_bt_wifi()
|
||||
{
|
||||
cp_bt_close();
|
||||
netif_set_down(&gnetif[0]);
|
||||
WIFI_Off();
|
||||
vTaskDelay(pdMS_TO_TICKS(2000));
|
||||
cp_bt_open();
|
||||
start_ap(36, (const char *)cp_ap_ssid, (const char *)cp_ap_passwd, 1);
|
||||
carplay_add_vendor_ie();
|
||||
netif_set_default(&gnetif[0]);
|
||||
|
||||
netif_set_up(&gnetif[0]);
|
||||
}
|
||||
|
||||
static void cp_start_wlan()
|
||||
{
|
||||
char ap_prefix[5] = {0};
|
||||
|
||||
ip4_addr_t ip_addr;
|
||||
ip4_addr_t netmask;
|
||||
ip4_addr_t gw;
|
||||
ip4_addr_t dhcp_addr_start;
|
||||
ip4_addr_t dhcp_addr_end;
|
||||
|
||||
while(!g_cp_bt_mac_ready) {
|
||||
vTaskDelay(pdMS_TO_TICKS(10));
|
||||
}
|
||||
memcpy(ap_prefix, g_cp_bt_mac + 8, 4);
|
||||
cp_reset_wifi_ap_info(ap_prefix);
|
||||
#if !defined(USE_WLAN_STA)
|
||||
start_ap(36, (const char *)cp_ap_ssid, (const char *)cp_ap_passwd, 1);
|
||||
#else
|
||||
//start_sta((const char *)cp_ap_ssid, (const char *)cp_ap_passwd, 1);
|
||||
dhcp_regisger_status_callback(cp_dhcp_client_status_callback);
|
||||
#endif
|
||||
|
||||
ip_addr.addr = lwip_ipv4_addr(ucIPAddress);
|
||||
netmask.addr = lwip_ipv4_addr(ucNetMask);
|
||||
gw.addr = lwip_ipv4_addr(ucGatewayAddress);
|
||||
tcpip_init(tcpip_init_done, NULL);
|
||||
netif_add(&gnetif[0],
|
||||
#if LWIP_IPV4
|
||||
&ip_addr, &netmask, &gw,
|
||||
#endif
|
||||
NULL, wlan_ethernetif_init, tcpip_input);
|
||||
|
||||
netif_set_default(&gnetif[0]);
|
||||
|
||||
#if !defined(USE_WLAN_STA)
|
||||
uint8_t addr_start[4] = {192, 168, 13, 20};
|
||||
uint8_t addr_end[4] = {192, 168, 13, 30};
|
||||
dhcp_addr_start.addr = lwip_ipv4_addr(addr_start);
|
||||
dhcp_addr_end.addr = lwip_ipv4_addr(addr_end);
|
||||
dhcp_server_start(&gnetif[0], &dhcp_addr_start, &dhcp_addr_end);
|
||||
//g_dhcp_client_cp_ready = 1;
|
||||
#endif
|
||||
|
||||
//netif_set_up(&gnetif[0]);
|
||||
lwiperf_start_tcp_server_default(lwiperf_report_cb_impl, NULL);
|
||||
lwip_tcpip_init_done_flag = 1;
|
||||
carplay_add_vendor_ie();
|
||||
}
|
||||
|
||||
void cp_wlan_start(void){
|
||||
netif_set_up(&gnetif[0]);
|
||||
}
|
||||
|
||||
|
||||
static void cp_reset_wifi_ap_info(const char *prefex)
|
||||
{
|
||||
if (prefex) {
|
||||
memset(cp_ap_ssid, 0, sizeof(cp_ap_ssid));
|
||||
sprintf((char *)cp_ap_ssid, "AP630_CP_%s", prefex);
|
||||
}
|
||||
g_link_info->wifi_passwd = cp_ap_passwd;
|
||||
g_link_info->wifi_ssid = cp_ap_ssid;
|
||||
g_link_info->wifi_channel = 36;
|
||||
g_link_info->ip_v4_addr[0] = ucIPAddress[0];
|
||||
g_link_info->ip_v4_addr[1] = ucIPAddress[1];
|
||||
g_link_info->ip_v4_addr[2] = ucIPAddress[2];
|
||||
g_link_info->ip_v4_addr[3] = ucIPAddress[3];
|
||||
}
|
||||
|
||||
static void cp_bt_callback(char * cAtStr)
|
||||
{
|
||||
char* cmd_para = NULL;
|
||||
printf("\r\nfsc_bt_callback_ec %s %d\r\n", cAtStr, strlen(cAtStr));
|
||||
struct cp_event ev;
|
||||
memset((void*)&ev, 0, sizeof(ev));
|
||||
ev.type = -1;
|
||||
|
||||
if (0) {
|
||||
} else if (0 == strncmp(cAtStr, "+IAPDATA=", 9)) {
|
||||
char ble_buf[256] = {0};
|
||||
int data_len, i;
|
||||
int data_str_len = (strlen(cAtStr) - 9);
|
||||
cmd_para = cAtStr + 9;
|
||||
data_len = data_str_len / 2;
|
||||
string2hex(cmd_para, data_str_len, ble_buf, data_len);
|
||||
for (i = 0; i < data_len; i++) {
|
||||
printf("%02x ", ble_buf[i]);
|
||||
}printf("\r\n");
|
||||
iap2_read_data_proc(ble_buf, data_len);
|
||||
} else if (0 == strncmp(cAtStr, "+GATTDATA=", 10)) {
|
||||
} else if (0 == strncmp(cAtStr, "+GATTSTAT=1",11)) {
|
||||
//ev.type = EC_EVENT_BT_DISCONNECT;
|
||||
printf("TRACE[%s][%d]:EC_EVENT_BT_DISCONNECT\r\n",__func__ ,__LINE__);
|
||||
ev.type = CP_EVENT_BT_DISCONNECT;
|
||||
carlink_cp_notify_event(&ev);
|
||||
} else if (0 == strncmp(cAtStr, "+GATTSTAT=3",11)) {
|
||||
printf("TRACE[%s][%d]:EC_EVENT_BT_CONNECT\r\n",__func__ ,__LINE__);
|
||||
|
||||
ev.type = CP_EVENT_BT_CONNECT;
|
||||
carlink_cp_notify_event(&ev);
|
||||
} else if (0 == strncmp(cAtStr, "+ADDR=", 6)) {
|
||||
char cmd_str[64] = {0};
|
||||
sprintf(cmd_str, "AT+NAME=AP630_CP_%s\r\n", (cAtStr + 6 + 8));
|
||||
printf("ADDR:%s\r\n", cAtStr + 6);
|
||||
console_send_atcmd(cmd_str, strlen(cmd_str));//get mac addr
|
||||
memset(cmd_str, 0, sizeof(cmd_str));
|
||||
sprintf(cmd_str, "AT+LENAME=AP630_CP_%s\r\n", (cAtStr + 6 + 8));
|
||||
console_send_atcmd(cmd_str, strlen(cmd_str));//get mac addr
|
||||
memcpy(g_cp_bt_mac, (cAtStr + 6), 12);
|
||||
carplay_ie_replace_bt_mac(cAtStr + 6, 12);
|
||||
g_cp_bt_mac_ready = true;
|
||||
} else if (0 == strncmp(cAtStr, "+VER", 4)) {
|
||||
char* cmd = "AT+ADDR\r\n";
|
||||
console_send_atcmd(cmd, strlen(cmd));//get mac addr
|
||||
} else if (0 == strncmp(cAtStr, "+NAME=", 6)) {
|
||||
char cmd_str[64] = {0};
|
||||
sprintf(cmd_str, "AT+LEADDR\r\n");
|
||||
console_send_atcmd(cmd_str, strlen(cmd_str));//get LE addr
|
||||
} else if (0 == strncmp(cAtStr, "+LEADDR=", 6)) {
|
||||
char hexMacAddr[6] = {0};
|
||||
char m_tmp_buf[64] = {0};
|
||||
string2hex(&cAtStr[8], 12, hexMacAddr, sizeof(hexMacAddr));
|
||||
sprintf(m_tmp_buf, "AT+ADVDATA=%s\r\n", hexMacAddr);
|
||||
console_send_atcmd(m_tmp_buf, 19);
|
||||
} else if (0 == strncmp(cAtStr, "+GATTSENT=", 10)) {
|
||||
return;
|
||||
} else if (0 == strncmp(cAtStr, "+IAPSTAT=3", 10)) {
|
||||
//g_bt_iap_ready = 1;
|
||||
|
||||
//if (g_dhcp_client_cp_ready)
|
||||
//carplay_start();
|
||||
|
||||
ev.type = CP_EVENT_BT_IAP_READY;
|
||||
carlink_cp_notify_event(&ev);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
int iap_data_write(unsigned char *data, int len)
|
||||
{
|
||||
uint8_t *at_str = NULL, *at_str_ptr = NULL;
|
||||
uint8_t *at_prefix = "AT+IAPSEND=";
|
||||
int prefix_len = strlen((char *)at_prefix);
|
||||
int cmd_len = (len * 2 + prefix_len + 2);
|
||||
|
||||
at_str = (uint8_t *)pvPortMalloc(cmd_len + 1);
|
||||
memset(at_str, 0, cmd_len + 1);
|
||||
if (NULL == at_str)
|
||||
return -1;
|
||||
at_str_ptr = at_str;
|
||||
sprintf((char*)at_str_ptr, "%s", (char*)at_prefix);
|
||||
at_str_ptr += prefix_len;
|
||||
hex2str(data, len, (char *)at_str_ptr);
|
||||
at_str_ptr += (len * 2);
|
||||
*at_str_ptr++ = '\r';
|
||||
*at_str_ptr++ = '\n';
|
||||
console_send_atcmd((char *)at_str, cmd_len);
|
||||
vPortFree(at_str);
|
||||
return len;
|
||||
}
|
||||
|
||||
void cp_bt_open()
|
||||
{
|
||||
char at_str[] = {"AT+BTEN=1\r\n"};
|
||||
console_send_atcmd((char *)at_str, strlen(at_str));
|
||||
}
|
||||
|
||||
void cp_bt_close()
|
||||
{
|
||||
char at_str[] = {"AT+BTEN=0\r\n"};
|
||||
console_send_atcmd((char *)at_str, strlen(at_str));
|
||||
}
|
||||
|
||||
|
||||
static void cp_wifi_event_handler( WIFIEvent_t * xEvent )
|
||||
{
|
||||
WIFIEventType_t xEventType = xEvent->xEventType;
|
||||
char mac_str[32] = {0};
|
||||
char *mac = NULL;
|
||||
|
||||
if (xEvent) {
|
||||
mac = xEvent->xInfo.xAPStationConnected.ucMac;
|
||||
sprintf(mac_str, "%02x:%02x:%02x:%02x:%02x:%02x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
||||
}
|
||||
|
||||
wps_connect_done = 0;
|
||||
|
||||
if (0) {
|
||||
} else if (eWiFiEventConnected == xEventType) {// meter is sta
|
||||
printf("\r\n The meter is connected to ap \r\n");
|
||||
} else if (eWiFiEventDisconnected == xEventType) {// meter is sta
|
||||
printf("\r\n The meter is disconnected from ap \r\n");
|
||||
} else if (eWiFiEventAPStationConnected == xEventType) {// meter is ap
|
||||
printf("\r\n The meter in AP is connected by sta %s \r\n", mac_str);
|
||||
} else if (eWiFiEventAPStationDisconnected == xEventType) {// meter is ap
|
||||
printf("\r\n The sta %s is disconnected from the meter \r\n", mac_str);
|
||||
}
|
||||
}
|
||||
|
||||
static BaseType_t cp_wifi_init()
|
||||
{
|
||||
int status;
|
||||
WIFI_Context_init();
|
||||
WIFI_RegisterEvent(eWiFiEventMax, cp_wifi_event_handler);
|
||||
for (;;) {
|
||||
status = mmcsd_wait_sdio_ready((int32_t)portMAX_DELAY);
|
||||
if (status == MMCSD_HOST_PLUGED) {
|
||||
printf("detect sdio device\r\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void bt_set_support_carplay()
|
||||
{
|
||||
char cmd_str[64] = {0};
|
||||
|
||||
sprintf(cmd_str, "AT+PROFILE=33962\r\n");
|
||||
console_send_atcmd(cmd_str, strlen(cmd_str));
|
||||
}
|
||||
|
||||
int carlink_cp_bt_wifi_init()
|
||||
{
|
||||
carlink_ey_video_init();
|
||||
cp_wifi_init();
|
||||
console_register_cb(NULL, cp_bt_callback);
|
||||
fsc_bt_main();
|
||||
bt_set_support_carplay();
|
||||
cp_bt_open();
|
||||
cp_start_wlan();
|
||||
printf("bt wlan init is ok\r\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
262
MXC_A27-PCB4.5-270T/app/carlink/CP/src/carlink_cp_bt_wifi1.c
Normal file
262
MXC_A27-PCB4.5-270T/app/carlink/CP/src/carlink_cp_bt_wifi1.c
Normal file
@ -0,0 +1,262 @@
|
||||
#include "os_adapt.h"
|
||||
#include <FreeRTOS_POSIX.h>
|
||||
#include <task.h>
|
||||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include "board.h"
|
||||
#include "timer.h"
|
||||
#include "iot_wifi.h"
|
||||
#include "mmcsd_core.h"
|
||||
#include "carlink_utils.h"
|
||||
#include "console.h"
|
||||
#include "fsc_bt.h"
|
||||
#include "iap.h"
|
||||
|
||||
#if !defined(USE_LWIP) || !USE_LWIP
|
||||
#error "Carplay in freertos must use lwip!"
|
||||
#endif
|
||||
|
||||
#include "ethernet.h"
|
||||
#include "tcpip.h"
|
||||
#include "lwip/apps/lwiperf.h"
|
||||
#include "dhcp.h"
|
||||
|
||||
#include "carlink_video.h"
|
||||
#include "mycommon.h"
|
||||
|
||||
|
||||
static char g_cp_bt_mac[13] = {0};
|
||||
static bool g_cp_bt_mac_ready = false;
|
||||
|
||||
static uint8_t cp_ap_ssid[64] = {"ap63011"};
|
||||
static uint8_t cp_ap_passwd[16] = {"88888888"};
|
||||
extern int wps_connect_done;
|
||||
|
||||
|
||||
static const uint8_t ucIPAddress[4] = {192, 168, 13, 1};
|
||||
static const uint8_t ucNetMask[4] = {255, 255, 255, 0};
|
||||
static const uint8_t ucGatewayAddress[4] = {0, 0, 0, 0};
|
||||
static int lwip_tcpip_init_done_flag = 0;
|
||||
|
||||
static struct netif gnetif[4];
|
||||
|
||||
|
||||
int mmcsd_wait_sdio_ready(int32_t timeout);
|
||||
static void cp_reset_wifi_ap_info(const char *prefex);
|
||||
static void cp_start_wlan();
|
||||
extern err_t dhcp_server_start(struct netif *netif, ip4_addr_t *start, ip4_addr_t *end);
|
||||
extern err_t wlan_ethernetif_init(struct netif *netif);
|
||||
#define lwip_ipv4_addr(addr) ((addr[0]) | (addr[1] << 8) | (addr[2] << 16) | (addr[3] << 24))
|
||||
|
||||
|
||||
static void tcpip_init_done(void *arg)
|
||||
{
|
||||
(void)arg;
|
||||
//lwip_tcpip_init_done_flag = 1;
|
||||
}
|
||||
|
||||
void lwiperf_report_cb_impl(void *arg, enum lwiperf_report_type report_type,
|
||||
const ip_addr_t* local_addr, u16_t local_port, const ip_addr_t* remote_addr, u16_t remote_port,
|
||||
u32_t bytes_transferred, u32_t ms_duration, u32_t bandwidth_kbitpsec)
|
||||
{
|
||||
(void)arg;
|
||||
|
||||
printf("lwiperf_report_cb_impl bytes:%d %d ms \r\n", bytes_transferred, ms_duration);
|
||||
}
|
||||
|
||||
int cp_wlan_tcp_ip_is_ready()
|
||||
{
|
||||
return lwip_tcpip_init_done_flag;
|
||||
}
|
||||
|
||||
static void cp_start_wlan()
|
||||
{
|
||||
const char *customer = "ark630hv100";
|
||||
char ap_prefix[5] = {0};
|
||||
|
||||
ip4_addr_t ip_addr;
|
||||
ip4_addr_t netmask;
|
||||
ip4_addr_t gw;
|
||||
ip4_addr_t dhcp_addr_start;
|
||||
ip4_addr_t dhcp_addr_end;
|
||||
|
||||
while(!g_cp_bt_mac_ready) {
|
||||
vTaskDelay(pdMS_TO_TICKS(10));
|
||||
}
|
||||
memcpy(ap_prefix, g_cp_bt_mac + 8, 4);
|
||||
cp_reset_wifi_ap_info(ap_prefix);
|
||||
start_ap(36, (const char *)cp_ap_ssid, (const char *)cp_ap_passwd, 1);
|
||||
|
||||
ip_addr.addr = lwip_ipv4_addr(ucIPAddress);
|
||||
netmask.addr = lwip_ipv4_addr(ucNetMask);
|
||||
gw.addr = lwip_ipv4_addr(ucGatewayAddress);
|
||||
tcpip_init(tcpip_init_done, NULL);
|
||||
netif_add(&gnetif[0],
|
||||
#if LWIP_IPV4
|
||||
&ip_addr, &netmask, &gw,
|
||||
#endif
|
||||
NULL, wlan_ethernetif_init, tcpip_input);
|
||||
|
||||
netif_set_default(&gnetif[0]);
|
||||
|
||||
uint8_t addr_start[4] = {192, 168, 13, 20};
|
||||
uint8_t addr_end[4] = {192, 168, 13, 30};
|
||||
dhcp_addr_start.addr = lwip_ipv4_addr(addr_start);
|
||||
dhcp_addr_end.addr = lwip_ipv4_addr(addr_end);
|
||||
dhcp_server_start(&gnetif[0], &dhcp_addr_start, &dhcp_addr_end);
|
||||
|
||||
netif_set_up(&gnetif[0]);
|
||||
|
||||
lwiperf_start_tcp_server_default(lwiperf_report_cb_impl, NULL);
|
||||
lwip_tcpip_init_done_flag = 1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void cp_reset_wifi_ap_info(const char *prefex)
|
||||
{
|
||||
memset(cp_ap_ssid, 0, sizeof(cp_ap_ssid));
|
||||
sprintf((char *)cp_ap_ssid, "AP630_%s", prefex);
|
||||
g_link_info->wifi_passwd = cp_ap_passwd;
|
||||
g_link_info->wifi_ssid = cp_ap_ssid;
|
||||
g_link_info->wifi_channel = 36;
|
||||
g_link_info->ip_v4_addr[0] = ucIPAddress[0];
|
||||
g_link_info->ip_v4_addr[1] = ucIPAddress[1];
|
||||
g_link_info->ip_v4_addr[2] = ucIPAddress[2];
|
||||
g_link_info->ip_v4_addr[3] = ucIPAddress[3];
|
||||
}
|
||||
|
||||
static void cp_bt_callback(char * cAtStr)
|
||||
{
|
||||
char* cmd_para = NULL;
|
||||
printf("\r\nfsc_bt_callback_ec %s %d\r\n", cAtStr, strlen(cAtStr));
|
||||
|
||||
if (0) {
|
||||
} else if (0 == strncmp(cAtStr, "+IAPDATA=", 9)) {
|
||||
char ble_buf[256] = {0};
|
||||
int data_len, i;
|
||||
int data_str_len = (strlen(cAtStr) - 9);
|
||||
cmd_para = cAtStr + 9;
|
||||
data_len = data_str_len / 2;
|
||||
string2hex(cmd_para, data_str_len, ble_buf, data_len);
|
||||
for (i = 0; i < data_len; i++) {
|
||||
printf("%02x ", ble_buf[i]);
|
||||
}printf("\r\n");
|
||||
iap2_read_data_proc(ble_buf, data_len);
|
||||
} else if (0 == strncmp(cAtStr, "+GATTDATA=", 10)) {
|
||||
} else if (0 == strncmp(cAtStr, "+GATTSTAT=1",11)) {
|
||||
//ev.type = EC_EVENT_BT_DISCONNECT;
|
||||
printf("TRACE[%s][%d]:EC_EVENT_BT_DISCONNECT\r\n",__func__ ,__LINE__);
|
||||
} else if (0 == strncmp(cAtStr, "+GATTSTAT=3",11)) {
|
||||
printf("TRACE[%s][%d]:EC_EVENT_BT_CONNECT\r\n",__func__ ,__LINE__);
|
||||
} else if (0 == strncmp(cAtStr, "+ADDR=", 6)) {
|
||||
char cmd_str[64] = {0};
|
||||
sprintf(cmd_str, "AT+NAME=EC_%s\r\n", (cAtStr + 6));
|
||||
printf("ADDR:%s\r\n", cAtStr + 6);
|
||||
console_send_atcmd(cmd_str, strlen(cmd_str));//get mac addr
|
||||
memset(cmd_str, 0, sizeof(cmd_str));
|
||||
sprintf(cmd_str, "AT+LENAME=EC_%s\r\n", (cAtStr + 6));
|
||||
console_send_atcmd(cmd_str, strlen(cmd_str));//get mac addr
|
||||
g_cp_bt_mac_ready = true;
|
||||
memcpy(g_cp_bt_mac, (cAtStr + 6), 12);
|
||||
} else if (0 == strncmp(cAtStr, "+VER", 4)) {
|
||||
char* cmd = "AT+ADDR\r\n";
|
||||
console_send_atcmd(cmd, strlen(cmd));//get mac addr
|
||||
} else if (0 == strncmp(cAtStr, "+NAME=", 6)) {
|
||||
char cmd_str[64] = {0};
|
||||
sprintf(cmd_str, "AT+LEADDR\r\n");
|
||||
console_send_atcmd(cmd_str, strlen(cmd_str));//get LE addr
|
||||
} else if (0 == strncmp(cAtStr, "+LEADDR=", 6)) {
|
||||
char hexMacAddr[6] = {0};
|
||||
char m_tmp_buf[64] = {0};
|
||||
string2hex(&cAtStr[8], 12, hexMacAddr, sizeof(hexMacAddr));
|
||||
sprintf(m_tmp_buf, "AT+ADVDATA=%s\r\n", hexMacAddr);
|
||||
console_send_atcmd(m_tmp_buf, 19);
|
||||
} else if (0 == strncmp(cAtStr, "+GATTSENT=", 10)) {
|
||||
return;
|
||||
} else if (0 == strncmp(cAtStr, "+IAPSTAT=3", 10)) {
|
||||
carplay_start();
|
||||
}
|
||||
}
|
||||
|
||||
int iap_data_write(unsigned char *data, int len)
|
||||
{
|
||||
uint8_t *at_str = NULL, *at_str_ptr = NULL;
|
||||
uint8_t *at_prefix = "AT+IAPSEND=";
|
||||
int prefix_len = strlen((char *)at_prefix);
|
||||
int cmd_len = (len * 2 + prefix_len + 2);
|
||||
|
||||
at_str = (uint8_t *)pvPortMalloc(cmd_len + 1);
|
||||
memset(at_str, 0, cmd_len + 1);
|
||||
if (NULL == at_str)
|
||||
return -1;
|
||||
at_str_ptr = at_str;
|
||||
sprintf((char*)at_str_ptr, "%s", (char*)at_prefix);
|
||||
at_str_ptr += prefix_len;
|
||||
hex2str(data, len, (char *)at_str_ptr);
|
||||
at_str_ptr += (len * 2);
|
||||
*at_str_ptr++ = '\r';
|
||||
*at_str_ptr++ = '\n';
|
||||
console_send_atcmd((char *)at_str, cmd_len);
|
||||
vPortFree(at_str);
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
static void cp_wifi_event_handler( WIFIEvent_t * xEvent )
|
||||
{
|
||||
WIFIEventType_t xEventType = xEvent->xEventType;
|
||||
|
||||
wps_connect_done = 0;
|
||||
|
||||
if (0) {
|
||||
} else if (eWiFiEventConnected == xEventType) {// meter is sta
|
||||
printf("\r\n The meter is connected to ap \r\n");
|
||||
} else if (eWiFiEventDisconnected == xEventType) {// meter is sta
|
||||
printf("\r\n The meter is disconnected from ap \r\n");
|
||||
} else if (eWiFiEventAPStationConnected == xEventType) {// meter is ap
|
||||
printf("\r\n The meter in AP is connected by sta %s \r\n", xEvent->xInfo.xAPStationConnected.ucMac);
|
||||
} else if (eWiFiEventAPStationDisconnected == xEventType) {// meter is ap
|
||||
printf("\r\n The sta %s is disconnected from the meter \r\n", xEvent->xInfo.xAPStationDisconnected.ucMac);
|
||||
}
|
||||
}
|
||||
|
||||
static BaseType_t cp_wifi_init()
|
||||
{
|
||||
int status;
|
||||
WIFI_Context_init();
|
||||
WIFI_RegisterEvent(eWiFiEventMax, cp_wifi_event_handler);
|
||||
for (;;) {
|
||||
status = mmcsd_wait_sdio_ready((int32_t)portMAX_DELAY);
|
||||
if (status == MMCSD_HOST_PLUGED) {
|
||||
printf("detect sdio device\r\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void bt_set_support_carplay()
|
||||
{
|
||||
char cmd_str[64] = {0};
|
||||
|
||||
sprintf(cmd_str, "AT+PROFILE=33962\r\n");
|
||||
console_send_atcmd(cmd_str, strlen(cmd_str));
|
||||
}
|
||||
|
||||
int carlink_cp_bt_wifi_init()
|
||||
{
|
||||
carlink_ey_video_init();
|
||||
cp_wifi_init();
|
||||
console_register_cb(NULL, cp_bt_callback);
|
||||
fsc_bt_main();
|
||||
bt_set_support_carplay();
|
||||
cp_start_wlan();
|
||||
printf("bt wlan init is ok\r\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
53
MXC_A27-PCB4.5-270T/app/carlink/CP/src/carlink_cp_priv.h
Normal file
53
MXC_A27-PCB4.5-270T/app/carlink/CP/src/carlink_cp_priv.h
Normal file
@ -0,0 +1,53 @@
|
||||
#ifndef __CARLINK_CP_PRI_H
|
||||
#define __CARLINK_CP_PRI_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define IAP2NAME "KY CAR"
|
||||
#define IAP2MODEID "Linux"
|
||||
#define SERIALNUMBER "0123456789ABCDEF"
|
||||
#define SWVER "sw0.1"
|
||||
#define HWVER "hw0.1"
|
||||
#define VEHICLENAME "audi"
|
||||
|
||||
#define MANFACTURER "ARK"
|
||||
#define OEMICONLABEL "Home"
|
||||
#define OEMICONPATH "/sf/carplay_icon.png"
|
||||
#define OSINFO "rtos"
|
||||
#define iOS_VER_MIN "11D257"
|
||||
//#define LIMITEDUIELEMENTS "softKeyboard"
|
||||
#define LIMITEDUIELEMENTS "japanMaps"
|
||||
#define DEFAULTUUID "e5f7b72d-9b7f-4305-954b-973f612a150b"
|
||||
#define DEFAULTDEVID "10:13:52:33:67:09"
|
||||
#define ISOEMICONVISIBLE 1
|
||||
#define ISRIGHTHANDDRIVER 0
|
||||
#define ISLIMITEDUI 1
|
||||
#define HAS_KNOB 1
|
||||
#define HAS_PROXSENSOR 0
|
||||
#define HAS_ETC 0
|
||||
#define HAS_EnhancedRequestCarUI 0
|
||||
|
||||
#define kUSBCountryCodeUS 33
|
||||
#define kUSBVendorTouchScreen 0x0525
|
||||
#define kUSBProductTouchScreen 0xa4a1
|
||||
#define kUSBVendorTeleButtons 0x0525
|
||||
#define kUSBProductTeleButtons 0xa4a2
|
||||
#define kUSBVendorKnobButtons 0x0525
|
||||
#define kUSBProductKnobButtons 0xa4a2
|
||||
#define kUSBVendorProxSensor 0
|
||||
#define kUSBProductProxSensor 0
|
||||
|
||||
#define PHYSICAL_WIDTH 160
|
||||
#define PHYSICAL_HEIGHT 80
|
||||
|
||||
void carplay_modules_test();
|
||||
int carlink_cp_audio_start(int handle, int type, int rate, int bits, int channels);
|
||||
void carlink_cp_audio_stop(int handle, int type);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
Reference in New Issue
Block a user