Replace TLV8 (*it)[0] with new TLV8 getVal() method in HAP.cpp
This commit is contained in:
parent
d40d709643
commit
5ded77d6d9
12
src/HAP.cpp
12
src/HAP.cpp
|
|
@ -334,7 +334,7 @@ int HAPClient::postPairSetupURL(uint8_t *content, size_t len){
|
|||
return(0);
|
||||
}
|
||||
|
||||
int tlvState=(*itState)[0];
|
||||
int tlvState=(*itState).getVal();
|
||||
|
||||
if(nAdminControllers()){ // error: Device already paired (i.e. there is at least one admin Controller). We should not be receiving any requests for Pair-Setup!
|
||||
LOG0("\n*** ERROR: Device already paired!\n\n");
|
||||
|
|
@ -363,7 +363,7 @@ int HAPClient::postPairSetupURL(uint8_t *content, size_t len){
|
|||
|
||||
auto itMethod=iosTLV.find(kTLVType_Method);
|
||||
|
||||
if(iosTLV.len(itMethod)!=1 || (*itMethod)[0]!=0){ // error: "Pair Setup" method must always be 0 to indicate setup without MiFi Authentification (HAP Table 5-3)
|
||||
if(iosTLV.len(itMethod)!=1 || (*itMethod).getVal()!=0){ // error: "Pair Setup" method must always be 0 to indicate setup without MiFi Authentification (HAP Table 5-3)
|
||||
LOG0("\n*** ERROR: Pair 'Method' missing or not set to 0\n\n");
|
||||
responseTLV.add(kTLVType_Error,tagError_Unavailable); // set Error=Unavailable
|
||||
tlvRespond(responseTLV); // send response to client
|
||||
|
|
@ -585,7 +585,7 @@ int HAPClient::postPairVerifyURL(uint8_t *content, size_t len){
|
|||
return(0);
|
||||
}
|
||||
|
||||
int tlvState=(*itState)[0];
|
||||
int tlvState=(*itState).getVal();
|
||||
|
||||
if(!nAdminControllers()){ // error: Device not yet paired - we should not be receiving any requests for Pair-Verify!
|
||||
LOG0("\n*** ERROR: Device not yet paired!\n\n");
|
||||
|
|
@ -771,7 +771,7 @@ int HAPClient::postPairingsURL(uint8_t *content, size_t len){
|
|||
auto itState=iosTLV.find(kTLVType_State);
|
||||
auto itMethod=iosTLV.find(kTLVType_Method);
|
||||
|
||||
if(iosTLV.len(itState)!=1 || (*itState)[0]!=1){ // missing STATE TLV
|
||||
if(iosTLV.len(itState)!=1 || (*itState).getVal()!=1){ // missing STATE TLV
|
||||
LOG0("\n*** ERROR: Parirings 'State' is either missing or not set to <M1>\n\n");
|
||||
badRequestError(); // return with 400 error, which closes connection
|
||||
return(0);
|
||||
|
|
@ -783,7 +783,7 @@ int HAPClient::postPairingsURL(uint8_t *content, size_t len){
|
|||
return(0);
|
||||
}
|
||||
|
||||
int tlvMethod=(*itMethod)[0];
|
||||
int tlvMethod=(*itMethod).getVal();
|
||||
|
||||
responseTLV.add(kTLVType_State,pairState_M2); // all responses include State=M2
|
||||
|
||||
|
|
@ -810,7 +810,7 @@ int HAPClient::postPairingsURL(uint8_t *content, size_t len){
|
|||
return(0);
|
||||
}
|
||||
|
||||
tagError err=addController(*itIdentifier,*itPublicKey,(*itPermissions)[0]);
|
||||
tagError err=addController(*itIdentifier,*itPublicKey,(*itPermissions).getVal());
|
||||
if(err!=tagError_None)
|
||||
responseTLV.add(kTLVType_Error,err);
|
||||
|
||||
|
|
|
|||
|
|
@ -260,11 +260,11 @@ void TLV8::print(TLV8_it it1, TLV8_it it2){
|
|||
for(int i=0;i<(*it1).len;i++)
|
||||
Serial.printf("%02X",(*it1).val.get()[i]);
|
||||
if((*it1).len==0)
|
||||
Serial.printf(" (null)");
|
||||
Serial.printf(" [null]");
|
||||
else if((*it1).len<=4)
|
||||
Serial.printf(" (%u)",(*it1).getVal());
|
||||
Serial.printf(" [%u]",(*it1).getVal());
|
||||
else if((*it1).len<=8)
|
||||
Serial.printf(" (%llu)",(*it1).getVal<uint64_t>());
|
||||
Serial.printf(" [%llu]",(*it1).getVal<uint64_t>());
|
||||
Serial.printf("\n");
|
||||
it1++;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue