|
带中括号的枚举值是怎么回事
发表于 2016-4-23 22:02:18
浏览:6612
|
回复:1
打印
只看该作者
[复制链接]
楼主
/// Possible states of the QPPS task
enum
{
/// Disabled state
QPPS_DISABLED,
/// Idle state
QPPS_IDLE,
/// Connected state
QPPS_CONNECTED,
/// Number of defined states.
QPPS_STATE_MAX,
};
/// Disabled State handler definition.
const struct ke_msg_handler qpps_disabled[] =
{
{QPPS_CREATE_DB_REQ, (ke_msg_func_t) qpps_create_db_req_handler}
};
/// Idle State handler definition.
const struct ke_msg_handler qpps_idle[] =
{
{QPPS_ENABLE_REQ, (ke_msg_func_t) qpps_enable_req_handler}
};
/// Connected State handler definition.
const struct ke_msg_handler qpps_connected[] =
{
{QPPS_DATA_SEND_REQ, (ke_msg_func_t) qpps_data_send_req_handler},
{GATT_WRITE_CMD_IND, (ke_msg_func_t) gatt_write_cmd_ind_handler},
{GATT_NOTIFY_CMP_EVT, (ke_msg_func_t) gatt_notify_cmp_evt_handler},
};
/// Specifies the message handler structure for every input state.
const struct ke_state_handler qpps_state_handler[QPPS_STATE_MAX] =
{
[QPPS_DISABLED] = KE_STATE_HANDLER(qpps_disabled),
[QPPS_IDLE] = KE_STATE_HANDLER(qpps_idle),
[QPPS_CONNECTED] = KE_STATE_HANDLER(qpps_connected),
};
最后一个结构体里,枚举值加上中括号再赋值是什么用法 |
|