feat(reachview): GetModemConfiguration func
This commit is contained in:
@ -173,3 +173,13 @@ func (o *Operations) PostModem(ctx context.Context, config *model.ModemAuthentic
|
||||
|
||||
return &updated, nil
|
||||
}
|
||||
|
||||
func (o *Operations) GetModem(ctx context.Context) (*model.ModemConfiguration, error) {
|
||||
config := &model.ModemConfiguration{}
|
||||
|
||||
if err := o.GetJSON("/modem/1/info", config); err != nil {
|
||||
return nil, errors.WithStack(err)
|
||||
}
|
||||
|
||||
return config, nil
|
||||
}
|
||||
|
@ -2,5 +2,5 @@ package model
|
||||
|
||||
type Action struct {
|
||||
Name string `json:"name"`
|
||||
Paylaod map[string]any `json:"payload"`
|
||||
Paylaod map[string]any `json:"payload,omitempty"`
|
||||
}
|
||||
|
@ -10,3 +10,25 @@ type ModemAuthentication struct {
|
||||
Password string `json:"password,omitempty"`
|
||||
} `json:"authentication"`
|
||||
}
|
||||
|
||||
type ModemConfiguration struct {
|
||||
AccessTechnology string `json:"access_technology"`
|
||||
AllowedModes []string `json:"allowed_modes"`
|
||||
AvailableAPNs []string `json:"available_apns,omitempty"`
|
||||
CurrentAPN string `json:"current_apn"`
|
||||
CurrentMode string `json:"current_mode"`
|
||||
FailReason *string `json:"fail_reason,omitempty"`
|
||||
IMEI string `json:"imei"`
|
||||
InternetAvailable string `json:"internet_available,omitempty"`
|
||||
LockReason *string `json:"lock_reason,omitempty"`
|
||||
OperatorName string `json:"operator_name"`
|
||||
PreferredMode string `json:"preferred_mode"`
|
||||
RegistrationState string `json:"registration_state"`
|
||||
RSSI int `json:"rssi"`
|
||||
State string `json:"state"`
|
||||
Stats struct {
|
||||
Since string `json:"since"`
|
||||
UsageMB string `json:"usage_mb"`
|
||||
} `json:"stats"`
|
||||
UnlockRetries int `json:"unlock_retries"`
|
||||
}
|
||||
|
@ -399,4 +399,15 @@ func (o *Operations) SetModem(ctx context.Context, funcs ...protocol.SetModemOpt
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetModem implements protocol.Operations.
|
||||
func (o *Operations) GetModemConfiguration(ctx context.Context) (any, error) {
|
||||
config, err := o.GetModem(ctx)
|
||||
if err != nil {
|
||||
return nil, errors.WithStack(err)
|
||||
}
|
||||
|
||||
return config, nil
|
||||
|
||||
}
|
||||
|
||||
var _ protocol.Operations = &Operations{}
|
||||
|
Reference in New Issue
Block a user