📄 hid_mouse_events.c
字号:
/****************************************************************************
Copyright (C) Cambridge Silicon Radio Ltd. 2005-2006
Part of BlueLab 3.5.2-release
FILE NAME
hid_mouse_events.c
DESCRIPTION
This file contains the functions to handle HID events.
NOTES
*/
/****************************************************************************
Header files
*/
#include "hid_mouse.h"
#include "hid_mouse_sm.h"
#include "hid_mouse_events.h"
/*************************************************************************
NAME
appHandleHidSetReportInd
DESCRIPTION
Handles HID_SET_REPORT packets.
RETURNS
void
*/
void appHandleHidSetReportInd(appTaskData *theApp, HID_SET_REPORT_IND_T *ind, bool respond)
{
MAIN_PRINT(("appHandleHidSetReportInd\n"));
/* Unexpected */
if (respond)
HidSetReportResponse(theApp->hid, hid_invalid_param);
}
/*************************************************************************
NAME
appHandleHidGetReportInd
DESCRIPTION
Handles HID_GET_REPORT packets.
RETURNS
void
*/
void appHandleHidGetReportInd(appTaskData *theApp, HID_GET_REPORT_IND_T *ind)
{
MAIN_PRINT(("appHandleHidGetReportInd\n"));
/* Return invalid param for any other report type */
HidGetReportResponse(theApp->hid, hid_invalid_param, hid_report_output, 0, NULL);
}
/*************************************************************************
NAME
appHandleHidSetIdleInd
DESCRIPTION
Handles HID_SET_IDLE packets.
RETURNS
void
*/
void appHandleHidSetIdleInd(appTaskData *theApp, HID_SET_IDLE_IND_T *ind)
{
MAIN_PRINT(("appHandleHidSetIdleInd\n"));
/* We don't want to enter an idle mode which could cause us to run at a
very high rate. We therefore only allow a zero value or one greater
than 5 (>20ms) */
if ((ind->idle_rate == 0) || (ind->idle_rate >= 5))
{
/* Update the accepted idle rate */
theApp->mouse_idle_rate = ind->idle_rate;
/* Configure HID source with new idle rate */
SourceConfigure(StreamHidSource(), VM_SOURCE_HID_IDLE_MODE, theApp->mouse_idle_rate);
/* Send response */
HidSetIdleResponse(theApp->hid, hid_success);
}
else
{
/* Invalid parameter */
HidSetIdleResponse(theApp->hid, hid_invalid_param);
}
}
/*************************************************************************
NAME
appHandleHidGetIdleInd
DESCRIPTION
Handles HID_GET_IDLE packets.
RETURNS
void
*/
void appHandleHidGetIdleInd(appTaskData *theApp, HID_GET_IDLE_IND_T *ind)
{
MAIN_PRINT(("appHandleHidGetIdleInd\n"));
/* Send response */
HidGetIdleResponse(theApp->hid, hid_success, theApp->mouse_idle_rate);
}
/*************************************************************************
NAME
appHandleHidSetProtocolInd
DESCRIPTION
Handles HID_SET_PROTOCOL packets.
RETURNS
void
*/
void appHandleHidSetProtocolInd(appTaskData *theApp, HID_SET_PROTOCOL_IND_T *ind)
{
MAIN_PRINT(("appHandleHidSetProtocolInd\n"));
/* Store the protocol */
theApp->mouse_protocol = ind->protocol;
/* Send response */
HidSetProtocolResponse(theApp->hid, hid_success);
}
/*************************************************************************
NAME
appHandleHidGetProtocolInd
DESCRIPTION
Handles HID_GET_PROTOCOL packets.
RETURNS
void
*/
void appHandleHidGetProtocolInd(appTaskData *theApp, HID_GET_PROTOCOL_IND_T *ind)
{
MAIN_PRINT(("appHandleHidGetReportInd\n"));
/* Send response */
HidGetProtocolResponse(theApp->hid, hid_success, theApp->mouse_protocol);
}
/*************************************************************************
NAME
appHandleHidControlInd
DESCRIPTION
Handles HID_CONTROL packets.
RETURNS
void
*/
extern void appHandleHidControlInd(appTaskData *theApp, HID_CONTROL_IND_T *ind)
{
MAIN_PRINT(("appHandleHidControlInd\n"));
switch (ind->operation)
{
case hid_control_op_hard_reset:
case hid_control_op_soft_reset:
{
/* Panic VM, this should cause a reset */
Panic();
}
break;
case hid_control_op_suspend:
{
/* We should just disconnect */
appSetState(theApp, appCabledDisconnecting);
}
break;
default:
break;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -