#include <stdio.h>
#include "MyroC.h"

/* Program to test versions of rConnect () 
  
compile with line
   gcc -lbluetooth -o Myro-test-rConnect Myro-test-rConnect.c MyroC.o

*/

int main(int argc, char **argv){

  int perlis, markov, post, wilkes, curry, goldstine, hahn;

   // test use of rfcomm0
  /*
  perlis = rConnect ("/dev/rfcomm0");
  rBeep (2, 880);
  rBeep (3, 1760);
  rSetName ("perlis");
  sleep (1);
  */

// test use of IPRE number alone
/*
  post = rConnect ("365827");
  rBeep (2, 880);
  rBeep (3, 1760);
  rSetName("post");
  sleep (1);
  */

  // test use of IPRE number alone
  markov = rConnect ("365688");
  rBeep (2, 880);
  rBeep (3, 1760);
  rSetName("markov");
  sleep (1);

  // test use of Fluke 2 number alone
  /*
  goldstine = rConnect ("0519");
  rBeep (2, 880);
  rBeep (3, 1760);
  rSetName ("goldstine");
  */

  // test use of Fluke 2 number with Fluke-
  /*
  hahn = rConnect ("Fluke2-051F");
  rBeep (2, 880);
  rBeep (3, 1760);
  rSetName ("hahn");
  */

  // test use of IPRE number with IPRE
  curry = rConnect ("IPRE6-365897");
  rBeep (2, 880);
  rBeep (3, 1760);
  rSetName ("curry");
  sleep (1);
  // test use of MAC address
 
  wilkes = rConnect ("00:1E:19:01:0E:13");
  rBeep (2, 880);
  rBeep (3, 1760);
  rSetName ("wilkes");

  rSetName("ddddxyzghijklZAB");
  printf("new name is %s\n", rGetName());
  rSetName ("wilkes");
  rSetForwardness("scribbler-forward");
  printf("%s\n", rGetForwardness());
  rBeep (1.0, 880);
  rSetForwardness("fluke-forward");
  printf("%s\n", rGetForwardness());

  /* tell perlis to beep */
  rSetConnection (curry);
  rBeep (2, 1000);

  /* tell markov to beep */
  rSetConnection (markov);
  rBeep (2, 1000);

  /*
  rSetConnection (perlis);
  printf ("disconnecting from %s\n", rGetName());
  rDisconnect();
  */

  rSetConnection (markov);
  printf ("disconnecting from %s\n", rGetName());
  rDisconnect();

  /*
  rSetConnection (post);
  printf ("disconnecting from %s\n", rGetName());
  rDisconnect();
  */

  rSetConnection (curry);
  printf ("disconnecting from %s\n", rGetName());
  rDisconnect();

  rSetConnection (wilkes);
  printf ("disconnecting from %s\n", rGetName());
  rDisconnect();

  /*
  rSetConnection (goldstine);
  printf ("disconnecting from %s\n", rGetName());
  rDisconnect();

  rSetConnection (hahn);
  printf ("disconnecting from %s\n", rGetName());
  rDisconnect();
  */

  return 0;
}
