46 lines
1.4 KiB
C
46 lines
1.4 KiB
C
#ifndef MIGHTYWATT_APP_H
|
|
#define MIGHTYWATT_APP_H
|
|
|
|
#include "mightywatt.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
typedef struct mw_app mw_app;
|
|
|
|
typedef struct {
|
|
bool capabilities_valid;
|
|
mw_capabilities capabilities;
|
|
bool report_valid;
|
|
mw_report last_report;
|
|
bool target_valid;
|
|
mw_mode target_mode;
|
|
uint32_t target_milli_units;
|
|
bool restore_target_valid;
|
|
mw_mode restore_target_mode;
|
|
uint32_t restore_target_milli_units;
|
|
} mw_app_state;
|
|
|
|
int mw_app_open(mw_app **out_app, const char *port_path, int settle_ms);
|
|
void mw_app_close(mw_app *app);
|
|
const char *mw_app_last_error(const mw_app *app);
|
|
|
|
int mw_app_refresh_capabilities(mw_app *app, mw_capabilities *out_caps);
|
|
int mw_app_get_report(mw_app *app, mw_report *out_report);
|
|
int mw_app_set_target(mw_app *app, mw_mode mode, uint32_t milli_units, mw_report *out_report);
|
|
int mw_app_load_off(mw_app *app, mw_report *out_report);
|
|
int mw_app_load_on(mw_app *app, mw_mode mode, uint32_t milli_units, mw_report *out_report);
|
|
int mw_app_restore_target(mw_app *app, mw_report *out_report);
|
|
int mw_app_safe(mw_app *app, mw_report *out_report);
|
|
int mw_app_set_remote(mw_app *app, bool enable, mw_report *out_report);
|
|
int mw_app_get_series_resistance(mw_app *app, uint16_t *milliohm);
|
|
int mw_app_set_series_resistance(mw_app *app, uint16_t milliohm, mw_report *out_report);
|
|
int mw_app_get_state(const mw_app *app, mw_app_state *out_state);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|