Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeviceInfo ¶
type DeviceInfo struct { DeviceInfoFile string Config Identity Logger *logrus.Logger // contains filtered or unexported fields }
DeviceInfo manages the device identity and its associated file operations.
func (*DeviceInfo) GetDeviceID ¶
func (d *DeviceInfo) GetDeviceID() string
GetDeviceID returns the current device ID from the Config field.
func (*DeviceInfo) LoadDeviceInfo ¶
func (d *DeviceInfo) LoadDeviceInfo() error
LoadDeviceInfo reads the device information from the file and populates the Config field. If the file does not exist or is empty, it initializes the Config to default (empty) values.
func (*DeviceInfo) SaveDeviceID ¶
func (d *DeviceInfo) SaveDeviceID(deviceID string) error
SaveDeviceID updates the device ID in the Config field and writes it back to the file. Returns an error if marshalling the Config or writing the file fails.
type DeviceInfoInterface ¶
type DeviceInfoInterface interface { LoadDeviceInfo() error GetDeviceID() string SaveDeviceID(deviceID string) error }
DeviceInfoInterface defines the methods that DeviceInfo implements
func NewDeviceInfo ¶
func NewDeviceInfo(filePath string, fileOps file.FileOperations, logger *logrus.Logger) DeviceInfoInterface
NewDeviceInfo initializes a new DeviceInfo instance with the specified file path and file operations. Returns a pointer to a DeviceInfo instance with the file path and file operations set.