Skip to content

Instantly share code, notes, and snippets.

@amcjen
Created March 6, 2014 00:19
Show Gist options
  • Save amcjen/9379591 to your computer and use it in GitHub Desktop.
Save amcjen/9379591 to your computer and use it in GitHub Desktop.
// called whenever another scout sends an answer back to us
bool leadAnswers(NWK_DataInd_t *ind) {
bool end = false;
int at;
if (ind->options & NWK_IND_OPT_MULTICAST) {
if (hqVerboseOutput) {
speol("MULTICAST on wrong endpoint");
}
return true;
}
if (hqVerboseOutput) {
speol("Received answer");
}
if (ind->data[ind->size-1] == 0) {
end = true;
ind->size--;
}
sprintf(leadAnnounceSig,"{\"type\":\"reply\",\"id\":%d,\"from\":%d,\"reply\":\"", leadAnswerID, ind->srcAddr);
at = strlen(leadAnnounceSig);
memcpy(leadAnnounceSig+at, ind->data, ind->size);
sprintf(leadAnnounceSig+at+ind->size, "\",\"end\":%s}\n",end ? "true" : "false");
leadSignal(leadAnnounceSig);
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment