-OCStackResult SendPingMessage(KeepAliveEntry_t *entry)
-{
- VERIFY_NON_NULL(entry, FATAL, OC_STACK_INVALID_PARAM);
-
- // Send ping message.
- OCCallbackData pingData = { .context = NULL, .cb = PingRequestCallback };
- OCDevAddr devAddr = { .adapter = OC_ADAPTER_TCP };
- CopyEndpointToDevAddr(&(entry->remoteAddr), &devAddr);
-
- OCRepPayload *payload = CreateKeepAlivePayload(entry->interval);
- OCStackResult result = OCDoResource(NULL, OC_REST_POST, KEEPALIVE_RESOURCE_URI, &devAddr,
- (OCPayload *) payload, CT_ADAPTER_TCP, OC_LOW_QOS,
- &pingData, NULL, 0);
- if (OC_STACK_OK != result)
- {
- OIC_LOG(ERROR, TAG, "OCDoResource has failed");
- return result;
- }
-
- // Update timeStamp with time sent ping message for next ping message.
- entry->timeStamp = OICGetCurrentTime(TIME_IN_US);
- entry->sentPingMsg = true;
-
- OIC_LOG_V(DEBUG, TAG, "Client sent ping message, interval [%" PRId64 "]", entry->interval);
-
- return OC_STACK_OK;
-}
-
-OCStackApplicationResult PingRequestCallback(void* ctx, OCDoHandle handle,
- OCClientResponse *clientResponse)
-{
- (void) ctx;
- (void) handle;
- if (NULL == clientResponse)
- {
- OIC_LOG(ERROR, TAG, "clientResponse is NULL");
- return OC_STACK_DELETE_TRANSACTION;
- }
-
- CAEndpoint_t endpoint = { .adapter = CA_ADAPTER_TCP };
- CopyDevAddrToEndpoint(&(clientResponse->devAddr), &endpoint);
-
- HandleKeepAliveResponse(&endpoint, clientResponse->result,
- (OCRepPayload *)clientResponse->payload);
-
- return OC_STACK_DELETE_TRANSACTION;
-}
-
-KeepAliveEntry_t *GetEntryFromEndpoint(const CAEndpoint_t *endpoint, uint32_t *index)