Documentation ¶
Overview ¶
Copyright 2023 Thomas Helander
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2023 Thomas Helander ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- type DefaultTimestamper
- type DownstreamChannel
- type MotoClient
- func (c *MotoClient) GetDownstreamChannels() ([]*DownstreamChannel, error)
- func (c *MotoClient) GetHNAPURI() string
- func (c *MotoClient) GetHNAPURL() (*url.URL, error)
- func (c *MotoClient) GetPrivateKey() (string, error)
- func (c *MotoClient) GetUID() (string, error)
- func (c *MotoClient) GetUpstreamChannels() ([]*UpstreamChannel, error)
- func (c *MotoClient) Login() (map[string]string, error)
- func (c *MotoClient) SetPrivateKey(key string) error
- func (c *MotoClient) SetUID(uid string) error
- type Timestamper
- type UpstreamChannel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultTimestamper ¶
type DefaultTimestamper struct{}
func (*DefaultTimestamper) Timestamp ¶
func (t *DefaultTimestamper) Timestamp() int64
type DownstreamChannel ¶
type DownstreamChannel struct { Channel int ChannelID int LockStatus string Modulation string Frequency float64 Power float64 SignalToNoise float64 CorrectedErrors float64 UncorrectedErrors float64 }
func NewDownstreamChannelFromLine ¶
func NewDownstreamChannelFromLine(line string) (*DownstreamChannel, error)
func NewDownstreamChannelsFromResponse ¶
func NewDownstreamChannelsFromResponse(response string) ([]*DownstreamChannel, error)
func (*DownstreamChannel) Equal ¶
func (c *DownstreamChannel) Equal(o *DownstreamChannel) bool
Returns true if the channel has the same properties as channel o; false otherwise.
type MotoClient ¶
type MotoClient struct { Address string Username string Password string Logger log.Logger // contains filtered or unexported fields }
func NewMotoClient ¶
func NewMotoClient(address, username, password string, logger log.Logger) *MotoClient
Returns a new client with the default Timestamper class.
The client will be configured to skip SSL certificate verification as the cable modem uses a self-signed certificate.
func NewMotoClientWithTimestamper ¶
func NewMotoClientWithTimestamper(address, username, password string, logger log.Logger, timestamper Timestamper) *MotoClient
Returns a new client with the specified Timestamper class.
The client will be configured to skip SSL certificate verification as the cable modem uses a self-signed certificate.
func (*MotoClient) GetDownstreamChannels ¶
func (c *MotoClient) GetDownstreamChannels() ([]*DownstreamChannel, error)
Returns a list of DownstreamChannel objects, or nil on an error.
func (*MotoClient) GetHNAPURI ¶
func (c *MotoClient) GetHNAPURI() string
Returns the API endpoint URI as a string.
func (*MotoClient) GetHNAPURL ¶
func (c *MotoClient) GetHNAPURL() (*url.URL, error)
Returns the API endpoint URI as a url.URL object.
func (*MotoClient) GetPrivateKey ¶
func (c *MotoClient) GetPrivateKey() (string, error)
Return the private key used for communicating with the modem, or the default private key value used when logging in.
func (*MotoClient) GetUpstreamChannels ¶
func (c *MotoClient) GetUpstreamChannels() ([]*UpstreamChannel, error)
Returns a list of UpstreamChannel objects, or nil on an error.
func (*MotoClient) Login ¶
func (c *MotoClient) Login() (map[string]string, error)
Logs in to the modem using the client credentials.
Returns the login response if the login was successful, or an nil map and an error on a login failure.
func (*MotoClient) SetPrivateKey ¶
func (c *MotoClient) SetPrivateKey(key string) error
Set the private key.
type Timestamper ¶
type Timestamper interface {
Timestamp() int64
}
type UpstreamChannel ¶
type UpstreamChannel struct { Channel int ChannelID int LockStatus string ChannelType string SymbolRate float64 Frequency float64 Power float64 }
func NewUpstreamChannelFromLine ¶
func NewUpstreamChannelFromLine(line string) (*UpstreamChannel, error)
func NewUpstreamChannelsFromResponse ¶
func NewUpstreamChannelsFromResponse(response string) ([]*UpstreamChannel, error)
func (*UpstreamChannel) Equal ¶
func (c *UpstreamChannel) Equal(o *UpstreamChannel) bool
Returns true if the channel has the same properties as channel o; false otherwise.