: bharatvaj/forwarder

commit e6fafb156e0eea0ade91179ea5f76be50d68496b
parent c491733cbcd2a128423c7cf73d884ef520444cc6
Author: Goutham SM <gouthamsm97@gmail.com>
Date: Thu, 31 Jan 2019 18:12:53 +0530

Added input params for bluetooth
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/right_initiator/right_initiator.cpp b/right_initiator/right_initiator.cpp
@@ -6,16 +6,20 @@
 
 using namespace std;
 
+bdaddr_t inc = ((bdaddr_t) {{0, 0, 0, 0, 0, 0}});
+
 int main(int argc, char *argv[]){
 
 	    struct sockaddr_rc addr = { 0 };
-	    int s, status;
+	    int s, status=0;
 	    char dest[18] = "B8:27:EB:A5:A1:70";
 	    // allocate a socket
 	    s = socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);
+	    cout << s << endl;
 
 	    // set the connection parameters (who to connect to)
 	    addr.rc_family = AF_BLUETOOTH;
+	    addr.rc_bdaddr = inc;
 	    addr.rc_channel = (uint8_t) 1;
 	    str2ba( dest, &addr.rc_bdaddr );
 

@@ -28,7 +32,9 @@ int main(int argc, char *argv[]){
 		char buffer[10];
 	        status = recv(s, buffer, 6, 0);
 	    } else {
-		cout << "Connection failed" << endl;
+		    int se=errno;
+		cout << "Connection failed" <<status<<se<< endl;
+
 	    }
 	    close(s);
 	    while(1);