/*********************************************************************
* @fn performPeriodicTask 执行 周期 任务
*
* @brief Perform a periodic application task. This function gets
* called every five seconds as a result of the SBP_PERIODIC_EVT
* OSAL event. In this example, the value of the third
* characteristic in the SimpleGATTProfile service is retrieved
* from the profile, and then copied into the value of the
* the fourth characteristic.
*
* 执行周期性的应用任务,这个函数被调用(每隔五秒)作为 SBP_PERIODIC_EVT 的
* OSAL 事件。在这个案例中,第三个 特征值(characteristic)在SimpleGATTProfile
* 服务里被获取从 Profile里,并且这个值被复制到第四个特征值里!
*
* profile:描述了某个应用场景中设备有什么功能(执行什么工作)。在一个profile里会定义好角色。
* 角色会包含一个服务service或者多个service或者没有。profile一般定义两个角色,例如防丢器中定义了一个报告者和监视者。
*
* 2016年12月15日08:59:13,GXP
*
* @param none
*
* @return none
*/
static void performPeriodicTask( void )
{
uint8 valueToCopy;
uint8 stat; // Call to retrieve the value of the third characteristic in the profile
// 调用 获取第三个特征值在 profile里 /*
* GXP,NOTE,2016年12月15日10:36:28
*
* 这个函数第二个形参是一个空指针类型,通过取valueToCopy这个 局部变量的地址
* 这样就能在SimpleProfile_GetParameter这个函数里把 valueToCopy这个 局部变量
* 进行赋值。这个函数调用还返回了一个status,通过这个状态可以知道是否调用成功,
* 以及如果失败可以知道失败的原因。
*/
stat = SimpleProfile_GetParameter( SIMPLEPROFILE_CHAR3, &valueToCopy); if( stat == SUCCESS )
{
/*
* Call to set that value of the fourth characteristic in the profile. Note
* that if notifications of the fourth characteristic have been enabled by
* a GATT client device, then a notification will be sent every time this
* function is called.
*/ /*
* 调用 设置 第四个特征值 在profile 里。
* 注意:第四个特征值已经被一个GATT客户端设备使能!
* 这种情况下,这个通知值(第四个特征值)将要被设置,每当这个函数被调用时!
*/
SimpleProfile_SetParameter( SIMPLEPROFILE_CHAR4, sizeof(uint8), &valueToCopy);
}
}