This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

当一个键被按下后,怎样发送消息给手机使手机知道是哪个键被按下?



我想通过一个HandleKeys(),在if ( keys & HAL_KEY_SW_1 ){ 。。。}中添加怎样的代码以实现手机知道该键被按下。希望有具体点的代码,谢谢。

  • fish,

    keyfobdemo.c,keyfobapp_HandleKeys()中,

    最终按键发射出去,是这里 

    SK_SetParameter( SK_KEY_ATTR, sizeof ( uint8 ), &SK_Keys );

    然后在这个函数里面,关键就是下面这货了,是它把数据发射了出去:

    GATTServApp_ProcessCharCfg( skConfig, &skKeyPressed, FALSE,
    simplekeysAttrTbl, GATT_NUM_ATTRS( simplekeysAttrTbl ),
    INVALID_TASK_ID );