⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pioag_private.h

📁 bluetooth audio gateway
💻 H
字号:
#ifndef _PIOAG_PRIVATE_H
#define _PIOAG_PRIVATE_H


#include "ag_types.h"

#include <timer.h>



/* Define the PIOs used */
#define LED1    (1<<2)
#define LED2    (1<<3)

#define PIO_ENTER1  (1<<6)
#define PIO_ENTER2  (1<<7)
#define RESET_CONDITION (PIO_ENTER1 | PIO_ENTER2)

/* These are the persistent store keys used by the FEAG Application */
#define PIO_AG_PS_BASE AG_INTERFACE_PS_BASE

/* Currently AG_INTERFACE_PS_BASE is 1 so these keys are in the range 1 - 6 */
#define PIO_AG_PS_PEER_ADDR         (PIO_AG_PS_BASE+0) 
#define PIO_AG_PS_LINK_KEY          (PIO_AG_PS_BASE+1)
#define PIO_AG_PS_IS_PAIRED         (PIO_AG_PS_BASE+2)
#define PIO_AG_PS_LINK_KEY_VALID    (PIO_AG_PS_BASE+3)
#define PIO_AG_PS_PIN_CODE          (PIO_AG_PS_BASE+4)
#define PIO_AG_PS_PIN_LENGTH        (PIO_AG_PS_BASE+5)


/* Scan Timers - all timers defined in seconds */
#define PIO_AG_INQUIRY_TIMEOUT              20
#define PIO_AG_PAIRING_TIMEOUT              30
#define PIO_AG_MASTER_CONNECT_TIMEOUT       10
#define PIO_AG_SLAVE_CONNECT_TIMEOUT        20
#define PIO_AG_CONNECTION_RETRY_TIMEOUT     2

#define PIO_AG_HEADSET_COD                  0x200404


/* Connection parameters */
#define PIO_AG_USE_AUTHENTICATION  1
#define PIO_AG_USE_ENCRYPTION      0
#define PIO_AG_MAX_PARK_INTERVAL   0x960
#define PIO_AG_MIN_PARK_INTERVAL   0x640
#define PIO_AG_MAX_SNIFF_INTERVAL  0x960
#define PIO_AG_MIN_SNIFF_INTERVAL  0x100
#define PIO_AG_SNIFF_ATTEMPT       0x08
#define PIO_AG_SNIFF_TIMEOUT       0x08
#define PIO_AG_CONNECTION_TARGET   0x1108
#define PIO_AG_PAGE_SCAN_INTERVAL  0x800
#define PIO_AG_PAGE_SCAN_WINDOW    0x12

#define PIO_AG_RING_DURATION       0x04 
#define PIO_AG_RING_COUNT          0x01



/* Audio Packet Types */
#define PIO_AG_HV1                  0x0020
#define PIO_AG_HV2                  0x0040
#define PIO_AG_HV3                  0x0080


typedef enum
{
    PioAgMaster,
    PioAgSlave
} pioag_role_t;



typedef struct
{
    ag_auth_config_t  auth;
    ag_park_config_t  park;
    ag_sniff_config_t sniff;
} pioag_conn_params_t;




struct PioAgStruct
{
    uint16 pinEntered:1;
    uint16 pinLengthBytes:5;    
    uint16 inquiryComplete:1;
    uint16 connectAsSlave:1;
    ag_handle_t handle;
    TimerHandle timerHandle;
    TimerHandle connectionTimerHandle;            
    uint8 *pinCode;        
};

extern struct PioAgStruct PioAgState;



/* pioag_send.c - register a device with the security manager */
void pioAgSmAddDevReq(void);

/* pioag_send.c - reply to a pin code request */
void pioAgPinReplyReq(bd_addr_t addr);

/* pioag_send.c - initiate the creation of a connection with the specified role */
void pioAgConnectReq(pioag_role_t role, timeout_t timeout_sec);

/*  pioag_send.c - initiate an inquiry */
void pioAgInquiryReq(void);

/* pioag_send.c - reset the embebdded AG */
uint16 pioAgResetReq(void);

/* pioag_send.c - send a cancel request */
void pioAgCancelReq(void);

/* pioag_send.c - send a volume up or down request */
void pioAgVolumeReq(int8 increment);

/* pioag_send.c - send a ring command */
void pioAgRingReq(void);

/* pioag_pin.c - get the user to enter a pin code */
void pioAgGetPinCode(void);

/* pioag_pin.c - pin entry has completed */
void pioAgPinEntryComplete(void);


#endif

⌨️ 快捷键说明

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