static device_status_t device_open(const char *devname, device_type_t type, device_t **device) { switch (type) { case DEVICE_TYPE_SUUNTO_SOLUTION: return suunto_solution_device_open(device, devname); case DEVICE_TYPE_SUUNTO_EON: return suunto_eon_device_open(device, devname); case DEVICE_TYPE_SUUNTO_VYPER: return suunto_vyper_device_open(device, devname); case DEVICE_TYPE_SUUNTO_VYPER2: return suunto_vyper2_device_open(device, devname); case DEVICE_TYPE_SUUNTO_D9: return suunto_d9_device_open(device, devname); case DEVICE_TYPE_UWATEC_ALADIN: return uwatec_aladin_device_open(device, devname); case DEVICE_TYPE_UWATEC_MEMOMOUSE: return uwatec_memomouse_device_open(device, devname); case DEVICE_TYPE_UWATEC_SMART: return uwatec_smart_device_open(device); case DEVICE_TYPE_REEFNET_SENSUS: return reefnet_sensus_device_open(device, devname); case DEVICE_TYPE_REEFNET_SENSUSPRO: return reefnet_sensuspro_device_open(device, devname); case DEVICE_TYPE_REEFNET_SENSUSULTRA: return reefnet_sensusultra_device_open(device, devname); case DEVICE_TYPE_OCEANIC_VTPRO: return oceanic_vtpro_device_open(device, devname); case DEVICE_TYPE_OCEANIC_VEO250: return oceanic_veo250_device_open(device, devname); case DEVICE_TYPE_OCEANIC_ATOM2: return oceanic_atom2_device_open(device, devname); case DEVICE_TYPE_MARES_NEMO: return mares_nemo_device_open(device, devname); case DEVICE_TYPE_MARES_PUCK: return mares_puck_device_open(device, devname); case DEVICE_TYPE_MARES_ICONHD: return mares_iconhd_device_open(device, devname); case DEVICE_TYPE_HW_OSTC: return hw_ostc_device_open(device, devname); case DEVICE_TYPE_CRESSI_EDY: return cressi_edy_device_open(device, devname); case DEVICE_TYPE_ZEAGLE_N2ITION3: return zeagle_n2ition3_device_open(device, devname); case DEVICE_TYPE_ATOMICS_COBALT: return atomics_cobalt_device_open(device); default: return DEVICE_STATUS_ERROR; } }
dc_status_t dc_device_open (dc_device_t **out, dc_context_t *context, dc_descriptor_t *descriptor, const char *name) { dc_status_t rc = DC_STATUS_SUCCESS; dc_device_t *device = NULL; if (out == NULL || descriptor == NULL) return DC_STATUS_INVALIDARGS; switch (dc_descriptor_get_type (descriptor)) { case DC_FAMILY_SUUNTO_SOLUTION: rc = suunto_solution_device_open (&device, context, name); break; case DC_FAMILY_SUUNTO_EON: rc = suunto_eon_device_open (&device, context, name); break; case DC_FAMILY_SUUNTO_VYPER: rc = suunto_vyper_device_open (&device, context, name); break; case DC_FAMILY_SUUNTO_VYPER2: rc = suunto_vyper2_device_open (&device, context, name); break; case DC_FAMILY_SUUNTO_D9: rc = suunto_d9_device_open (&device, context, name, dc_descriptor_get_model (descriptor)); break; case DC_FAMILY_UWATEC_ALADIN: rc = uwatec_aladin_device_open (&device, context, name); break; case DC_FAMILY_UWATEC_MEMOMOUSE: rc = uwatec_memomouse_device_open (&device, context, name); break; case DC_FAMILY_UWATEC_SMART: rc = uwatec_smart_device_open (&device, context); break; case DC_FAMILY_REEFNET_SENSUS: rc = reefnet_sensus_device_open (&device, context, name); break; case DC_FAMILY_REEFNET_SENSUSPRO: rc = reefnet_sensuspro_device_open (&device, context, name); break; case DC_FAMILY_REEFNET_SENSUSULTRA: rc = reefnet_sensusultra_device_open (&device, context, name); break; case DC_FAMILY_OCEANIC_VTPRO: rc = oceanic_vtpro_device_open (&device, context, name); break; case DC_FAMILY_OCEANIC_VEO250: rc = oceanic_veo250_device_open (&device, context, name); break; case DC_FAMILY_OCEANIC_ATOM2: rc = oceanic_atom2_device_open (&device, context, name); break; case DC_FAMILY_MARES_NEMO: rc = mares_nemo_device_open (&device, context, name); break; case DC_FAMILY_MARES_PUCK: rc = mares_puck_device_open (&device, context, name); break; case DC_FAMILY_MARES_DARWIN: rc = mares_darwin_device_open (&device, context, name, dc_descriptor_get_model (descriptor)); break; case DC_FAMILY_MARES_ICONHD: rc = mares_iconhd_device_open (&device, context, name, dc_descriptor_get_model (descriptor)); break; case DC_FAMILY_HW_OSTC: rc = hw_ostc_device_open (&device, context, name); break; case DC_FAMILY_HW_FROG: rc = hw_frog_device_open (&device, context, name); break; case DC_FAMILY_HW_OSTC3: rc = hw_ostc3_device_open (&device, context, name); break; case DC_FAMILY_CRESSI_EDY: rc = cressi_edy_device_open (&device, context, name); break; case DC_FAMILY_CRESSI_LEONARDO: rc = cressi_leonardo_device_open (&device, context, name); break; case DC_FAMILY_ZEAGLE_N2ITION3: rc = zeagle_n2ition3_device_open (&device, context, name); break; case DC_FAMILY_ATOMICS_COBALT: rc = atomics_cobalt_device_open (&device, context); break; case DC_FAMILY_SHEARWATER_PREDATOR: rc = shearwater_predator_device_open (&device, context, name); break; case DC_FAMILY_SHEARWATER_PETREL: rc = shearwater_petrel_device_open (&device, context, name); break; default: return DC_STATUS_INVALIDARGS; } *out = device; return rc; }