app_private.h

来自「Bluetooth HID emulation」· C头文件 代码 · 共 123 行

H
123
字号
/* Copyright (C) Cambridge Silicon Radio Ltd. 2005-2006 */
/* Part of BlueLab 3.6.2-release */
#ifndef __app_private_h
#define __app_private_h

#include <message.h>
#include <hid.h>
#include "app_dongle_button.h"

/* 0  NO DEBUG 
   1  CONNECTION AND ENQUIRY EVENTS  
   2  DATA TRANSFER 
 */

#define HANDTEST_CFG	

#define DEBUG_LEVEL 	0

#if (DEBUG_LEVEL > 0)
#define DEBUG(x) {printf x;}
#else
#define DEBUG(x)
#endif

typedef enum
{
    appSdpOk,
    appSdpWrongHidVersion,
    appSdpMissingAttribute,
    appSdpSearchFailed,
    appSdpNotBootDevice
} appSdpResult;

typedef enum
{
    appSdpMandatory,
    appSdpOptional
} appSdpState;

typedef enum
{
    appDongleInitialising,    
    appDongleInquiry,
    appDongleActive,
    appDongleClearing
} appDongleState;

typedef enum
{
	appDevUnplugged,
	appDevDisconnected,
    appDevConnectingInitial,
    appDevConnectingLocal,
    appDevConnectingRemote,
    appDevConnected,
    appDevDisconnectingLocal
} appDevState;

#define APP_DONGLE_NUM_DEVICES	(2)   /* 快府版快尔 厚搅窍焙 */

#define LED_NUM_PRIORITIES  (2)
typedef struct
{
    TaskData    task;
    uint16      state;
    int         onPeriod;
    int         offPeriod;
    int         onPeriodTable[LED_NUM_PRIORITIES];
    int         offPeriodTable[LED_NUM_PRIORITIES];
    uint8       priority;
} ledTaskData;

struct appDongleTaskData;
typedef struct
{
    TaskData    				task;
    uint32						dev_class;
    uint8                       dev_num;
    Source						usb_source;
    Sink						usb_sink;
	Sink						ep_sink;
    Sink                        hid_sink;
    
    unsigned int                unplug_pending:1;

    struct 
    {
        unsigned int            hid_virtual_cable:1;
        unsigned int            hid_reconnect_initiate:1;
        unsigned int            hid_normally_connectable:1;
        bdaddr					bd_addr;
    } dev_info;

    const char                  *pin;
    Transform                   transform;
    appSdpState                 sdp_state;
    appDevState    				state;
    struct appDongleTaskData 	*theApp;
    HID							*hid;
    union 
    {
        struct
        {
            uint8 idle_rate;
            uint8 led_state;
        } keyboard;

        hid_protocol protocol;
    } settings;
} appDeviceTaskData;

typedef struct appDongleTaskData
{
    TaskData                task;
    appDeviceTaskData		dev_table[APP_DONGLE_NUM_DEVICES];
    appDongleState			state;
    ledTaskData             led;
    PioState                pio_state;
	HID_LIB					*hid_lib;
} appDongleTaskData;

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?