Build: Add XCB_LIBS; Skeleton: mlo_initializeInd, mlo_attachDeviceReq

* 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().
This commit is contained in:
2025-01-12 14:31:33 -04:00
parent b85d6f76a6
commit 0a36f7d370
11 changed files with 238 additions and 52 deletions
+5 -4
View File
@@ -3,6 +3,7 @@
#include <preprocessor.h>
#include <stdbool.h>
#include <user/senseDeviceSpec.h>
#ifdef __cplusplus
extern "C" {
@@ -18,8 +19,8 @@ struct CExportedImplexorApiDesc
typedef int (sal_mho_initializeRdyFn)(void);
typedef int (sal_mho_finalizeRdyFn)(void);
typedef int (sal_mho_attachDeviceAckFn)(void);
typedef int (sal_mho_detachDeviceAckFn)(void);
typedef int (sal_mho_attachDeviceAckFn)(const CSenseDeviceSpec *const desc);
typedef int (sal_mho_detachDeviceAckFn)(const CSenseDeviceSpec *const desc);
struct Csal_mgmt_hkOps
{
@@ -35,8 +36,8 @@ struct Csal_mgmt_hkOps
typedef int (sal_mlo_initializeIndFn)(void);
typedef int (sal_mlo_finalizeIndFn)(void);
typedef int (sal_mlo_attachDeviceReqFn)(void);
typedef int (sal_mlo_detachDeviceReqFn)(void);
typedef int (sal_mlo_attachDeviceReqFn)(const CSenseDeviceSpec *const desc);
typedef int (sal_mlo_detachDeviceReqFn)(const CSenseDeviceSpec *const desc);
struct Csal_mgmt_libOps
{
+100
View File
@@ -0,0 +1,100 @@
#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