This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

simpleGATTprofile中有5个Characteristic,第2个不能用BTOOL写数据,看资料说是没有写权限,我做了一点修改,发现还不可以写入,HELP!!



具体改动如下,static bStatus_t simpleProfile_WriteAttrCB( uint16 connHandle, gattAttribute_t *pAttr,
                                 uint8 *pValue, uint8 len, uint16 offset ),这个函数在GATTProfile.c 里面

// Simple Profile Characteristic 2 Properties
static uint8 simpleProfileChar2Props = GATT_PROP_READ| GATT_PROP_WRITE; 声明里面本人添加的,GATT_PROP_WRITE;

case SIMPLEPROFILE_CHAR1_UUID:
      case SIMPLEPROFILE_CHAR3_UUID:
       
       case SIMPLEPROFILE_CHAR2_UUID:  本人添加的

        //Validate the value
        // Make sure it's not a blob oper
        if ( offset == 0 )
        {
          if ( len != 1 )
          {
            status = ATT_ERR_INVALID_VALUE_SIZE;
          }
        }
        else
        {
          status = ATT_ERR_ATTR_NOT_LONG;
        }
       
        //Write the value
        if ( status == SUCCESS )
        {
          uint8 *pCurValue = (uint8 *)pAttr->pValue;       
          *pCurValue = pValue[0];

          if( pAttr->pValue == &simpleProfileChar1 )
          {
            notifyApp = SIMPLEPROFILE_CHAR1;  P0_1=1;P1_0=1;     
          }
          else if( pAttr->pValue == &simpleProfileChar3 )
          {
            notifyApp = SIMPLEPROFILE_CHAR3;          
          }
         
           else if( pAttr->pValue == &simpleProfileChar2)  本人添加的
          {
            notifyApp = SIMPLEPROFILE_CHAR2;      P1_1=1;    
          }
          else ;
         
        }

另外在 函数

static void simpleProfileChangeCB( uint8 paramID )

 case SIMPLEPROFILE_CHAR3:
      SimpleProfile_GetParameter( SIMPLEPROFILE_CHAR3, &newValue );
     
     
       case SIMPLEPROFILE_CHAR2:   这下面是自己添加。
      SimpleProfile_GetParameter( SIMPLEPROFILE_CHAR2, &newValue );
     
      if(newValue==0xf4){P1_1=~P1_1;P1_4=~P1_4;}

 

就修改了这3个地方,用BTOOL写不进去,