Add a function to initialize the base class.
This commit is contained in:
parent
ba919d0b15
commit
4f63295802
@ -34,6 +34,9 @@ struct device_backend_t {
|
|||||||
device_status_t (*close) (device_t *device);
|
device_status_t (*close) (device_t *device);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void
|
||||||
|
device_init (device_t *device, const device_backend_t *backend);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|||||||
@ -2,6 +2,14 @@
|
|||||||
|
|
||||||
#define NULL 0
|
#define NULL 0
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
device_init (device_t *device, const device_backend_t *backend)
|
||||||
|
{
|
||||||
|
device->backend = backend;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
device_type_t
|
device_type_t
|
||||||
device_get_type (device_t *device)
|
device_get_type (device_t *device)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -158,8 +158,10 @@ oceanic_atom2_device_open (device_t **out, const char* name)
|
|||||||
return DEVICE_STATUS_MEMORY;
|
return DEVICE_STATUS_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Initialize the base class.
|
||||||
|
device_init (&device->base, &oceanic_atom2_device_backend);
|
||||||
|
|
||||||
// Set the default values.
|
// Set the default values.
|
||||||
device->base.backend = &oceanic_atom2_device_backend;
|
|
||||||
device->port = NULL;
|
device->port = NULL;
|
||||||
|
|
||||||
// Open the device.
|
// Open the device.
|
||||||
|
|||||||
@ -49,8 +49,10 @@ reefnet_sensuspro_device_open (device_t **out, const char* name)
|
|||||||
return DEVICE_STATUS_MEMORY;
|
return DEVICE_STATUS_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Initialize the base class.
|
||||||
|
device_init (&device->base, &reefnet_sensuspro_device_backend);
|
||||||
|
|
||||||
// Set the default values.
|
// Set the default values.
|
||||||
device->base.backend = &reefnet_sensuspro_device_backend;
|
|
||||||
device->port = NULL;
|
device->port = NULL;
|
||||||
|
|
||||||
// Open the device.
|
// Open the device.
|
||||||
|
|||||||
@ -54,8 +54,10 @@ reefnet_sensusultra_device_open (device_t **out, const char* name)
|
|||||||
return DEVICE_STATUS_MEMORY;
|
return DEVICE_STATUS_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Initialize the base class.
|
||||||
|
device_init (&device->base, &reefnet_sensusultra_device_backend);
|
||||||
|
|
||||||
// Set the default values.
|
// Set the default values.
|
||||||
device->base.backend = &reefnet_sensusultra_device_backend;
|
|
||||||
device->port = NULL;
|
device->port = NULL;
|
||||||
device->maxretries = 2;
|
device->maxretries = 2;
|
||||||
|
|
||||||
|
|||||||
@ -55,8 +55,10 @@ suunto_d9_device_open (device_t **out, const char* name)
|
|||||||
return DEVICE_STATUS_MEMORY;
|
return DEVICE_STATUS_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Initialize the base class.
|
||||||
|
device_init (&device->base, &suunto_d9_device_backend);
|
||||||
|
|
||||||
// Set the default values.
|
// Set the default values.
|
||||||
device->base.backend = &suunto_d9_device_backend;
|
|
||||||
device->port = NULL;
|
device->port = NULL;
|
||||||
|
|
||||||
// Open the device.
|
// Open the device.
|
||||||
|
|||||||
@ -50,8 +50,10 @@ suunto_eon_device_open (device_t **out, const char* name)
|
|||||||
return DEVICE_STATUS_MEMORY;
|
return DEVICE_STATUS_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Initialize the base class.
|
||||||
|
device_init (&device->base, &suunto_eon_device_backend);
|
||||||
|
|
||||||
// Set the default values.
|
// Set the default values.
|
||||||
device->base.backend = &suunto_eon_device_backend;
|
|
||||||
device->port = NULL;
|
device->port = NULL;
|
||||||
|
|
||||||
// Open the device.
|
// Open the device.
|
||||||
|
|||||||
@ -52,8 +52,10 @@ suunto_vyper_device_open (device_t **out, const char* name)
|
|||||||
return DEVICE_STATUS_MEMORY;
|
return DEVICE_STATUS_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Initialize the base class.
|
||||||
|
device_init (&device->base, &suunto_vyper_device_backend);
|
||||||
|
|
||||||
// Set the default values.
|
// Set the default values.
|
||||||
device->base.backend = &suunto_vyper_device_backend;
|
|
||||||
device->port = NULL;
|
device->port = NULL;
|
||||||
device->extraanswertime = 0;
|
device->extraanswertime = 0;
|
||||||
device->ifacealwaysechos = 0;
|
device->ifacealwaysechos = 0;
|
||||||
|
|||||||
@ -55,8 +55,10 @@ suunto_vyper2_device_open (device_t **out, const char* name)
|
|||||||
return DEVICE_STATUS_MEMORY;
|
return DEVICE_STATUS_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Initialize the base class.
|
||||||
|
device_init (&device->base, &suunto_vyper2_device_backend);
|
||||||
|
|
||||||
// Set the default values.
|
// Set the default values.
|
||||||
device->base.backend = &suunto_vyper2_device_backend;
|
|
||||||
device->port = NULL;
|
device->port = NULL;
|
||||||
|
|
||||||
// Open the device.
|
// Open the device.
|
||||||
|
|||||||
@ -52,8 +52,10 @@ uwatec_aladin_device_open (device_t **out, const char* name)
|
|||||||
return DEVICE_STATUS_MEMORY;
|
return DEVICE_STATUS_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Initialize the base class.
|
||||||
|
device_init (&device->base, &uwatec_aladin_device_backend);
|
||||||
|
|
||||||
// Set the default values.
|
// Set the default values.
|
||||||
device->base.backend = &uwatec_aladin_device_backend;
|
|
||||||
device->port = NULL;
|
device->port = NULL;
|
||||||
|
|
||||||
// Open the device.
|
// Open the device.
|
||||||
|
|||||||
@ -53,8 +53,10 @@ uwatec_memomouse_device_open (device_t **out, const char* name)
|
|||||||
return DEVICE_STATUS_MEMORY;
|
return DEVICE_STATUS_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Initialize the base class.
|
||||||
|
device_init (&device->base, &uwatec_memomouse_device_backend);
|
||||||
|
|
||||||
// Set the default values.
|
// Set the default values.
|
||||||
device->base.backend = &uwatec_memomouse_device_backend;
|
|
||||||
device->port = NULL;
|
device->port = NULL;
|
||||||
device->timestamp = 0;
|
device->timestamp = 0;
|
||||||
|
|
||||||
|
|||||||
@ -77,8 +77,10 @@ uwatec_smart_device_open (device_t **out)
|
|||||||
return DEVICE_STATUS_MEMORY;
|
return DEVICE_STATUS_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Initialize the base class.
|
||||||
|
device_init (&device->base, &uwatec_smart_device_backend);
|
||||||
|
|
||||||
// Set the default values.
|
// Set the default values.
|
||||||
device->base.backend = &uwatec_smart_device_backend;
|
|
||||||
device->socket = NULL;
|
device->socket = NULL;
|
||||||
device->address = 0;
|
device->address = 0;
|
||||||
device->timestamp = 0;
|
device->timestamp = 0;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user