예제 #1
0
int
main (int argc,
      char *argv1[])
{
  char *const argv[] = {
    "test-core-api",
    "-c",
    "test_core_api_data.conf",
    NULL
  };
  struct GNUNET_GETOPT_CommandLineOption options[] = {
    GNUNET_GETOPT_OPTION_END
  };
  ok = 1;
  GNUNET_log_setup ("test-core-api",
                    "WARNING",
                    NULL);
  GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1,
		      argv,
                      "test-core-api",
		      "nohelp",
		      options,
		      &run,
		      &ok);
  stop_arm (&p1);
  stop_arm (&p2);
  GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-peer-1");
  GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-peer-2");

  return ok;
}
/**
 * Try again to connect to transport service.
 */
static void
shutdown_task (void *cls)
{
  if (NULL != timeout_task)
  {
    GNUNET_SCHEDULER_cancel (timeout_task);
    timeout_task = NULL;
  }
  if (NULL != p1.ghh)
  {
    GNUNET_TRANSPORT_hello_get_cancel (p1.ghh);
    p1.ghh = NULL;
  }
  if (NULL != p1.th)
  {
    GNUNET_TRANSPORT_core_disconnect (p1.th);
    p1.th = NULL;
  }
  if (NULL != p2.ghh)
  {
    GNUNET_TRANSPORT_hello_get_cancel (p2.ghh);
    p2.ghh = NULL;
  }
  if (NULL != p2.th)
  {
    GNUNET_TRANSPORT_core_disconnect (p2.th);
    p2.th = NULL;
  }
  stop_arm (&p1);
  stop_arm (&p2);
}
예제 #3
0
int
main (int argc, char *argv[])
{
    char *const argvx[] = {
        "test-fs-start-stop",
        "-c",
        "test_fs_data.conf",
#if VERBOSE
        "-L", "DEBUG",
#endif
        NULL
    };
    struct GNUNET_GETOPT_CommandLineOption options[] = {
        GNUNET_GETOPT_OPTION_END
    };

    GNUNET_log_setup ("test_fs_start_stop",
#if VERBOSE
                      "DEBUG",
#else
                      "WARNING",
#endif
                      NULL);
    GNUNET_PROGRAM_run ((sizeof (argvx) / sizeof (char *)) - 1, argvx,
                        "test-fs-start-stop", "nohelp", options, &run, NULL);
    stop_arm (&p1);
    GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs/");
    return 0;
}
static void
end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
  if (endbadly_task != GNUNET_SCHEDULER_NO_TASK)
  {
    GNUNET_SCHEDULER_cancel (endbadly_task);
    endbadly_task = GNUNET_SCHEDULER_NO_TASK;
  }

  int c;
  for (c = 0; c < RECORDS; c++)
    GNUNET_free_non_null((void *) s_rd[c].data);
  GNUNET_free (s_rd);

  if (privkey != NULL)
    GNUNET_CRYPTO_rsa_key_free (privkey);
  privkey = NULL;

  if (nsh != NULL)
    GNUNET_NAMESTORE_disconnect (nsh, GNUNET_YES);
  nsh = NULL;

  if (NULL != arm)
    stop_arm();
}
예제 #5
0
static int
check ()
{
    char *const argv[] = { "test-core-api",
                           "-c",
                           "test_core_api_data.conf",
                           NULL
                         };
    struct GNUNET_GETOPT_CommandLineOption options[] = {
        GNUNET_GETOPT_OPTION_END
    };
    ok = 1;
    GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv,
                        "test-core-api", "nohelp", options, &run, &ok);
    stop_arm (&p1);
    stop_arm (&p2);
    return ok;
}
static int
check ()
{
  char *const argv[] = { "test-core-api-start-only",
    "-c",
    "test_core_api_data.conf",
    NULL
  };
  struct GNUNET_GETOPT_CommandLineOption options[] = {
    GNUNET_GETOPT_OPTION_END
  };
  GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-peer-1");
  GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-peer-2");

  ok = 1;
  GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv,
                      "test-core-api-start-only", "nohelp", options, &run, &ok);
  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test finished\n");
  stop_arm (&p1);
  stop_arm (&p2);
  return ok;
}
예제 #7
0
/**
 * Re-establish the connection to the service.
 *
 * @param cls handle to use to re-connect.
 * @param tc scheduler context
 */
static void
endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
  if (nsh != NULL)
    GNUNET_NAMESTORE_disconnect (nsh, GNUNET_YES);
  nsh = NULL;

  if (privkey != NULL)
    GNUNET_CRYPTO_rsa_key_free (privkey);
  privkey = NULL;

  if (NULL != arm)
    stop_arm();

  res = 1;
}
int
main (int argc, char *argv[])
{
  char *const argvx[] = {
    "test-fs-publish-persistence",
    "-c",
    "test_fs_publish_data.conf",
#if VERBOSE
    "-L", "DEBUG",
#endif
    NULL
  };
  struct GNUNET_GETOPT_CommandLineOption options[] = {
    GNUNET_GETOPT_OPTION_END
  };

  GNUNET_log_setup ("test_fs_publish_persistence",
#if VERBOSE
                    "DEBUG",
#else
                    "WARNING",
#endif
                    NULL);
  GNUNET_PROGRAM_run ((sizeof (argvx) / sizeof (char *)) - 1, argvx,
                      "test-fs-publish", "nohelp", options, &run, NULL);
  stop_arm (&p1);
  GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs-publish/");
  if (fn1 != NULL)
  {
    GNUNET_DISK_directory_remove (fn1);
    GNUNET_free (fn1);
  }
  if (fn2 != NULL)
  {
    GNUNET_DISK_directory_remove (fn2);
    GNUNET_free (fn2);
  }
  return err;
}
예제 #9
0
static void
end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
  if (endbadly_task != GNUNET_SCHEDULER_NO_TASK)
  {
    GNUNET_SCHEDULER_cancel (endbadly_task);
    endbadly_task = GNUNET_SCHEDULER_NO_TASK;
  }

  if (privkey != NULL)
    GNUNET_CRYPTO_rsa_key_free (privkey);
  privkey = NULL;

  if (nsh != NULL)
    GNUNET_NAMESTORE_disconnect (nsh, GNUNET_YES);
  nsh = NULL;


  if (NULL != arm)
    stop_arm();

  res = 0;
}
/**
 * Try again to connect to transport service.
 */
static void
shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
  stop_arm (&p1);
  stop_arm (&p2);
}
void run(void)
{
    data='w';
    while(1)
    {
        while(data == 'w') //waiting for signal
        {
        }
        while(data == '\0' )
        {
            stop();
            _delay_ms(4000);
            comintersection();
            _delay_ms(100);
        }
        if(data=='f') // forward
        {
            data='\0';
        }
        if(data=='r') // right
        {
            data='\0';
            turn_right();
        }
        if(data=='l') // left
        {
            data='\0';
            turn_left();
        }
        if(data == 'h') // halt
        {
            data='\0';
            stop();
            _delay_ms(100);
            continue;

        }
        if(data == 'o') // origin
        {
            data='w';
            stop();
            _delay_ms(100);
            continue;
        }
        if(data == 'c') //collect item data -> i when the bot is trying to pick up an rfid
        {
            data='w';
            arm_down();
            _delay_ms(4200);
            stop_arm();
            _delay_ms(2000);
            grab();
            arm_up();
            _delay_ms(4750);
            stop_arm();
            _delay_ms(2000);
            lcd_cursor(2,1);
            lcd_string("Collecting");
            _delay_ms(3500);
            readrfidtag();
            clearrfid();
            continue;

        }
        if(data == 'd') //drop_item
        {
            data='w';
            go_down();
            release();
            go_up();
            lcd_cursor(2,1);
            lcd_string("Dropping");
            _delay_ms(3500);
            senddroppedsig();
            continue;
        }

        while(1)
        {
            if(move_bot() == 1)
            {
                continue;
            }
            else
            {
                break;
            }
        }
    }
}