feat(modem): method to configure APN/authentication

This commit is contained in:
2025-06-11 12:11:17 +02:00
parent 359a0018c5
commit 3224e1ef0f
7 changed files with 133 additions and 0 deletions

View File

@ -362,4 +362,31 @@ func (o *Operations) SetBaseCorrections(ctx context.Context, funcs ...protocol.S
return nil
}
// SetModem implements protocol.Operations.
func (o *Operations) SetModem(ctx context.Context, funcs ...protocol.SetModemOptionsFunc) error {
opts := protocol.NewSetModemOptions(funcs...)
modem := &model.ModemAuthentication{}
if opts.Apn != nil {
modem.Authentication.Apn = *opts.Apn
}
if opts.Type != nil {
modem.Authentication.Type = *opts.Type
}
if opts.Password != nil {
modem.Authentication.Password = *opts.Password
}
if opts.Username != nil {
modem.Authentication.Username = *opts.Username
}
if _, err := o.PostModem(ctx, modem); err != nil {
return errors.WithStack(err)
}
return nil
}
var _ protocol.Operations = &Operations{}