33#include "../../../SensorBuildOpt.h"
34#if !SENSORLIB_EXCLUDE_BHI260_KLIO
36#include "../../../bosch/bhi260x/bhy2_klio_defs.h"
37#include "../../../bosch/bhi260x/bhy2_klio.h"
96 bool setState(
bool learning_enable,
bool learning_reset,
bool recognition_enable,
bool recognition_reset);
127 bool recognition(
const uint8_t *pattern_ids,
size_t size);
191 bool writePattern(uint8_t idx,
const uint8_t *parameter_data, uint16_t size);
202 bool writeMultiplePatterns(
const uint8_t *ids,
const uint8_t **parameter_data_array,
const uint16_t *sizes, uint8_t count);
221 bool enablePattern(
const uint8_t *pattern_ids, uint16_t size);
232 bool readPattern(uint8_t idx, uint8_t *buffer, uint16_t *length);
241 bool enable(
float sample_rate, uint32_t report_latency_ms);
255 bool logout(
float sample_rate, uint32_t report_latency_ms);
307 static void static_klio_callback(uint8_t sensor_id,
const uint8_t *data, uint32_t size, uint64_t *
timestamp,
void *user_data);
318 void klio_call_local(uint8_t sensor_id,
const uint8_t *data_ptr, uint32_t size, uint64_t *
timestamp,
void *user_data);
330 static void static_klio_log_callback(uint8_t sensor_id,
const uint8_t *data, uint32_t size, uint64_t *
timestamp,
void *user_data);
341 void klio_log_call_local(uint8_t sensor_id,
const uint8_t *data_ptr, uint32_t size, uint64_t *
timestamp,
void *user_data);
343 template<
typename Func,
typename... Args>
344 bool KlioTemplate(Func func, Args &&... args);
348 uint16_t max_patterns;
349 uint16_t max_pattern_size;
350 float *similarity_result_buf;
351 uint8_t *similarity_idx_buf;
353 void *learning_callback_user_data;
355 void *recognition_callback_user_data;
358 static const char *errorMessages[9];
bhy2_klio_driver_error_state_t KlioError
void(*)(LearningChangeReason reason, uint32_t progress, int learn_index, void *user_data) LearningCallback
@ LEARNING_NO_REPETITIVE_ACTIVITY
@ LEARNING_NO_SIGNIFICANT
void end()
End the interaction with the KLIO functionality of the BHI260AP sensor and release related resources.
bool getLearnPattern(uint8_t *pattern, uint16_t *size)
Retrieve the learned pattern from the sensor.
bool writeMultiplePatterns(const uint8_t *ids, const uint8_t **parameter_data_array, const uint16_t *sizes, uint8_t count)
Write multiple patterns to the KLIO sensor.
bhy2_klio_parameter_t KlioParameter
bool readPattern(uint8_t idx, uint8_t *buffer, uint16_t *length)
Read a pattern from the KLIO sensor.
void setLearningCallback(LearningCallback cb, void *user_data)
Set the callback function for the learning event.
bhy2_klio_sensor_state_t KlioState
void disable()
Disable the KLIO sensor.
static constexpr int8_t INVALID_LEARNING_INDEX
bool setPattern(KlioPatternState operation, const uint8_t *pattern_ids, uint16_t size)
Set the state of patterns in the KLIO sensor.
KlioError getError() const
Get the error information of the KLIO sensor.
bool writePattern(uint8_t idx, const uint8_t *parameter_data, uint16_t size)
Write a pattern to the KLIO sensor.
void(*)(uint8_t pattern_id, float count, void *user_data) RecognitionCallback
KlioState getState()
Get the current state of the KLIO sensor.
bool logout(float sample_rate, uint32_t report_latency_ms)
Log out the KLIO sensor with specified sample rate and report latency.
bool begin()
Initialize the interaction with the KLIO functionality of the BHI260AP sensor.
bool enablePattern(const uint8_t *pattern_ids, uint16_t size)
Enable specified patterns in the KLIO sensor.
bool enable(float sample_rate, uint32_t report_latency_ms)
Enable the KLIO sensor with specified sample rate and report latency.
bool learning()
Start the learning function of the KLIO sensor.
bool setState(bool learning_enable, bool learning_reset, bool recognition_enable, bool recognition_reset)
Set the learning and recognition states of the KLIO sensor.
uint8_t getMaxPatterns()
Retrieve the maximum number of recognition patterns allowed.
const char * errorToString() const
Convert the error information to a string.
bool checkError()
Check if there is an error in the KLIO sensor.
bool recognition(const uint8_t *pattern_ids, size_t size)
Start the recognition function of the KLIO sensor for the specified pattern IDs.
@ PATTERN_STATE_AP_DISABLE
@ PATTERN_STATE_SWITCH_HAND
bool getParameter(KlioParameter id, uint8_t *parameter_data, uint16_t *size)
Get a parameter from the KLIO sensor.
void setRecognitionCallback(RecognitionCallback cb, void *user_data)
Set the callback function for the recognition event.
bool setParameter(KlioParameter id, const void *parameter_data, uint16_t size)
Set a parameter of the KLIO sensor.
~SensorBHI260AP_Klio()
Destructor to release resources occupied by the SensorBHI260AP_Klio object.