Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeviceInfo ¶
type DeviceInfo struct {
ID uuid.UUID `json:"id"` // Unique device identifier
Name string `json:"name"` // Human-readble device name
Manufacturer string `json:"manufacturer"` // Device manufacturer
Model string `json:"model"` // Device model
SerialNumber string `json:"serial_number"` // Unique serial number
Description string `json:"description"` // Optional description
}
DeviceInfo represents hardware device information.
func NewRandom ¶
func NewRandom(name string, serialLen int) DeviceInfo
NewRandom generates a DeviceInfo with random serial number.
func (*DeviceInfo) BuildPatchedDeviceInfo ¶
func (di *DeviceInfo) BuildPatchedDeviceInfo(cur *DeviceInfo) *DeviceInfo
BuildPatchedDeviceInfo builds a patched device info from the current device info and the input device info. It goes through the patchable fields and builds the patched device info. If there is no change on patchable fields, it returns nil.
func (*DeviceInfo) GetSerialInfo ¶
func (di *DeviceInfo) GetSerialInfo() SerialInfo
GetSerialInfo returns the serial number information of the device.
func (*DeviceInfo) InfoMsg ¶
func (di *DeviceInfo) InfoMsg(typ string, byID bool) string
InfoMsg returns a formatted string representation of the device for logging/display. If byID is true, uses ID for identification; otherwise uses manufacturer and serial
func (*DeviceInfo) VerifyIDOrSerial ¶
func (di *DeviceInfo) VerifyIDOrSerial() bool
VerifyIDOrSerial verifies the validity of ID or serial information of the device.
type SerialInfo ¶
type SerialInfo struct {
Manufacturer string `json:"manufacturer"`
SerialNumber string `json:"serial_number"`
}
SerialInfo represents serial number information of a device which is composed of manufacturer and serial number to identify a device.
func (*SerialInfo) String ¶
func (si *SerialInfo) String() string