SimpleProfile_GetParameter && SimpleProfile_SetParameter

來源:互聯網
上載者:User

標籤: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:是一個null 指標參數,指向輸出資料的指標,這個依賴於參數的ID15  *  並且 將被轉換成適當的參數類似,例如:資料類型uint16將被轉換成uint16指標。16  *17  *  profile:描述了某個應用情境中裝置有什麼功能(執行什麼工作)。在一個profile裡會定義好角色。18  *  角色會包含一個服務service或者多個service或者沒有。profile一般定義兩個角色,例如防丟器中定義了一個報告者和監視者。19  * 20  *  2016年12月15日09:09:14,GXP21  *22  * @return  bStatus_t  BLE_STATUS_VALUES23  */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;//無效的ID51       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 occurred10 #define bleNotConnected                 0x14  //!< Can‘t perform function when not in a connection11 #define bleNoResources                  0x15  //!< There are no resource available12 #define blePending                      0x16  //!< Waiting13 #define bleTimeout                      0x17  //!< Timed out performing function14 #define bleInvalidRange                 0x18  //!< A parameter is out of range15 #define bleLinkEncrypted                0x19  //!< The link is already encrypted16 #define bleProcedureComplete            0x1A  //!< The Procedure is completed17 #define bleInvalidMtuSize               0x1B  //!< MTU size is out of range

 

 SimpleProfile_SetParameter 和上面這個函數類似!

 

SimpleProfile_GetParameter && SimpleProfile_SetParameter

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.