Ejemplo n.º 1
0
int Gps::registerGpsHandlers()
{
    // register gps data callback
    CPhidgetGPS_set_OnPositionChange_Handler(gps_handle_, PositionChange_HandlerStatic, this);
    CPhidgetGPS_set_OnPositionFixStatusChange_Handler(gps_handle_, PositionFixStatusChange_HandlerStatic, this);
    return 1;
}
Ejemplo n.º 2
0
VALUE gps_close(VALUE self) {
  PhidgetInfo *info = device_info(self);

  ensure(CPhidgetGPS_set_OnPositionChange_Handler((CPhidgetGPSHandle)info->handle, NULL, NULL));
 	ensure(CPhidgetGPS_set_OnPositionFixStatusChange_Handler((CPhidgetGPSHandle)info->handle, NULL, NULL));

  return rb_call_super(0,NULL);
}
Ejemplo n.º 3
0
VALUE gps_initialize(VALUE self, VALUE serial) {
  PhidgetInfo *info = device_info(self);
  
  GpsInfo *gps_info = ALLOC(GpsInfo); 
  memset(gps_info, 0, sizeof(GpsInfo));

  gps_info->sample_rate = sample_create();

  CPhidgetGPSHandle gps = 0;

  ensure(CPhidgetGPS_create(&gps));

  ensure(CPhidgetGPS_set_OnPositionChange_Handler( gps, gps_on_position_change, info));
 	ensure(CPhidgetGPS_set_OnPositionFixStatusChange_Handler(gps, gps_on_fix_change, info));

  info->handle = (CPhidgetHandle)gps;
  info->on_type_detach = gps_on_detach;
  info->on_type_free = gps_on_free;
  info->type_info = gps_info;

  return rb_call_super(1, &serial);
}