Exemplo n.º 1
0
void handle_gps_update_packet(char *buffer, size_t buf_size)
{
	/* If END is found, then end the ride */
	if (strstr(buffer, "END") != NULL)
	{
		ctrl_c_interrupt(SIGINT);
		return;		
	}		
	smartphone_gps_t gps = parse_raw_data(buffer, buf_size);
	
	/* If start_lat is NaN */
	if (start_lat != start_lat)
	{
		start_lat = gps.lat;
		start_lng = gps.lng;
		start_time = gps.time;
	}

	/* Update end points to most recent example */
	end_lat = gps.lat;
	end_lng = gps.lng;
	end_time = gps.time;

	log_data(&gps);
}
Exemplo n.º 2
0
/* allocate memory for an instance of holder */
static void
allocate_holder (void)
{
#ifdef TCB_BTREE
  TCBDB *ht = NULL;
#elif TCB_MEMHASH
  TCMDB *ht = NULL;
#else
  GHashTable *ht;
#endif

  GModule module;
  GRawData *raw_data;
  int i;
  unsigned int ht_size = 0;

  holder = new_gholder (TOTAL_MODULES);
  for (i = 0; i < TOTAL_MODULES; i++) {
    module = i;

    /* extract data from the corresponding hash table */
    ht = get_ht_by_module (module);
    ht_size = get_ht_size_by_module (module);
    raw_data = parse_raw_data (ht, ht_size, module);
    load_holder_data (raw_data, holder + module, module, module_sort[module]);
  }
}
Exemplo n.º 3
0
/* allocate memory for an instance of holder */
static void
allocate_holder_by_module (GModule module)
{
  GRawData *raw_data;

  /* extract data from the corresponding hash table */
  raw_data = parse_raw_data (module);
  if (!raw_data) {
    LOG_DEBUG (("raw data is NULL for module: %d.\n", module));
    return;
  }

  load_holder_data (raw_data, holder + module, module, module_sort[module]);
}
Exemplo n.º 4
0
/* allocate memory for an instance of holder */
static void
allocate_holder_by_module (GModule module)
{
#if defined(TCB_BTREE) || defined(TCB_MEMHASH)
  TCADB *ht = NULL;
#else
  GHashTable *ht;
#endif

  GRawData *raw_data;
  unsigned int ht_size = 0;

  /* extract data from the corresponding hash table */
  ht = get_storage_metric (module, MTRC_HITS);
  ht_size = get_ht_size (ht);
  raw_data = parse_raw_data (ht, ht_size, module);
  load_holder_data (raw_data, holder + module, module, module_sort[module]);
}
Exemplo n.º 5
0
/* allocate memory for an instance of holder */
static void
allocate_holder_by_module (GModule module)
{
#ifdef TCB_BTREE
  TCBDB *ht = NULL;
#elif TCB_MEMHASH
  TCMDB *ht = NULL;
#else
  GHashTable *ht;
#endif

  GRawData *raw_data;
  unsigned int ht_size = 0;

  /* extract data from the corresponding hash table */
  ht = get_ht_by_module (module);
  ht_size = get_ht_size_by_module (module);
  raw_data = parse_raw_data (ht, ht_size, module);
  load_holder_data (raw_data, holder + module, module, module_sort[module]);
}
Exemplo n.º 6
0
/* allocate memory for an instance of holder */
static void
allocate_holder (void)
{
#if defined(TCB_BTREE) || defined(TCB_MEMHASH)
  TCADB *ht = NULL;
#else
  GHashTable *ht;
#endif

  GModule module;
  GRawData *raw_data;
  unsigned int ht_size = 0;

  holder = new_gholder (TOTAL_MODULES);
  for (module = 0; module < TOTAL_MODULES; module++) {
    /* extract data from the corresponding hits hash table */
    ht = get_storage_metric (module, MTRC_HITS);

    ht_size = get_ht_size (ht);
    raw_data = parse_raw_data (ht, ht_size, module);
    load_holder_data (raw_data, holder + module, module, module_sort[module]);
  }
}