您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ BUILD_UINT16函数代码示例

51自学网 2021-06-01 19:53:56
  C++
这篇教程C++ BUILD_UINT16函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中BUILD_UINT16函数的典型用法代码示例。如果您正苦于以下问题:C++ BUILD_UINT16函数的具体用法?C++ BUILD_UINT16怎么用?C++ BUILD_UINT16使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了BUILD_UINT16函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: proxReporter_ReadAttrCB

/********************************************************************* * @fn          proxReporter_ReadAttrCB * * @brief       Read an attribute. * * @param        * * @return      Success or Failure */static uint8 proxReporter_ReadAttrCB( uint16 connHandle, gattAttribute_t *pAttr,                                     uint8 *pValue, uint8 *pLen, uint16 offset, uint8 maxLen ){  uint16 uuid;  bStatus_t status = SUCCESS;  // Make sure it's not a blob operation  if ( offset > 0 )  {    return ( ATT_ERR_ATTR_NOT_LONG );  }    if ( pAttr->type.len == ATT_BT_UUID_SIZE )  {    // 16-bit UUID    uuid = BUILD_UINT16( pAttr->type.uuid[0], pAttr->type.uuid[1]);        switch ( uuid )    {      // No need for "GATT_SERVICE_UUID" or "GATT_CLIENT_CHAR_CFG_UUID" cases;      // gattserverapp handles those types for reads         case PROXIMITY_ALERT_LEVEL_UUID:      case PROXIMITY_TX_PWR_LEVEL_UUID:        *pLen = 1;        pValue[0] = *pAttr->pValue;        break;            default:        // Should never get here!        *pLen = 0;        status = ATT_ERR_ATTR_NOT_FOUND;        break;    }  }  else  {    //128-bit UUID    *pLen = 0;    status = ATT_ERR_INVALID_HANDLE;  }  return ( status );}
开发者ID:AubrCool,项目名称:BLE,代码行数:52,


示例2: zclPartition_ConvertOtaToNative_TransferPartitionedFrame

/********************************************************************* * @fn      zclPartition_ConvertOtaToNative_TransferPartitionedFrame * * @brief   Helper function used to process an incoming TransferPartionFrame *          command. * * @param   pCmd   - (output) the converted command * @param   buf    - pointer to incoming frame (just after ZCL header) * @param   buflen - length of buffer (ZCL payload) * * @return  ZStatus_t */ZStatus_t zclPartition_ConvertOtaToNative_TransferPartitionedFrame( zclCmdTransferPartitionedFrame_t *pCmd, uint8 *buf, uint8 buflen ){  uint8 offset;  pCmd->fragmentationOptions = buf[0];  if ( pCmd->fragmentationOptions & ZCL_PARTITION_OPTIONS_INDICATOR_16BIT )  {    pCmd->partitionIndicator = BUILD_UINT16( buf[1], buf[2] );    offset = 3;  }  else  {    pCmd->partitionIndicator = buf[1];    offset = 2;  }  pCmd->frameLen = buf[offset++];  pCmd->pFrame = &buf[offset];  return ( ZSuccess );}
开发者ID:comword,项目名称:SmartIR-8051,代码行数:31,


示例3: temp_WriteAttrCB

/********************************************************************* * @fn      temp_WriteAttrCB * * @brief   Validate attribute data prior to a write operation * * @param   connHandle - connection message was received on * @param   pAttr - pointer to attribute * @param   pValue - pointer to data to be written * @param   len - length of data * @param   offset - offset of the first octet to be written * @param   complete - whether this is the last packet * @param   oper - whether to validate and/or write attribute value   * * @return  Success or Failure */static bStatus_t temp_WriteAttrCB( uint16 connHandle, gattAttribute_t *pAttr,        uint8 *pValue, uint8 len, uint16 offset ){  bStatus_t status = ATT_ERR_ATTR_NOT_FOUND;  if ( pAttr->type.len == ATT_BT_UUID_SIZE )  {    uint16 uuid = BUILD_UINT16( pAttr->type.uuid[0], pAttr->type.uuid[1]);    switch ( uuid )    {      case GATT_CLIENT_CHAR_CFG_UUID:        status = GATTServApp_ProcessCCCWriteReq( connHandle, pAttr, pValue, len,                                                 offset, GATT_CLIENT_CFG_NOTIFY );        if (GATTServApp_ReadCharCfg(connHandle, valueConfigCoordinates) & GATT_CLIENT_CFG_NOTIFY) {          iDoTurnOnTemp();        } else {          iDoTurnOffTemp();        }        break;                    case TEMP_UUID:        if (len != sizeof(struct temp_ts)) {          return ATT_ERR_INVALID_VALUE_SIZE;        }        recorder_set_read_base_ts((struct calendar *)(pValue + sizeof(struct temp)));        status = SUCCESS;        break;              case TEMP_TIME_UUID:        if (len != sizeof(struct calendar)) {          return ATT_ERR_INVALID_VALUE_SIZE;        }        recorder_set_calendar_time((struct calendar *)pValue);        status = SUCCESS;        break;      default:        status = ATT_ERR_ATTR_NOT_FOUND;    }  }  return ( status );}
开发者ID:qodome,项目名称:Firmware,代码行数:58,


示例4: battReadAttrCB

/********************************************************************* * @fn          battReadAttrCB * * @brief       Read an attribute. * * @param       connHandle - connection message was received on * @param       pAttr - pointer to attribute * @param       pValue - pointer to data to be read * @param       pLen - length of data to be read * @param       offset - offset of the first octet to be read * @param       method - type of read message * * @return      SUCCESS, blePending or Failure */static bStatus_t battReadAttrCB( uint16 connHandle, gattAttribute_t *pAttr,                                 uint8 *pValue, uint8 *pLen, uint16 offset,                                 uint8 maxLen, uint8 method ){  bStatus_t status = SUCCESS;  // Make sure it's not a blob operation (no attributes in the profile are long)  if ( offset > 0 )  {    return ( ATT_ERR_ATTR_NOT_LONG );  }  uint16 uuid = BUILD_UINT16( pAttr->type.uuid[0], pAttr->type.uuid[1] );  // Measure battery level if reading level  if ( uuid == BATT_LEVEL_UUID )  {    uint8 level;    level = battMeasure();    // If level has gone down    if (level < battLevel)    {      // Update level      battLevel = level;    }    *pLen = 1;    pValue[0] = battLevel;  }  else if ( uuid == GATT_REPORT_REF_UUID )  {    *pLen = HID_REPORT_REF_LEN;    osal_memcpy( pValue, pAttr->pValue, HID_REPORT_REF_LEN );  }  else  {    status = ATT_ERR_ATTR_NOT_FOUND;  }  return ( status );}
开发者ID:aidaima,项目名称:RemoteControl-Car,代码行数:57,


示例5: sk_ReadAttrCB

/********************************************************************* * @fn          sk_ReadAttrCB * * @brief       Read an attribute. * * @param       connHandle - connection message was received on * @param       pAttr - pointer to attribute * @param       pValue - pointer to data to be read * @param       pLen - length of data to be read * @param       offset - offset of the first octet to be read * @param       maxLen - maximum length of data to be read * * @return      Success or Failure */static uint8 sk_ReadAttrCB( uint16 connHandle, gattAttribute_t *pAttr,                             uint8 *pValue, uint8 *pLen, uint16 offset, uint8 maxLen ){  bStatus_t status = SUCCESS;   // Make sure it's not a blob operation (no attributes in the profile are long  if ( offset > 0 )  {    return ( ATT_ERR_ATTR_NOT_LONG );  }   if ( pAttr->type.len == ATT_BT_UUID_SIZE )  {    // 16-bit UUID    uint16 uuid = BUILD_UINT16( pAttr->type.uuid[0], pAttr->type.uuid[1]);    switch ( uuid )    {      // No need for "GATT_SERVICE_UUID" or "GATT_CLIENT_CHAR_CFG_UUID" cases;      // gattserverapp handles this type for reads      // simple keys characteristic does not have read permissions, but because it      //   can be sent as a notification, it must be included here      case SK_KEYPRESSED_UUID:        *pLen = 1;        pValue[0] = *pAttr->pValue;        break;      default:        // Should never get here!        *pLen = 0;        status = ATT_ERR_ATTR_NOT_FOUND;        break;    }  }  else  {    // 128-bit UUID    *pLen = 0;    status = ATT_ERR_INVALID_HANDLE;  }  return ( status );}
开发者ID:ClarePhang,项目名称:CC2540,代码行数:57,


示例6: get_dev_info

void get_dev_info( uint8 *buf ){  // 0x05 mac short_addr type  // 1 8 2 1 == 12 bytes  // 0 1 2 3 4 5 6 7 8 9 10 11  uint16 short_addr;  uint8 type;  uint8 ieeeAddr[9];  uint8 i;    type = buf[11];  short_addr = BUILD_UINT16( buf[9], buf[10]);    for(i=0;i<8;i++)  {    ieeeAddr[i] = buf[i+1];  }}
开发者ID:cuu,项目名称:weiyi,代码行数:19,


示例7: MT_UtilSrcMatchCheckSrcAddr

/*************************************************************************************************** * @fn          MT_UtilSrcMatchCheckSrcAddr * * @brief      Check if a short or extended address is in the source address table. * * @param      pBuf - Buffer contains the data * * @return     void ***************************************************************************************************/void MT_UtilSrcMatchCheckSrcAddr (uint8 *pBuf){  uint8 cmdId;  uint8 retArray[2];  /* Parse header */  cmdId = pBuf[MT_RPC_POS_CMD1];  pBuf += MT_RPC_FRAME_HDR_SZ;#if 0  /* Unsupported  */  uint16 panID;  zAddrType_t devAddr;  /* Address mode */  devAddr.addrMode = *pBuf++;  /* Address based on the address mode */  MT_UtilSpi2Addr( &devAddr, pBuf);  pBuf += Z_EXTADDR_LEN;  /* PanID */  panID = BUILD_UINT16( pBuf[0] , pBuf[1] );  /* Call the routine */  retArray[1] =  ZMacSrcMatchCheckSrcAddr (&devAddr, panID);    /* Return failure if the index is invalid */  if (retArray[1] == ZMacSrcMatchInvalidIndex )  {    retArray[0] = ZFailure;  }  else  {    retArray[0] = ZSuccess;  }#else  retArray[0] = ZMacUnsupported;  retArray[1] = ZMacSrcMatchInvalidIndex;#endif  /* Build and send back the response */  MT_BuildAndSendZToolResponse(((uint8)MT_RPC_CMD_SRSP | (uint8)MT_RPC_SYS_UTIL), cmdId, 2, retArray );}
开发者ID:FrankieChan885,项目名称:EndDevice-Project-for-editing,代码行数:52,


示例8: SampleApp_MessageMSGCB

void SampleApp_MessageMSGCB( afIncomingMSGPacket_t *pkt ){  uint16 flashTime;    switch ( pkt->clusterId )  {    case SAMPLEAPP_PERIODIC_CLUSTERID:      f=pkt->cmd.Data[0];//检测其panid,记录在参数f里面。      if(State_data[f]=='0'){State_data[f]='1';}//将其状态置为在线//      HalUARTWrite(0, State_data,3);     //十六进制发给PC机  //      HalUARTWrite(0, "/n",1);      break;    case SAMPLEAPP_FLASH_CLUSTERID:      flashTime = BUILD_UINT16(pkt->cmd.Data[1], pkt->cmd.Data[2] );      HalLedBlink( HAL_LED_4, 4, 50, (flashTime / 4) );      break;  }}
开发者ID:fengcanyue,项目名称:ZigBee_Program,代码行数:19,


示例9: MT_AfInterPanCtl

/*************************************************************************************************** * @fn      MT_AfInterPanCtl * * @brief   Process the AF Inter Pan control command. * * @param   pBuf - pointer to the received buffer * * @return  none ***************************************************************************************************/static void MT_AfInterPanCtl(uint8 *pBuf){  uint8 cmd, rtrn;  uint16 panId;  endPointDesc_t *pEP;    cmd = pBuf[MT_RPC_POS_CMD1];  pBuf += MT_RPC_FRAME_HDR_SZ;  switch (*pBuf++)  // Inter-pan request parameter.  {  case InterPanClr:    rtrn = StubAPS_SetIntraPanChannel();           // Switch channel back to the NIB channel.    break;  case InterPanSet:    rtrn = StubAPS_SetInterPanChannel(*pBuf);      // Set channel for inter-pan communication.    break;  case InterPanReg:    if ((pEP = afFindEndPointDesc(*pBuf)))    {      StubAPS_RegisterApp(pEP);      rtrn = SUCCESS;    }    else    {      rtrn = FAILURE;    }    break;  case InterPanChk:    panId = BUILD_UINT16(pBuf[0], pBuf[1]);    rtrn = (StubAPS_InterPan(panId, pBuf[2])) ? ZSuccess : ZFailure;    break;  default:    rtrn = afStatus_INVALID_PARAMETER;    break;  }  MT_BuildAndSendZToolResponse(((uint8)MT_RPC_CMD_SRSP | (uint8)MT_RPC_SYS_AF), cmd, 1, &rtrn);}
开发者ID:kobefaith,项目名称:zigbee,代码行数:52,


示例10: GATTServApp_ProcessCCCWriteReq

/********************************************************************* * @fn      GATTServApp_ProcessCCCWriteReq * * @brief   Process the client characteristic configuration *          write request for a given client. * * @param   connHandle - connection message was received on * @param   pAttr - pointer to attribute * @param   pValue - pointer to data to be written * @param   len - length of data * @param   offset - offset of the first octet to be written * @param   validCfg - valid configuration * * @return  Success or Failure */bStatus_t GATTServApp_ProcessCCCWriteReq( uint16 connHandle, gattAttribute_t *pAttr,                                          uint8 *pValue, uint16 len, uint16 offset,                                          uint16 validCfg ){  bStatus_t status = SUCCESS;  // Validate the value  if ( offset == 0 )  {    if ( len == 2 )    {      uint16 value = BUILD_UINT16( pValue[0], pValue[1] );      // Validate characteristic configuration bit field      if ( ( value & ~validCfg ) == 0 ) // indicate and/or notify      {        // Write the value if it's changed        if ( GATTServApp_ReadCharCfg( connHandle,                                      GATT_CCC_TBL(pAttr->pValue) ) != value )        {          status = GATTServApp_WriteCharCfg( connHandle,                                             GATT_CCC_TBL(pAttr->pValue),                                             value );        }      }      else      {        status = ATT_ERR_INVALID_VALUE;      }    }    else    {      status = ATT_ERR_INVALID_VALUE_SIZE;    }  }  else  {    status = ATT_ERR_ATTR_NOT_LONG;  }  return ( status );}
开发者ID:ClarePhang,项目名称:BLE_cc2650,代码行数:57,


示例11: findMeTarget_ReadAttrCB

/********************************************************************* * @fn          findMeTarget_ReadAttrCB * * @brief       Read an attribute. * * @param       connHandle - connection message was received on * @param       pAttr - pointer to attribute * @param       pValue - pointer to data to be read * @param       pLen - length of data to be read * @param       offset - offset of the first octet to be read * @param       maxLen - maximum length of data to be read * @param       method - type of read message  * * @return      SUCCESS, blePending or Failure */static bStatus_t findMeTarget_ReadAttrCB( uint16 connHandle, gattAttribute_t *pAttr,                                           uint8 *pValue, uint16 *pLen, uint16 offset,                                          uint16 maxLen, uint8 method ){  bStatus_t status = SUCCESS;    // Make sure it's not a blob operation (no attributes in the profile are long)  if ( offset > 0 )  {    return ( ATT_ERR_ATTR_NOT_LONG );  }   if ( pAttr->type.len == ATT_BT_UUID_SIZE )  {    // 16-bit UUID    uint16 uuid = BUILD_UINT16( pAttr->type.uuid[0], pAttr->type.uuid[1]);    switch ( uuid )    {      // No need for "GATT_PRIMARY_SERVICE_UUID" or "GATT_CHARACTER_UUID" cases;      // gattserverapp handles those types for reads      case ALERT_LEVEL_UUID:        *pLen = 1;        pValue[0] = *pAttr->pValue;        break;              default:        // Should never get here! (characteristics 3 and 4 do not have read permissions)        *pLen = 0;        status = ATT_ERR_ATTR_NOT_FOUND;        break;    }  }  else  {    // 128-bit UUID    *pLen = 0;    status = ATT_ERR_INVALID_HANDLE;  }  return ( status );}
开发者ID:dgiovanelli,项目名称:climb.stfirmware_BLEstack2.2,代码行数:57,


示例12: glucose_ReadAttrCB

/********************************************************************* * @fn          glucose_ReadAttrCB * * @brief       Read an attribute. * * @param       connHandle - connection message was received on * @param       pAttr - pointer to attribute * @param       pValue - pointer to data to be read * @param       pLen - length of data to be read * @param       offset - offset of the first octet to be read * @param       maxLen - maximum length of data to be read * * @return      Success or Failure */static uint8 glucose_ReadAttrCB( uint16 connHandle, gattAttribute_t *pAttr,                            uint8 *pValue, uint8 *pLen, uint16 offset, uint8 maxLen ){  bStatus_t status = SUCCESS;  // Require security for all characteristics  if ( linkDB_Encrypted( connHandle ) == FALSE )  {    return ATT_ERR_INSUFFICIENT_ENCRYPT;  }  // Make sure it's not a blob operation (no attributes in the profile are long)  if ( offset > 0 )  {    return ( ATT_ERR_ATTR_NOT_LONG );  }  if ( pAttr->type.len == ATT_BT_UUID_SIZE )  {    // 16-bit UUID    uint16 uuid = BUILD_UINT16( pAttr->type.uuid[0], pAttr->type.uuid[1]);    switch ( uuid )    {      // No need for "GATT_SERVICE_UUID" or "GATT_CLIENT_CHAR_CFG_UUID" cases;      // gattserverapp handles those types for reads      case GLUCOSE_FEATURE_UUID:        *pLen = 2;        pValue[0] = LO_UINT16( glucoseFeature );        pValue[1] = HI_UINT16( glucoseFeature );        break;      default:        // Should never get here! (characteristics 3 and 4 do not have read permissions)        *pLen = 0;        status = ATT_ERR_ATTR_NOT_FOUND;        break;    }  }  return ( status );}
开发者ID:bluewish,项目名称:ble_dev,代码行数:56,


示例13: MT_NlmeJoinRequest

/*************************************************************************************************** * @fn      MT_NlmeJoinRequest * * @brief   Join Request * * @param   pBuf - pointer to the received buffer * * @return  void ***************************************************************************************************/void MT_NlmeJoinRequest(uint8 *pBuf){  uint8 retValue = ZFailure;  uint8 dummyExPANID[Z_EXTADDR_LEN] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};  uint16 panID;  uint8 cmdId;  networkDesc_t *pNwkDesc;  /* parse header */  cmdId = pBuf[MT_RPC_POS_CMD1];  pBuf += MT_RPC_FRAME_HDR_SZ;  panID = BUILD_UINT16(pBuf[0], pBuf[1]);  if((pNwkDesc = nwk_getNetworkDesc(dummyExPANID,panID, pBuf[2])) != NULL )  {    if (pNwkDesc->chosenRouter == INVALID_NODE_ADDR )    {      retValue = ZNwkNotPermitted;    }    else    {      retValue = NLME_JoinRequest( dummyExPANID, panID, pBuf[2], pBuf[3],                                   pNwkDesc->chosenRouter, pNwkDesc->chosenRouterDepth );    }  }  else  {    retValue = ZNwkNotPermitted;  }  if ( pBuf[3] & CAPINFO_RCVR_ON_IDLE )  {    /* The receiver is on, turn network layer polling off. */    NLME_SetPollRate( 0 );    NLME_SetQueuedPollRate( 0 );    NLME_SetResponseRate( 0 );  }  /* Build and send back the response */  MT_BuildAndSendZToolResponse(((uint8)MT_RPC_CMD_SRSP | (uint8)MT_RPC_SYS_NWK), cmdId, 1, &retValue);}
开发者ID:paoloach,项目名称:zpowermeter,代码行数:50,


示例14: bloodPressure_ReadAttrCB

/********************************************************************* * @fn          bloodPressure_ReadAttrCB * * @brief       Read an attribute. * * @param       connHandle - connection message was received on * @param       pAttr - pointer to attribute * @param       pValue - pointer to data to be read * @param       pLen - length of data to be read * @param       offset - offset of the first octet to be read * @param       maxLen - maximum length of data to be read * * @return      Success or Failure */static uint8 bloodPressure_ReadAttrCB( uint16 connHandle, gattAttribute_t *pAttr,                             uint8 *pValue, uint8 *pLen, uint16 offset, uint8 maxLen ){  bStatus_t status = SUCCESS;  // If attribute permissions require authorization to read, return error  if ( gattPermitAuthorRead( pAttr->permissions ) )  {    // Insufficient authorization    return ( ATT_ERR_INSUFFICIENT_AUTHOR );  }    // Make sure it's not a blob operation (no attributes in the profile are long)  if ( offset > 0 )  {    return ( ATT_ERR_ATTR_NOT_LONG );  }   if ( pAttr->type.len == ATT_BT_UUID_SIZE )  {    // 16-bit UUID    uint16 uuid = BUILD_UINT16( pAttr->type.uuid[0], pAttr->type.uuid[1]);    switch ( uuid )    {      case BLOODPRESSURE_FEATURE_UUID:        {          *pLen = 2;          pValue[0] = 0;          pValue[1] = 0;          }        break;               default:        // Should never get here! (characteristics 3 and 4 do not have read permissions)        *pLen = 0;        status = ATT_ERR_ATTR_NOT_FOUND;        break;    }  }  return ( status );}
开发者ID:AubrCool,项目名称:BLE,代码行数:55,


示例15: bat_ReadAttrCB

/********************************************************************* * @fn          bat_ReadAttrCB * * @brief       Read an attribute. * * * @return      Success or Failure */static uint8 bat_ReadAttrCB( uint16 connHandle, gattAttribute_t *pAttr,                             uint8 *pValue, uint8 *pLen, uint16 offset, uint8 maxLen ){  bStatus_t status = SUCCESS;  // Make sure it's not a blob operation (no attributes in the profile are long  if ( offset > 0 )  {    return ( ATT_ERR_ATTR_NOT_LONG );  }  // 16-bit UUID  uint16 uuid = BUILD_UINT16( pAttr->type.uuid[0], pAttr->type.uuid[1]);    if ( pAttr->type.len == ATT_BT_UUID_SIZE )  {    switch ( uuid )    {      // No need for "GATT_SERVICE_UUID" case;      // gattserverapp handles those types for reads        case BATTERY_LEVEL_UUID:      case BATTERY_STATE_UUID:        *pLen = 1;        pValue[0] = *pAttr->pValue;        break;            default:        // Should never get here!        *pLen = 0;        status = ATT_ERR_ATTR_NOT_FOUND;        break;    }  }  else  {    //128-bit UUID    *pLen = 0;    status = ATT_ERR_INVALID_HANDLE;  }    return ( status );}
开发者ID:JensenSung,项目名称:shred444,代码行数:49,


示例16: battReadAttrCB

/** * @fn          battReadAttrCB * * @brief       Read an attribute. * * @param       connHandle - connection message was received on * @param       pAttr - pointer to attribute * @param       pValue - pointer to data to be read * @param       pLen - length of data to be read * @param       offset - offset of the first octet to be read * @param       maxLen - maximum length of data to be read * * @return      Success or Failure */static uint8 battReadAttrCB(uint16 connHandle, gattAttribute_t *pAttr, uint8 *pValue, uint8 *pLen, uint16 offset, uint8 maxLen){	bStatus_t	status = SUCCESS;	uint16		uuid = BUILD_UINT16(pAttr->type.uuid[0], pAttr->type.uuid[1]);	// Make sure it's not a blob operation (no attributes in the profile are long)	if (offset > 0) {		return (ATT_ERR_ATTR_NOT_LONG);	}	// Measure battery level if reading level	if (uuid == BATT_LEVEL_UUID) {		*pLen     = 1;		pValue[0] = battLevel;	} else {		status = ATT_ERR_ATTR_NOT_FOUND;	}	return (status);}
开发者ID:wythe-lin,项目名称:ZTKBLE,代码行数:35,


示例17: dev_opera

static void dev_opera(uint8*buf){  uint8 dev_cnt; //device count  uint16 dev_addr; // device 地址  uint8 opera_bit;  uint8 stop_bit;  uint8 i,j;    i = 0;  j = 0;  //0x01 0x?? ff ff xx ff ff xx ff ff xx  dev_cnt = buf[1];  for(i=0;i<dev_cnt;i++)  {    stop_bit = 2+i*3;        dev_addr = BUILD_UINT16(buf[stop_bit], buf[ stop_bit + 1]);    opera_bit = stop_bit+2;  }  }
开发者ID:cuu,项目名称:weiyi,代码行数:21,


示例18: StubNWK_ParseMsg

/********************************************************************* * @fn          StubNWK_ParseMsg * * @brief       Call this function to parse an incoming Stub NWK frame. * * @param       buf - pointer incoming message buffer * @param       bufLength - length of incoming message * @param       snff  - pointer Frame Format Parameters * * @return      pointer to network packet, NULL if error */static void StubNWK_ParseMsg( uint8 *buf, uint8 bufLength, NLDE_FrameFormat_t *snff ){  uint16 fc;  osal_memset( snff, 0, sizeof(NLDE_FrameFormat_t) );  snff->bufLength = bufLength;  // get the frame control  fc = BUILD_UINT16( buf[NWK_HDR_FRAME_CTRL_LSB], buf[NWK_HDR_FRAME_CTRL_MSB] );  // parse the frame control  NLDE_ParseFrameControl( fc, snff );  snff->hdrLen = STUB_NWK_HDR_LEN;  // Stub NWK payload  snff->nsdu = buf + snff->hdrLen;  snff->nsduLength = snff->bufLength - snff->hdrLen;} /* StubNWK_ParseMsg */
开发者ID:Daan1992,项目名称:WSN-Lab,代码行数:32,


示例19: MT_SysOsalNVLength

/*************************************************************************************************** * @fn      MT_SysOsalNVLength * * @brief   Attempt to get the length to an NV item * * @param   uint8 pData - pointer to the data * * @return  None ***************************************************************************************************/void MT_SysOsalNVLength(uint8 *pBuf){  uint16 nvId;  uint16 nvLen;  uint8 rsp[2];  /* Skip over RPC header */  pBuf += MT_RPC_FRAME_HDR_SZ;  /* Get the ID */  nvId = BUILD_UINT16(pBuf[0], pBuf[1]);  /* Attempt to get NV item length */  nvLen = osal_nv_item_len( nvId );  rsp[0] = LO_UINT16( nvLen );  rsp[1] = HI_UINT16( nvLen );  /* Build and send back the response */  MT_BuildAndSendZToolResponse(((uint8)MT_RPC_CMD_SRSP | (uint8)MT_RPC_SYS_SYS),                                 MT_SYS_OSAL_NV_LENGTH, 2, rsp);}
开发者ID:DIYzzuzpb,项目名称:ZStack-CC2530-2.5.1-GPRS_GateWay,代码行数:30,


示例20: MT_NlmeRouteDiscoveryRequest

/*************************************************************************************************** * @fn      MT_NlmeRouteDiscoveryRequest * * @brief   Route Discovery Request * * @param   pBuf - pointer to the received buffer * * @return  void ***************************************************************************************************/void MT_NlmeRouteDiscoveryRequest(uint8 *pBuf){  uint8 retValue = ZFailure;  uint8 cmdId;  /* parse header */  cmdId = pBuf[MT_RPC_POS_CMD1];  pBuf += MT_RPC_FRAME_HDR_SZ;  if ( ZSTACK_ROUTER_BUILD )  {    retValue = NLME_RouteDiscoveryRequest(BUILD_UINT16(pBuf[0], pBuf[1]), pBuf[2], pBuf[3]);  }  else  {    retValue = ZUnsupportedMode;  }  /* Build and send back the response */  MT_BuildAndSendZToolResponse(((uint8)MT_RPC_CMD_SRSP | (uint8)MT_RPC_SYS_NWK), cmdId, 1, &retValue);}
开发者ID:paoloach,项目名称:zpowermeter,代码行数:30,


示例21: modbus_multi_write

/****************************************************************************** * @fn      modbus_multi_write */void modbus_multi_write( uint8 *data_buffer, uint8 len){  uint8 address;    address = BUILD_UINT16( data_buffer[3], data_buffer[2]);    if( address == MODBUS_SECURITY_KEY_START)  {    if(data_buffer[6]>=32)    {      for(uint8 i=0; i<16; i++)      {      //  osal_memcpy(defaultKey, data_buffer[7+i*2], 1);        defaultKey[i] = data_buffer[7+i*2];        zgPreconfigKeyInit( TRUE );        // Initialize NV items for all Keys: NWK, APS, TCLK and Master        ZDSecMgrInitNVKeyTables( TRUE );      }    }  }}
开发者ID:TemcoLijun,项目名称:Zigbee_Modules,代码行数:25,


示例22: oadWriteAttrCB

/********************************************************************* * @fn      oadWriteAttrCB * * @brief   Validate and Write attribute data * * @param   connHandle - connection message was received on * @param   pAttr - pointer to attribute * @param   pValue - pointer to data to be written * @param   len - length of data * @param   offset - offset of the first octet to be written * @param   method - type of write message  * * @return  SUCCESS, blePending or Failure */static bStatus_t oadWriteAttrCB(uint16 connHandle, gattAttribute_t *pAttr,                                uint8 *pValue, uint8 len, uint16 offset,                                uint8 method){  bStatus_t status = SUCCESS;  if ( pAttr->type.len == ATT_BT_UUID_SIZE )  {    // 16-bit UUID    uint16 uuid = BUILD_UINT16( pAttr->type.uuid[0], pAttr->type.uuid[1]);    if ( uuid == GATT_CLIENT_CHAR_CFG_UUID)    {      status = GATTServApp_ProcessCCCWriteReq( connHandle, pAttr, pValue, len,                                               offset, GATT_CLIENT_CFG_NOTIFY );    }    else    {      status = ATT_ERR_ATTR_NOT_FOUND; // Should never get here!    }  }  else  {    // 128-bit UUID    if (osal_memcmp(pAttr->type.uuid, oadCharUUID[OAD_CHAR_IMG_IDENTIFY], ATT_UUID_SIZE))    {      status = oadImgIdentifyWrite( connHandle, pValue );    }    else if (osal_memcmp(pAttr->type.uuid, oadCharUUID[OAD_CHAR_IMG_BLOCK], ATT_UUID_SIZE))    {      status = oadImgBlockWrite( connHandle, pValue );    }    else    {      status = ATT_ERR_ATTR_NOT_FOUND; // Should never get here!    }  }  return status;}
开发者ID:DRuffer,项目名称:coinForth,代码行数:53,


示例23: zclElectricalMeasurement_ProcessInCmd_GetMeasurementProfileRsp

/********************************************************************* * @fn      zclElectricalMeasurement_ProcessInCmd_GetMeasurementProfileRsp * * @brief   Process in the received Electrical Measurement Get Measurement Profile Response cmd * * @param   pInMsg - pointer to the incoming message * @param   pCBs - pointer to the application callbacks * * @return  ZStatus_t */static ZStatus_t zclElectricalMeasurement_ProcessInCmd_GetMeasurementProfileRsp( zclIncoming_t *pInMsg,                                                                                 zclElectricalMeasurement_AppCallbacks_t *pCBs ){  uint8 i;  uint8 offset;  uint16 calculatedIntervalSize;  zclElectricalMeasurementGetMeasurementProfileRsp_t cmd;  ZStatus_t status;  if ( pCBs->pfnElectricalMeasurement_GetMeasurementProfileRsp )  {    // determine size of intervals by subtracting size of startTime, status,    // profileIntervalPeriod, numberOfIntervalsDelivered, and attributeID from message length    calculatedIntervalSize = pInMsg->pDataLen - 9;    cmd.pIntervals = zcl_mem_alloc( calculatedIntervalSize );    if ( !cmd.pIntervals )    {      return ( ZMemError );  // no memory, return failure    }    cmd.startTime = BUILD_UINT32( pInMsg->pData[0], pInMsg->pData[1], pInMsg->pData[2], pInMsg->pData[3] );    cmd.status = pInMsg->pData[4];    cmd.profileIntervalPeriod = pInMsg->pData[5];    cmd.numberOfIntervalsDelivered = pInMsg->pData[6];    cmd.attributeID = BUILD_UINT16( pInMsg->pData[7], pInMsg->pData[8] );    offset = 9;    for ( i = 0; i < calculatedIntervalSize; i++ )    {      cmd.pIntervals[i] = pInMsg->pData[offset++];    }    status = ( pCBs->pfnElectricalMeasurement_GetMeasurementProfileRsp( &cmd ) );    zcl_mem_free( cmd.pIntervals );    return status;  }  return ( ZFailure );}
开发者ID:Daan1992,项目名称:WSN-Lab,代码行数:49,


示例24: SNP_getGapParam

/** *  SNP_getGapParam * */uint8_t SNP_getGapParam(snpGetGapParamReq_t* pReq){      uint8_t status;    //Move part of the simple peripheral init back here    if((pReq->paramId != TGAP_AUTH_TASK_ID) &&         (pReq->value < TGAP_PARAMID_MAX))    {      uint16_t value;      value = GAP_GetParamValue(pReq->paramId);      pReq->value = BUILD_UINT16( LO_UINT16(value),  HI_UINT16(value));    }    if(pReq->value != 0xFFFF)    {      status = SNP_SUCCESS;    }    else    {      status = SNP_INVALID_PARAMS;    }    return status;}
开发者ID:victor-zheng,项目名称:BLE,代码行数:26,


示例25: MT_UtilzclGeneral_KeyEstablish_InitiateKeyEstablishment

/*************************************************************************************************** * @fn      MT_UtilzclGeneral_KeyEstablish_InitiateKeyEstablishment * * @brief   Proxy the zclGeneral_KeyEstablish_InitiateKeyEstablishment() function. * * @param   pBuf - pointer to the received buffer * * @return  void ***************************************************************************************************/static void MT_UtilzclGeneral_KeyEstablish_InitiateKeyEstablishment(uint8 *pBuf){  afAddrType_t partnerAddr;  uint8 cmdId = pBuf[MT_RPC_POS_CMD1];  pBuf += MT_RPC_FRAME_HDR_SZ;  partnerAddr.panId = 0;  // Not an inter-pan message.  partnerAddr.endPoint = pBuf[2];  partnerAddr.addrMode = (afAddrMode_t)pBuf[3];  if (afAddr64Bit == partnerAddr.addrMode)  {    (void)osal_memcpy(partnerAddr.addr.extAddr, pBuf+4, Z_EXTADDR_LEN);  }  else  {    partnerAddr.addr.shortAddr = BUILD_UINT16(pBuf[4], pBuf[5]);  }  zcl_key_establish_task_id = pBuf[0];  *pBuf = zclGeneral_KeyEstablish_InitiateKeyEstablishment(MT_TaskID, &partnerAddr, pBuf[1]);  MT_BuildAndSendZToolResponse(((uint8)MT_RPC_CMD_SRSP | (uint8)MT_RPC_SYS_UTIL), cmdId, 1, pBuf);}
开发者ID:FrankieChan885,项目名称:EndDevice-Project-for-editing,代码行数:31,


示例26: MT_SysOsalNVWrite

/*************************************************************************************************** * @fn      MT_SysOsalNVWrite * * @brief * * @param   uint8 pData - pointer to the data * * @return  None ***************************************************************************************************/void MT_SysOsalNVWrite(uint8 *pBuf){  uint16 nvId;  uint8 nvItemLen=0, nvItemOffset=0;  uint8 rtrn;  /* Skip over RPC header */  pBuf += MT_RPC_FRAME_HDR_SZ;  /* Get the ID */  nvId = BUILD_UINT16(pBuf[0], pBuf[1]);  /* Get the offset */  nvItemOffset = pBuf[2];  /* Get the length */  nvItemLen = pBuf[3];  pBuf += 4;  /* Default to ZFailure */  rtrn = ZFailure;  /* Set the Z-Globals value of this NV item. */  zgSetItem( nvId, (uint16)nvItemLen, pBuf );  if ((osal_nv_write(nvId, (uint16)nvItemOffset, (uint16)nvItemLen, pBuf)) == ZSUCCESS)  {    if (nvId == ZCD_NV_EXTADDR)    {      rtrn = ZMacSetReq(ZMacExtAddr, pBuf);    }    else    {      rtrn = ZSuccess;    }  }  /* Build and send back the response */  MT_BuildAndSendZToolResponse(((uint8)MT_RPC_CMD_SRSP | (uint8)MT_RPC_SYS_SYS),                                 MT_SYS_OSAL_NV_WRITE, 1, &rtrn);}
开发者ID:DIYzzuzpb,项目名称:ZStack-CC2530-2.5.1-GPRS_GateWay,代码行数:48,


示例27: zclElectricalMeasurement_ProcessInCmd_GetProfileInfoRsp

/********************************************************************* * @fn      zclElectricalMeasurement_ProcessInCmd_GetProfileInfoRsp * * @brief   Process in the received Electrical Measurement Get Profile Info Response cmd * * @param   pInMsg - pointer to the incoming message * @param   pCBs - pointer to the application callbacks * * @return  ZStatus_t */static ZStatus_t zclElectricalMeasurement_ProcessInCmd_GetProfileInfoRsp( zclIncoming_t *pInMsg,                                                                          zclElectricalMeasurement_AppCallbacks_t *pCBs ){  uint8 i;  uint8 offset;  uint16 calculatedArraySize;  zclElectricalMeasurementGetProfileInfoRsp_t cmd;  ZStatus_t status;  if ( pCBs->pfnElectricalMeasurement_GetProfileInfoRsp )  {    // calculate size of variable array    calculatedArraySize = pInMsg->pDataLen - 3;  // variable array - 3 bytes of fixed variables    cmd.pListOfAttributes = zcl_mem_alloc( calculatedArraySize );    if ( !cmd.pListOfAttributes )    {      return ( ZMemError );  // no memory, return failure    }    cmd.profileCount = pInMsg->pData[0];    cmd.profileIntervalPeriod = pInMsg->pData[1];    cmd.maxNumberOfIntervals = pInMsg->pData[2];    cmd.numberOfAttributes = calculatedArraySize / sizeof( uint16 );    offset = 3;    for ( i = 0; i < cmd.numberOfAttributes; i++ )    {      cmd.pListOfAttributes[i] = BUILD_UINT16( pInMsg->pData[offset], pInMsg->pData[offset + 1] );      offset += 2;    }    status = ( pCBs->pfnElectricalMeasurement_GetProfileInfoRsp( &cmd ) );    zcl_mem_free( cmd.pListOfAttributes );    return status;  }  return ( ZFailure );}
开发者ID:Daan1992,项目名称:WSN-Lab,代码行数:48,


示例28: glucoseConfigGattMsg

/********************************************************************* * @fn      glucoseConfigGattMsg()   * * @brief   Handle GATT messages for characteristic configuration. * * @param   state - Discovery state. * @param   pMsg - GATT message. * * @return  New configuration state. */uint8_t glucoseConfigGattMsg(uint8_t state, gattMsgEvent_t *pMsg){  if ((pMsg->method == ATT_READ_RSP || pMsg->method == ATT_WRITE_RSP) &&      (pMsg->hdr.status == SUCCESS))  {    // Process response    switch (glucoseConfigList[state])    {      case HDL_GLUCOSE_MEAS_CCCD:        break;              case HDL_GLUCOSE_CONTEXT_CCCD:        break;              case HDL_GLUCOSE_CTL_PNT_CCCD:        break;              case HDL_GLUCOSE_FEATURE:        glucoseFeatures = BUILD_UINT16(pMsg->msg.readRsp.pValue[0],                                        pMsg->msg.readRsp.pValue[1]);        break;              case HDL_DEVINFO_SYSTEM_ID:        break;              case HDL_DEVINFO_MANUFACTURER_NAME:        break;              case HDL_DEVINFO_MODEL_NUM:        break;              default:        break;    }  }  return glucoseConfigNext(state + 1);}
开发者ID:ClarePhang,项目名称:ALL_SmartBatterySwitch_CC2640,代码行数:48,


示例29: uartServ1_WriteAttrCB

/* * @fn      uartServ1_WriteAttrCB * * @brief   Validate attribute data prior to a write operation * * @param   connHandle - connection message was received on * @param   pAttr - pointer to attribute * @param   pValue - pointer to data to be written * @param   len - length of data * @param   offset - offset of the first octet to be written * * @return  Success or Failure */static bStatus_t uartServ1_WriteAttrCB(uint16 connHandle, gattAttribute_t *pAttr, uint8 *pValue, uint8 len, uint16 offset){	bStatus_t	status = SUCCESS;	dmsg(("/033[40;31m0xFFE9 (Write)/033[0m/n"));	// If attribute permissions require authorization to write, return error	if (gattPermitAuthorWrite(pAttr->permissions)) {		// Insufficient authorization		return (ATT_ERR_INSUFFICIENT_AUTHOR);	}	if (pAttr->type.len == ATT_BT_UUID_SIZE) {		// 16-bit UUID		uint16	uuid = BUILD_UINT16(pAttr->type.uuid[0], pAttr->type.uuid[1]);		switch (uuid) {		case UARTSERV1_CHAR_UUID:			osal_memcpy(pAttr->pValue, pValue, len);			if (uartServ1_AppCBs) {				uartServ1_AppCBs(UARTSERV1_CHAR);			}			break;		default:			// should never get here! (characteristic 2 do not have write permissions)			dmsg(("err/n"));			status = ATT_ERR_ATTR_NOT_FOUND;			break;		}	} else {		// 128-bit UUID		status = ATT_ERR_INVALID_HANDLE;	}	return (status);}
开发者ID:wythe-lin,项目名称:ZTKBLE,代码行数:51,


示例30: MT_SysOsalStartTimer

/*************************************************************************************************** * @fn      MT_SysOsalStartTimer * * @brief * * @param   uint8 pData - pointer to the data * * @return  None ***************************************************************************************************/void MT_SysOsalStartTimer(uint8 *pBuf){  uint16 eventId;  uint8 retValue = ZFailure;  uint8 cmdId;  /* parse header */  cmdId = pBuf[MT_RPC_POS_CMD1];  pBuf += MT_RPC_FRAME_HDR_SZ;  if (*pBuf <= 3)  {    eventId = (uint16) MT_SysOsalEventId[*pBuf];    retValue = osal_start_timerEx(MT_TaskID, eventId, BUILD_UINT16(pBuf[1], pBuf[2]));  }  else  {    retValue = ZInvalidParameter;  }  /* Build and send back the response */  MT_BuildAndSendZToolResponse(((uint8)MT_RPC_CMD_SRSP | (uint8)MT_RPC_SYS_SYS), cmdId, 1, &retValue);}
开发者ID:DIYzzuzpb,项目名称:ZStack-CC2530-2.5.1-GPRS_GateWay,代码行数:32,



注:本文中的BUILD_UINT16函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ BUILTIN_TYPE函数代码示例
C++ BUILD_BUG_ON函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。