29#include <linux/i2c-dev.h>
46 char configBusPath[256] = {0};
53 char configAddress[256] = {0};
65bool I2C::ISNewText(
const char *dev,
const char *name,
char *texts[],
char *names[],
int n)
87 LOG_ERROR(
"I2C connection is not supported on this platform.");
108 LOG_DEBUG(
"I2C connection successful, attempting handshake...");
133 LOG_ERROR(
"I2C connection is not supported on this platform.");
136 LOGF_DEBUG(
"Connecting to I2C device at address 0x%02X on bus %s", addr,
busPath);
145 if (ioctl(
PortFD, I2C_SLAVE, addr) < 0)
211 snprintf(hexAddr,
sizeof(hexAddr),
"0x%02X", addr);
std::string m_ConfigBusPath
virtual void Activated() override
Activated Function called by the framework when the plugin is activated (i.e. selected by the user)....
void setDefaultAddress(uint8_t addr)
setDefaultAddress Set default I2C address. The default address is 0x28 unless otherwise changed by th...
INDI::PropertyText I2CConnectionTP
virtual const char * busPath()
void setDefaultBusPath(const char *path)
setDefaultBusPath Set default I2C bus path. Call this function in initProperties() of your driver if ...
virtual bool Connect() override
Connect Connect to device via the implemented communication medium. Do not perform any handshakes.
virtual bool processHandshake()
virtual uint8_t address()
virtual void Deactivated() override
Deactivated Function called by the framework when the plugin is deactivated. It is usually used to de...
virtual std::string name() override
virtual bool Disconnect() override
Disconnect Disconnect from device.
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
virtual bool saveConfigItems(FILE *fp) override
I2C(INDI::DefaultDevice *dev, IPerm permission=IP_RW)
The Interface class is the base class for all INDI connection plugins.
const char * getDeviceName()
std::function< bool()> Handshake
INDI::DefaultDevice * m_Device
const char * getDeviceName() const
Class to provide extended functionality for devices in addition to the functionality provided by INDI...
bool isInitializationComplete() const
isInitializationComplete Check if driver initialization is complete.
virtual bool saveConfig(bool silent=false, const char *property=nullptr)
Save the current properties in a configuration file.
virtual bool deleteProperty(const char *propertyName)
Delete a property and unregister it. It will also be deleted from all clients.
void defineProperty(INumberVectorProperty *property)
bool isSimulation() const
void setState(IPState state)
void apply(const char *format,...) const ATTRIBUTE_FORMAT_PRINTF(2
void save(FILE *f) const
save Save property to configuration file.
const char * getName() const
bool isNameMatch(const char *otherName) const
bool update(const char *const texts[], const char *const names[], int n)
void fill(const char *device, const char *name, const char *label, const char *group, IPerm permission, double timeout, IPState state)
INDI::PropertyViewText * getText() const
IPerm
Permission hint, with respect to client.
Implementations for common driver routines.
int IUGetConfigText(const char *dev, const char *property, const char *member, char *value, int len)
IUGetConfigText Opens configuration file and reads single text property.
#define LOGF_INFO(fmt,...)
#define LOGF_DEBUG(fmt,...)
#define LOG_ERROR(txt)
Shorter logging macros. In order to use these macros, the function (or method) "getDeviceName()" must...
#define LOGF_ERROR(fmt,...)
Combines all INDI Connection Plugins. Each INDI connection plugin is responsible of managing communic...
const char * CONNECTION_TAB