newtx/scanner/scanner_const_opts.h

33 lines
916 B
C
Raw Permalink Normal View History

2023-12-18 01:39:48 +00:00
// scanner const attributes definitions:
//
// Contains: vid, pid, serial-number, ip, mac, firmware-ver, roll-life, name, family
//
// Date: 2023-12-16
#include <sane_opt_json/base_opt.h>
class scanner_const_opts : public sane_opt_provider
{
std::string root_;
uint32_t hist_cnt_ = 0;
uint32_t roller_cnt_ = 0;
2023-12-18 01:39:48 +00:00
std::string get_device_content(const char* path, bool truncate_from_lrn = false);
2023-12-18 01:39:48 +00:00
std::string get_ip(void);
std::string get_mac(void);
void init(void);
public:
scanner_const_opts(const char* dev_path = "/opt/cfg/usb_gadget/g1");
protected:
~scanner_const_opts();
public:
// return malloc(), real data size stored in parameter 'size'. invoker should free() the returned value
virtual char* get_value(const char* name, void* value, size_t* size, int* err = nullptr) override;
virtual int set_value(const char* name, void* val) override;
2023-12-18 01:39:48 +00:00
};