码迷,mamicode.com
首页 > 其他好文 > 详细

SimpleProfile_GetParameter && SimpleProfile_SetParameter

时间:2016-12-15 11:32:28      阅读:371      评论:0      收藏:0      [点我收藏+]

标签:amp   nec   time   return   val   imp   type   ice   for   

 1 /*********************************************************************
 2  * @fn      SimpleProfile_GetParameter       简单 profile 得到参数
 3  *
 4  * @brief   Get a Simple Profile parameter.  得到一个简单的profile参数。
 5  *
 6  * @param   param - Profile parameter ID     形参param:profile的参数ID
 7  *
 8  * @param   value - pointer to data to put.  This is dependent on
 9  *          the parameter ID and WILL be cast to the appropriate 
10  *          data type (example: data type of uint16 will be cast to 
11  *          uint16 pointer).
12  *
13  *
14  *  形参value:是一个空指针参数,指向输出数据的指针,这个依赖于参数的ID
15  *  并且 将被转换成适当的参数类似,例如:数据类型uint16将被转换成uint16指针。
16  *
17  *  profile:描述了某个应用场景中设备有什么功能(执行什么工作)。在一个profile里会定义好角色。
18  *  角色会包含一个服务service或者多个service或者没有。profile一般定义两个角色,例如防丢器中定义了一个报告者和监视者。
19  * 
20  *  2016年12月15日09:09:14,GXP
21  *
22  * @return  bStatus_t  BLE_STATUS_VALUES
23  */
24 bStatus_t SimpleProfile_GetParameter( uint8 param, void *value )
25 {
26   bStatus_t ret = SUCCESS;
27   switch ( param )
28   {
29     case SIMPLEPROFILE_CHAR1:
30       *((uint8*)value) = simpleProfileChar1;
31       break;
32 
33     case SIMPLEPROFILE_CHAR2:
34       *((uint8*)value) = simpleProfileChar2;
35       break;      
36 
37     case SIMPLEPROFILE_CHAR3:
38       *((uint8*)value) = simpleProfileChar3;
39       break;  
40 
41     case SIMPLEPROFILE_CHAR4:
42       *((uint8*)value) = simpleProfileChar4;
43       break;
44 
45     case SIMPLEPROFILE_CHAR5:
46       VOID memcpy( value, simpleProfileChar5, SIMPLEPROFILE_CHAR5_LEN );
47       break;   
48       
49     default:
50       ret = INVALIDPARAMETER;//无效的ID
51       break;
52   }
53   
54   return ( ret ); //返回函数调用的状态 是成功了 ,还是因为ID无效失败了
55 }

 

bStatus_t 的值在宏定义处被解释为BLE_STATUS_VALUES,下面是BLE_STATUS_VALUES的值的含义:


 1 /** @defgroup BLE_STATUS_VALUES BLE Default BLE Status Values
 2  * returned as bStatus_t
 3  * @{
 4  */
 5 #define bleInvalidTaskID                INVALID_TASK  //!< Task ID isn‘t setup properly
 6 #define bleNotReady                     0x10  //!< Not ready to perform task
 7 #define bleAlreadyInRequestedMode       0x11  //!< Already performing that task
 8 #define bleIncorrectMode                0x12  //!< Not setup properly to perform that task
 9 #define bleMemAllocError                0x13  //!< Memory allocation error occurred
10 #define bleNotConnected                 0x14  //!< Can‘t perform function when not in a connection
11 #define bleNoResources                  0x15  //!< There are no resource available
12 #define blePending                      0x16  //!< Waiting
13 #define bleTimeout                      0x17  //!< Timed out performing function
14 #define bleInvalidRange                 0x18  //!< A parameter is out of range
15 #define bleLinkEncrypted                0x19  //!< The link is already encrypted
16 #define bleProcedureComplete            0x1A  //!< The Procedure is completed
17 #define bleInvalidMtuSize               0x1B  //!< MTU size is out of range

 

 SimpleProfile_SetParameter 和上面这个函数类似!

 

SimpleProfile_GetParameter && SimpleProfile_SetParameter

标签:amp   nec   time   return   val   imp   type   ice   for   

原文地址:http://www.cnblogs.com/suozhang/p/6182350.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!