首页 技术 正文
技术 2022年11月17日
0 收藏 332 点赞 3,267 浏览 1473 个字
 /*********************************************************************
* @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);
}
}
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,088
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,564
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,413
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,186
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,822
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,905