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.

请教BLE 中的sever和client角色问题



在血压计profile里定义了sensor是作为sever角色,但是源文件bloodpressure.c 的 BloodPressure_Init()里调用了GATT_InitClient() ,这是初始化 GATT Client  吗?如何理解 GATT 的 server和client?  程序在哪个地方实现初始化server的呢? 如果一个设备要做server同时又是client.,怎样实现呢?谢谢!

  • 血压计sensor有多个service(attributes),那么它必然是server,初始化 attributes 也就是初始化server了。

    下面就是初始化代码:

    // Initialize GATT attributes
      GGS_AddService( GATT_ALL_SERVICES );         // GAP
      GATTServApp_AddService( GATT_ALL_SERVICES ); // GATT attributes
      BloodPressure_AddService( GATT_ALL_SERVICES );
      DevInfo_AddService( );

    如果设备还要作为client的话,那么再调用GATT_InitClient() 就可以了。

      // Initialize GATT Client
      VOID GATT_InitClient();

    请问我这样理解对吗?还请诸位高人指教!

    谢谢!

  • 我也有同样的疑问,请高手指点一下啊,顶!!