Created
March 6, 2014 00:19
-
-
Save amcjen/9379591 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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