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.

[参考译文] CCS/LAUNCHXL-CC2640R2:按钮服务和 SimpleKeys 服务有何差异?

Guru**** 2580715 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/wireless-connectivity/bluetooth-group/bluetooth/f/bluetooth-forum/592739/ccs-launchxl-cc2640r2-button-service-and-simplekeys-service-differences

器件型号:LAUNCHXL-CC2640R2

工具/软件:Code Composer Studio

您好!

   我想知道 Button Service 和 SimpleKeys Service 之间有何区别? 在 LightBlue iPhone 应用中、按钮服务不会通知按钮按压操作、但 SimpleKeys 服务会通知按钮按压操作。

   在 BLE Device Monitor 中、Button Service 和 SimpleKeys Service 的功能相同、两者都在按下按钮时发出通知。  

Light Blue iPhone 应用中的 Simplekeys 服务:


LightBlue iPhone 应用中的按钮服务:  



如上所示、按钮服务不会在按下按钮时通知该值。 Button 服务来自 Project Zero、SimpleKeys 服务从 BLE 堆栈2.2移植。

此外、get 参数代码也不同。 请参阅下面的。 按钮服务获取参数不会将任何内容保存到值中。

Simplekeys

bStatus_t SK_GetParameter (uint8 param、void *pValue)
{
bStatus_t ret = Success;
switch (param)
{
case SK_KEY_ATTR:
*((uint8*) pValue)= skKeyPressed;
中断;

默认值:
RET = INVALIDPARAMETER;
中断;
}

返回(RET);
} 

按钮服务。

bStatus_t ButtonService_GetParameter (uint8_t param、uint16_t *len、void *value)
{
bStatus_t ret = Success;
switch (param)
{
默认值:
log_error1 ("GetParameter:参数#%d 无效。"、(IArg)param);
RET = INVALIDPARAMETER;
break;
}
return ret;
} 

-克尔

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    您好!

    您是否修改了 Project Zero? 屏幕截图上的 Button Service 显示 FFF3的 UUID。 根据 button_service.c、两个按钮都具有通知特性:

    //特性"BUTTON0"属性(用于声明)
    静态 uint8_t BS_BUTTON0Props = GATT_PROP_NOTIFY | GATT_PROP_READ;
    (笑声)
    // Characteristic "Button1"属性(用于声明)
    静态 uint8_t BS_BUTTON1Props = GATT_PROP_NOTIFY | GATT_PROP_READ;


    祝你一切顺利
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    您好、Zahid、

    我将 Project Zero 修改为仅具有一个按钮功能(BUTTON0)。 button_service.c 配置文件代码是从 Bluetooth Developer Studio 生成的、仅具有 ON 按钮(BUTTON0)。 这是我在 button_service.c 中的 BUTTON0属性

    /* Characteristic "BUTTON0" Properties (用于声明)*/
    静态 uint8_t BS_BUTTON0Props = GATT_PROP_NOTIFY | GATT_PROP_READ;

    使用 TI BLE Device Monitor、BUTTON0会发出通知。 但使用 Light Blue iPhone 应用时、BUTTON0不会发出通知。 为什么是这样?

    -克尔