Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int hello(void)
- {
- int result;
- if (udpmain->Connected())
- {
- sprintf(DataOut, "%s", "Are_you_KAU-2?\r\n");
- udpmain->Send(DataOut, 0);
- int i = udpmain->ReceiveBuffer(rec, 300);
- if(i==0)
- {
- sprintf(str, "%s", "Device not detected!\r\n");
- result = error_no_answer;
- kau2_disconnect();
- }
- else
- {
- BytesToRaw(rec, rec_char, 8);
- if (strcmp(rec_char, "Yes_I_am") == 0)
- {
- result = error_success;
- }
- else
- {
- result = error_bad_answer;
- kau2_disconnect();
- }
- }
- }
- else
- {
- result = error_socket;
- kau2_disconnect();
- }
- memset(DataOut, NULL, sizeof(str));
- rec[0] = 0;
- memset(rec_char, NULL, sizeof(rec_char));
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment