138 lines
4 KiB
C
138 lines
4 KiB
C
/***************************************************************************
|
|
*
|
|
* Copyright 2015-2019 BES.
|
|
* All rights reserved. All unpublished rights reserved.
|
|
*
|
|
* No part of this work may be used or reproduced in any form or by any
|
|
* means, or stored in a database or retrieval system, without prior written
|
|
* permission of BES.
|
|
*
|
|
* Use of this work is governed by a license granted by BES.
|
|
* This work contains confidential and proprietary information of
|
|
* BES. which is protected by copyright, trade secret,
|
|
* trademark and other intellectual property rights.
|
|
*
|
|
****************************************************************************/
|
|
#ifndef APP_HID_H_
|
|
#define APP_HID_H_
|
|
|
|
/**
|
|
****************************************************************************************
|
|
* @addtogroup APP
|
|
* @ingroup RICOW
|
|
*
|
|
* @brief HID Application Module entry point
|
|
*
|
|
* @{
|
|
****************************************************************************************
|
|
*/
|
|
|
|
/*
|
|
* INCLUDE FILES
|
|
****************************************************************************************
|
|
*/
|
|
|
|
#include "rwip_config.h" // SW configuration
|
|
|
|
#if (BLE_APP_HID)
|
|
|
|
#include <stdint.h> // Standard Integer Definition
|
|
#include "ke_task.h" // Kernel Task Definition
|
|
|
|
#if (PS2_SUPPORT)
|
|
#include "ps2.h" // PS2 Mouse Driver
|
|
#endif //(PS2_SUPPORT)
|
|
|
|
/*
|
|
* STRUCTURES DEFINITION
|
|
****************************************************************************************
|
|
*/
|
|
|
|
/// HID Application Module Environment Structure
|
|
struct app_hid_env_tag
|
|
{
|
|
/// Connection handle
|
|
uint8_t conidx;
|
|
/// Mouse timeout value
|
|
uint16_t timeout;
|
|
/// Internal state of the module
|
|
uint8_t state;
|
|
/// Timer enabled
|
|
bool timer_enabled;
|
|
/// Number of report that can be sent
|
|
uint8_t nb_report;
|
|
};
|
|
|
|
struct ps2_mouse_msg
|
|
{
|
|
int16_t x;
|
|
int16_t y;
|
|
int16_t b;
|
|
int16_t w;
|
|
};
|
|
|
|
/*
|
|
* GLOBAL VARIABLES DECLARATIONS
|
|
****************************************************************************************
|
|
*/
|
|
|
|
/// Table of message handlers
|
|
extern const struct ke_state_handler app_hid_table_handler;
|
|
|
|
/*
|
|
* GLOBAL FUNCTIONS DECLARATION
|
|
****************************************************************************************
|
|
*/
|
|
|
|
/**
|
|
****************************************************************************************
|
|
*
|
|
* Health Thermometer Application Functions
|
|
*
|
|
****************************************************************************************
|
|
*/
|
|
|
|
/**
|
|
****************************************************************************************
|
|
* @brief Initialize HID Application Module
|
|
****************************************************************************************
|
|
*/
|
|
void app_hid_init(void);
|
|
|
|
/**
|
|
****************************************************************************************
|
|
* @brief Initialize the PS2 mouse driver so that it can be used by the application
|
|
****************************************************************************************
|
|
*/
|
|
void app_hid_start_mouse(void);
|
|
|
|
/**
|
|
****************************************************************************************
|
|
* @brief Add a HID Service instance in the DB
|
|
****************************************************************************************
|
|
*/
|
|
void app_hid_add_hids(void);
|
|
|
|
/**
|
|
****************************************************************************************
|
|
* @brief Enable the HID Over GATT Profile device role
|
|
*
|
|
* @param[in]: conhdl - Connection handle for the connection
|
|
****************************************************************************************
|
|
*/
|
|
void app_hid_enable_prf(uint8_t conidx);
|
|
|
|
/**
|
|
****************************************************************************************
|
|
* @brief Send a mouse report to the peer device
|
|
*
|
|
* @param[in]: report - Mouse report sent by the PS2 driver
|
|
****************************************************************************************
|
|
*/
|
|
void app_hid_send_mouse_report(struct ps2_mouse_msg report);
|
|
|
|
#endif //(BLE_APP_HID)
|
|
|
|
/// @} APP
|
|
|
|
#endif // APP_HID_H_
|