move createHapResponse()

This commit is contained in:
hathach committed 2018-01-15 16:17:09 +07:00
1 parent 83ad264e35
commit b3f0598b1a
4 files changed
+23 -23

No files matched your search

@@ -182,27 +182,6 @@ uint16_t HAPCharacteristic::writeHapValue(uint32_t num)
return writeHapValue(&num, len);
}
HAPResponse_t* HAPCharacteristic::createHapResponse(uint8_t tid, uint8_t status, TLV8_t tlv_para[], uint8_t count)
{
// Determine body len, does not to include 2 byte length itself
uint16_t body_len = tlv8_calculate_encode_len(tlv_para, count);
HAPResponse_t* hap_resp = (HAPResponse_t*) rtos_malloc(sizeof(HAPResponseHeader_t) + 2 + body_len);
VERIFY( hap_resp != NULL, NULL );
/*------------- Header -------------*/
varclr(&hap_resp->header.control);
hap_resp->header.control.fragment = 0;
hap_resp->header.control.type = HAP_PDU_RESPONSE;
hap_resp->header.tid = tid;
hap_resp->header.status = status;
hap_resp->body_len = body_len;
/*------------- Serialize Data -------------*/
tlv8_encode_n(hap_resp->body_data, body_len, tlv_para, count);
return hap_resp;
}
HAPResponse_t* HAPCharacteristic::processChrSignatureRead(HAPRequest_t* hap_req)
{
uint16_t svc_id = ((HAPService*)_service)->getSvcId();