-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ed15da6
commit b8596de
Showing
3 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#! /bin/bash | ||
gcc -Wall -c ../nic_app/src/nic_app.c -o nic_app.o | ||
mv nic_app.o src | ||
cp ../nic_app/src/nic_app.h src | ||
cd src | ||
export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH | ||
gcc -Wall -pthread -o chat chat.c nic_app.o |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Jessicat-H | ||
dylanchapell | ||
tonydoesathing |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <string.h> | ||
#include "nic_app.h" | ||
|
||
char buf[SIZE] = {0}; | ||
uint8_t APP_ID=2; | ||
|
||
/** | ||
* Print out the message received | ||
*/ | ||
void receiveMessage(uint8_t* message) { | ||
printf("%d: %s \n", message[1], &message[6]); | ||
} | ||
|
||
/** | ||
* Initialize the router connection and then listen for user input | ||
*/ | ||
int main(){ | ||
// init nic_app | ||
nic_app_init(APP_ID, receiveMessage); | ||
|
||
// get user input | ||
while (1){ | ||
printf("Destination ID: \n"); | ||
char destString[5]; | ||
fgets(destString,5,stdin); | ||
uint8_t destID = atoi(destString); | ||
printf("Message: \n"); | ||
fgets(buf,SIZE-2,stdin); //will this yell at us? lets find out. | ||
|
||
send_message(destID,APP_ID,buf,strlen(buf)+1); | ||
} | ||
return 0; | ||
} |