0a36f7d370
* Renamed some of the Sense API lib classes (CSensorDeviceDesc=>CSenseDeviceDesc, SensorDeviceDesc=>SenseDeviceDesc). * Moved SenseApiDesc into /include/user/senseApiDesc. * Add conversion constructor to convert from SenseDeviceDesc to * Wireframe mlo_initializeInd to call xcb_connect(). * Add $(XCB_LIBS) to libxcbXorg_LDFLAGS. * Wireframe mlo_attachDeviceReq().
101 lines
2.2 KiB
C++
101 lines
2.2 KiB
C++
#ifndef SENSORDEVICESPEC_H
|
|
#define SENSORDEVICESPEC_H
|
|
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#ifdef __cplusplus
|
|
#include <vector>
|
|
#include <string>
|
|
#include <iostream>
|
|
#endif // __cplusplus
|
|
|
|
#ifdef __cplusplus
|
|
struct SenseDeviceSpec
|
|
{
|
|
char sensorType;
|
|
std::string implexor;
|
|
std::string api;
|
|
std::vector<std::string> apiParams;
|
|
std::string provider;
|
|
std::vector<std::string> providerParams;
|
|
std::string deviceSelector;
|
|
|
|
friend std::ostream& operator<<(
|
|
std::ostream& os, const SenseDeviceSpec& spec);
|
|
};
|
|
|
|
struct InteroceptorDeviceSpec : public SenseDeviceSpec
|
|
{
|
|
};
|
|
|
|
struct ExtrospectorDeviceSpec : public SenseDeviceSpec
|
|
{
|
|
};
|
|
#endif // __cplusplus
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
struct CSenseDeviceSpec
|
|
{
|
|
#ifdef __cplusplus
|
|
CSenseDeviceSpec(const SenseDeviceSpec& spec)
|
|
: sensorType(spec.sensorType),
|
|
implexor(strdup(spec.implexor.c_str())),
|
|
api(strdup(spec.api.c_str())),
|
|
provider(strdup(spec.provider.c_str())),
|
|
deviceSelector(strdup(spec.deviceSelector.c_str()))
|
|
{
|
|
apiParams = new char*[spec.apiParams.size() + 1];
|
|
for (size_t i = 0; i < spec.apiParams.size(); ++i)
|
|
{
|
|
apiParams[i] = strdup(spec.apiParams[i].c_str());
|
|
}
|
|
apiParams[spec.apiParams.size()] = nullptr;
|
|
|
|
providerParams = new char*[spec.providerParams.size() + 1];
|
|
for (size_t i = 0; i < spec.providerParams.size(); ++i)
|
|
{
|
|
providerParams[i] = strdup(spec.providerParams[i].c_str());
|
|
}
|
|
providerParams[spec.providerParams.size()] = nullptr;
|
|
}
|
|
|
|
~CSenseDeviceSpec(void)
|
|
{
|
|
free(implexor);
|
|
free(api);
|
|
free(provider);
|
|
free(deviceSelector);
|
|
|
|
for (size_t i = 0; apiParams[i] != nullptr; ++i)
|
|
{
|
|
free(apiParams[i]);
|
|
}
|
|
delete[] apiParams;
|
|
|
|
for (size_t i = 0; providerParams[i] != nullptr; ++i)
|
|
{
|
|
free(providerParams[i]);
|
|
}
|
|
delete[] providerParams;
|
|
}
|
|
#endif
|
|
|
|
char sensorType;
|
|
char *implexor;
|
|
char *api;
|
|
char **apiParams;
|
|
char *provider;
|
|
char **providerParams;
|
|
char *deviceSelector;
|
|
};
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif // SENSORDEVICESPEC_H
|