Пример #1
0
extern void GattHandleAccessInd(GATT_ACCESS_IND_T *p_ind)
{

    if(p_ind->flags == (ATT_ACCESS_WRITE | ATT_ACCESS_PERMISSION | 
                                                     ATT_ACCESS_WRITE_COMPLETE))
    {
        bool old_hid_notify_status;
        bool new_hid_notify_status;

        old_hid_notify_status = AppCheckNotificationStatus();
 
        handleAccessWrite(p_ind);

        /* If notifications are just enabled and Key press is pending/buffered
         * notify all buffered key presses to the remote host 
         */
         
        new_hid_notify_status = AppCheckNotificationStatus();
        
        if(!old_hid_notify_status && new_hid_notify_status
            && g_btcar_data.data_pending && g_btcar_data.encrypt_enabled
            && !g_btcar_data.data_tx_in_progress &&
            !g_btcar_data.waiting_for_fw_buffer)
        {
            /* Scanning already on-going, send key-press data stored in queue */
            SendKeyStrokesFromQueue();
        }
    }
    else if(p_ind->flags == (ATT_ACCESS_READ | ATT_ACCESS_PERMISSION))
    {
        handleAccessRead(p_ind);
    }
}
Пример #2
0
extern void GattHandleAccessInd(GATT_ACCESS_IND_T *p_ind)
{
 if(p_ind->flags == (ATT_ACCESS_WRITE | ATT_ACCESS_PERMISSION |
                                                     ATT_ACCESS_WRITE_COMPLETE))
    {
        bool old_hid_notify_status;
       
        old_hid_notify_status = AppCheckNotificationStatus();
        
        handleAccessWrite(p_ind);
        
#ifdef PENDING_REPORT_WAIT      
        if(g_kbd_data.pending_report_tid != TIMER_INVALID)
        {
           /* Delete the pending timer */   
           TimerDelete(g_kbd_data.pending_report_tid);
           g_kbd_data.pending_report_tid = TIMER_INVALID;
           
           /* Recreate the timer */
           g_kbd_data.pending_report_tid =
                                  TimerCreate(PENDING_REPORT_WAIT_TIMEOUT,
                                              TRUE,
                                              HandlePendingReportsTimerExpiry);
        }   
#else /* PENDING_REPORT_WAIT */
        /* If notifications are just enabled and Key press is pending/buffered
         * notify all buffered key presses to the remote host
         */
         bool new_hid_notify_status;

        new_hid_notify_status = AppCheckNotificationStatus();

        if(!old_hid_notify_status && new_hid_notify_status
            && g_kbd_data.data_pending && g_kbd_data.encrypt_enabled
            && !g_kbd_data.data_tx_in_progress &&
            !g_kbd_data.waiting_for_fw_buffer)
        {
            /* Scanning already on-going, send key-press data stored in queue */
            SendKeyStrokesFromQueue();
        }
#endif 
    }
    else if(p_ind->flags == (ATT_ACCESS_READ | ATT_ACCESS_PERMISSION))
    {
        handleAccessRead(p_ind);
    }

}