Documentation
¶
Overview ¶
Package datamodel supports CPE datamodel and state.
Index ¶
- type DataModel
- func (dm *DataModel) AddEvent(evt string)
- func (dm *DataModel) AddObject(name string) (int, error)
- func (dm *DataModel) CanSetValue(param Parameter) *rpc.FaultCode
- func (dm *DataModel) ClearEvents()
- func (dm *DataModel) ClearNotifyParams()
- func (dm *DataModel) CommandKey() string
- func (dm *DataModel) ConnectionRequestURL() Parameter
- func (dm *DataModel) DeleteObject(name string)
- func (dm *DataModel) DeviceID() DeviceID
- func (dm *DataModel) DownUntil() time.Time
- func (dm *DataModel) GetAll(path string) []Parameter
- func (dm *DataModel) GetValue(path string) Parameter
- func (dm *DataModel) IncrRetryAttempts()
- func (dm *DataModel) IsBootstrapped() bool
- func (dm *DataModel) IsPeriodicInformParameter(name string) bool
- func (dm *DataModel) NormalizeParameters()
- func (dm *DataModel) NotifyParam(path string)
- func (dm *DataModel) NotifyParams() []string
- func (dm *DataModel) ParameterNames(path string, nextLevel bool) []Parameter
- func (dm *DataModel) PendingEvents() []string
- func (dm *DataModel) PeriodicInformEnabled() bool
- func (dm *DataModel) PeriodicInformInterval() time.Duration
- func (dm *DataModel) PeriodicInformTime() time.Time
- func (dm *DataModel) ResetRetryAttempts()
- func (dm *DataModel) RetryAttempts() uint32
- func (dm *DataModel) SaveState(stateFile string) error
- func (dm *DataModel) SetBootstrapped(b bool)
- func (dm *DataModel) SetCommandKey(ck string)
- func (dm *DataModel) SetConnectionRequestURL(val string)
- func (dm *DataModel) SetDownUntil(du time.Time)
- func (dm *DataModel) SetFirmwareVersion(ver string)
- func (dm *DataModel) SetParameterAttribute(name string, notif int, notifChange bool, acl []string, aclChange bool)
- func (dm *DataModel) SetParameterKey(val string)
- func (dm *DataModel) SetPeriodicInformInterval(sec int64)
- func (dm *DataModel) SetPeriodicInformTime(ts time.Time)
- func (dm *DataModel) SetSerialNumber(val string)
- func (dm *DataModel) SetUptime(dur time.Duration)
- func (dm *DataModel) SetValue(path, val string)
- func (dm *DataModel) SetValues(params []Parameter)
- type DeviceID
- type Parameter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DataModel ¶
type DataModel struct {
Values map[string]Parameter
Bootstrapped bool
// contains filtered or unexported fields
}
DataModel describes a stateful CPE datamodel.
func (*DataModel) AddEvent ¶
AddEvent adds a new event to be advertised during the next inform message.
func (*DataModel) CanSetValue ¶
CanSetValue returns a non-nil fault code if a value can't be set.
func (*DataModel) ClearEvents ¶
func (dm *DataModel) ClearEvents()
ClearEvents removes all pending inform events.
func (*DataModel) ClearNotifyParams ¶
func (dm *DataModel) ClearNotifyParams()
ClearNotifyParams clears all previous parameter notifications.
func (*DataModel) CommandKey ¶
CommandKey returns the current command key.
func (*DataModel) ConnectionRequestURL ¶
ConnectionRequestURL returns the connection request URL.
func (*DataModel) DeleteObject ¶
DeleteObject deletes the given object.
func (*DataModel) DownUntil ¶
DownUntil returns the time the CPE will stop pretending to be offline.
func (*DataModel) GetValue ¶
GetValue returns a parameter value with the given path. If it does not exist a placeholder is returned.
func (*DataModel) IncrRetryAttempts ¶
func (dm *DataModel) IncrRetryAttempts()
IncrRetryAttempts increments the number of infrom attempts by one.
func (*DataModel) IsBootstrapped ¶
IsBootstrapped returns true if CPE is had a successful bootstrap message exchange.
func (*DataModel) IsPeriodicInformParameter ¶
IsPeriodicInformParameter returns true if periodic inform is configured.
func (*DataModel) NormalizeParameters ¶ added in v0.2.0
func (dm *DataModel) NormalizeParameters()
NormalizeParameters will normalize all datamodel parameters.
func (*DataModel) NotifyParam ¶
NotifyParam subscribes the ACS for the given parameter value.
func (*DataModel) NotifyParams ¶
NotifyParams returns a list of parameters that should be included in the next inform message.
func (*DataModel) ParameterNames ¶
ParameterNames returns all subparameters in the given path. If nextLevel is set to true the list of parameters goes one level deeper. nolint:nestif
func (*DataModel) PendingEvents ¶
PendingEvents returns all events to be advertised during the next inform message.
func (*DataModel) PeriodicInformEnabled ¶
PeriodicInformEnabled returns true if periodic inform is enabled.
func (*DataModel) PeriodicInformInterval ¶
PeriodicInformInterval returns the value of periodic inform interval.
func (*DataModel) PeriodicInformTime ¶
PeriodicInformTime returns the value of periodic inform time.
func (*DataModel) ResetRetryAttempts ¶
func (dm *DataModel) ResetRetryAttempts()
ResetRetryAttempts resets the number of infrom attempts to zero.
func (*DataModel) RetryAttempts ¶
RetryAttempts returns the number of currently take attepts to inform.
func (*DataModel) SetBootstrapped ¶
SetBootstrapped assigns the bootstrap flag to the given value.
func (*DataModel) SetCommandKey ¶
SetCommandKey sets the command key value.
func (*DataModel) SetConnectionRequestURL ¶
SetConnectionRequestURL sets connection request URL to the given value.
func (*DataModel) SetDownUntil ¶
SetDownUntil sets the time until the CPE should pretend to be offline.
func (*DataModel) SetFirmwareVersion ¶
SetFirmwareVersion sets the new firmware version value.
func (*DataModel) SetParameterAttribute ¶
func (dm *DataModel) SetParameterAttribute(name string, notif int, notifChange bool, acl []string, aclChange bool)
SetParameterAttribute changes parameter value attributes.
func (*DataModel) SetParameterKey ¶
SetParameterKey sets parameter key to the given value.
func (*DataModel) SetPeriodicInformInterval ¶
SetPeriodicInformInterval sets periodic inform interval to the given value.
func (*DataModel) SetPeriodicInformTime ¶
SetPeriodicInformTime sets periodic inform time to the given value.
func (*DataModel) SetSerialNumber ¶
SetSerialNumber sets serial number to the given value.
type Parameter ¶
type Parameter struct {
Path string
Object bool
Writable bool
Type string
Value string
Notification rpc.AttributeNotification
ACL []string
}
Parameter describes a datamodel paremeter.
func (Parameter) Encode ¶
func (p Parameter) Encode() rpc.ParameterValueEncoder
Encode converts a parameter into RPC ParameterValue structure.