├── .github └── workflows │ └── go.yml ├── Bearer.go ├── Call.go ├── LICENSE ├── Modem.go ├── Modem3gpp.go ├── ModemCdma.go ├── ModemFirmware.go ├── ModemLocation.go ├── ModemManager.go ├── ModemMessaging.go ├── ModemOma.go ├── ModemSignal.go ├── ModemSimple.go ├── ModemTime.go ├── ModemUssd.go ├── ModemVoice.go ├── README.md ├── Sim.go ├── Sms.go ├── enums.go ├── examples ├── check_interfaces.go ├── test_listener.go └── test_run.go ├── go-modemmanager.png ├── go.mod ├── go.sum ├── mmbearerallowedauth_string.go ├── mmbeareripfamily_string.go ├── mmbeareripmethod_string.go ├── mmbearertype_string.go ├── mmcalldirection_string.go ├── mmcallstate_string.go ├── mmcallstatereason_string.go ├── mmcdmaactivationerror_string.go ├── mmconnectionerror_string.go ├── mmcoreerror_string.go ├── mmfirmwareimagetype_string.go ├── mmmessageerror_string.go ├── mmmobileequipmenterror_string.go ├── mmmodem3gppepsuemodeoperation_string.go ├── mmmodem3gppfacility_string.go ├── mmmodem3gppnetworkavailability_string.go ├── mmmodem3gppregistrationstate_string.go ├── mmmodem3gppsubscriptionstate_string.go ├── mmmodem3gppussdsessionstate_string.go ├── mmmodemaccesstechnology_string.go ├── mmmodemband_string.go ├── mmmodemcapability_string.go ├── mmmodemcdmaactivationstate_string.go ├── mmmodemcdmaregistrationstate_string.go ├── mmmodemcdmarmprotocol_string.go ├── mmmodemcontactsstorage_string.go ├── mmmodemfirmwareupdatemethod_string.go ├── mmmodemlocationassistancedatatype_string.go ├── mmmodemlocationsource_string.go ├── mmmodemlock_string.go ├── mmmodemmode_string.go ├── mmmodemporttype_string.go ├── mmmodempowerstate_string.go ├── mmmodemstate_string.go ├── mmmodemstatechangereason_string.go ├── mmmodemstatefailedreason_string.go ├── mmomafeature_string.go ├── mmomasessionstate_string.go ├── mmomasessionstatefailedreason_string.go ├── mmomasessiontype_string.go ├── mmserialerror_string.go ├── mmsignalpropertytype_string.go ├── mmsmscdmaservicecategory_string.go ├── mmsmscdmateleserviceid_string.go ├── mmsmsdeliverystate_string.go ├── mmsmspdutype_string.go ├── mmsmsstate_string.go ├── mmsmsstorage_string.go ├── mmsmsvaliditytype_string.go └── utils.go /.github/workflows/go.yml: -------------------------------------------------------------------------------- 1 | name: Go 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | pull_request: 7 | branches: [ master ] 8 | 9 | jobs: 10 | 11 | build: 12 | name: Build 13 | runs-on: ubuntu-latest 14 | steps: 15 | 16 | - name: Set up Go 1.13 17 | uses: actions/setup-go@v1 18 | with: 19 | go-version: 1.13 20 | id: go 21 | 22 | - name: Check out code into the Go module directory 23 | uses: actions/checkout@v2 24 | 25 | - name: Build 26 | run: go build -v examples/test_run.go -------------------------------------------------------------------------------- /Call.go: -------------------------------------------------------------------------------- 1 | package modemmanager 2 | 3 | import ( 4 | "encoding/json" 5 | "errors" 6 | "fmt" 7 | "github.com/godbus/dbus/v5" 8 | ) 9 | 10 | // Paths of methods and properties 11 | const ( 12 | CallInterface = ModemManagerInterface + ".Call" 13 | 14 | /* Methods */ 15 | CallStart = CallInterface + ".Start" 16 | CallAccept = CallInterface + ".Accept" 17 | CallDeflect = CallInterface + ".Deflect" 18 | CallJoinMultiparty = CallInterface + ".JoinMultiparty" 19 | CallLeaveMultiparty = CallInterface + ".LeaveMultiparty" 20 | CallHangup = CallInterface + ".Hangup" 21 | CallSendDtmf = CallInterface + ".SendDtmf" 22 | 23 | /* Property */ 24 | CallPropertyState = CallInterface + ".State" // readable i 25 | CallPropertyStateReason = CallInterface + ".StateReason" // readable i 26 | CallPropertyDirection = CallInterface + ".Direction" // readable i 27 | CallPropertyNumber = CallInterface + ".Number" // readable s 28 | CallPropertyMultiparty = CallInterface + ".Multiparty" // readable b 29 | CallPropertyAudioPort = CallInterface + ".AudioPort" // readable s 30 | CallPropertyAudioFormat = CallInterface + ".AudioFormat" // readable a{sv} 31 | 32 | /* Signal */ 33 | CallSignalDtmfReceived = "DtmfReceived" 34 | CallSignalStateChanged = "StateChanged" 35 | ) 36 | 37 | // The Call interface Defines operations and properties of a single Call. 38 | type Call interface { 39 | /* METHODS */ 40 | 41 | // Returns object path 42 | GetObjectPath() dbus.ObjectPath 43 | 44 | // If the outgoing call has not yet been started, start it 45 | // Applicable only if state is MM_CALL_STATE_UNKNOWN and direction is MM_CALL_DIRECTION_OUTGOING. 46 | Start() error 47 | 48 | // Accept incoming call (answer). 49 | // Applicable only if state is MM_CALL_STATE_RINGING_IN and direction is MM_CALL_DIRECTION_INCOMING. 50 | Accept() error 51 | 52 | // Deflect an incoming or waiting call to a new number. This call will be considered terminated once the 53 | // deflection is performed. 54 | // Applicable only if state is MM_CALL_STATE_RINGING_IN or MM_CALL_STATE_WAITING and direction is 55 | // MM_CALL_DIRECTION_INCOMING. 56 | // number: new number where the call will be deflected. 57 | Deflect(number string) error 58 | 59 | // Join the currently held call into a single multiparty call with another already active call. 60 | // The calls will be flagged with the 'Multiparty' property while they are part of the multiparty call. 61 | // Applicable only if state is MM_CALL_STATE_HELD. 62 | JoinMultiparty() error 63 | 64 | // If this call is part of an ongoing multiparty call, detach it from the multiparty call, put the multiparty 65 | // call on hold, and activate this one alone. This operation makes this call private again between both ends of the call. 66 | // Applicable only if state is MM_CALL_STATE_ACTIVE or MM_CALL_STATE_HELD and the call is a multiparty call. 67 | LeaveMultiparty() error 68 | 69 | // Hangup the active call. 70 | // Applicable only if state is MM_CALL_STATE_UNKNOWN. 71 | Hangup() error 72 | 73 | // Send a DTMF tone (Dual Tone Multi-Frequency) (only on supported modem). 74 | // Applicable only if state is MM_CALL_STATE_ACTIVE. 75 | // IN s dtmf: DTMF tone identifier [0-9A-D*#]. 76 | SendDtmf(dtmf string) error 77 | 78 | /* PROPERTIES */ 79 | MarshalJSON() ([]byte, error) 80 | 81 | // A MMCallState value, describing the state of the call. 82 | GetState() (MMCallState, error) 83 | 84 | // A MMCallStateReason value, describing why the state is changed. 85 | GetStateReason() (MMCallStateReason, error) 86 | 87 | // A MMCallDirection value, describing the direction of the call. 88 | GetDirection() (MMCallDirection, error) 89 | 90 | // The remote phone number. 91 | GetNumber() (string, error) 92 | 93 | // Whether the call is currently part of a multiparty conference call. 94 | GetMultiparty() (bool, error) 95 | 96 | // If call audio is routed via the host, the name of the kernel device that provides the audio. 97 | // For example, with certain Huawei USB modems, this property might be "ttyUSB2" indicating audio is 98 | // available via ttyUSB2 in the format described by the AudioFormat property. 99 | GetAudioPort() (string, error) 100 | 101 | // If call audio is routed via the host, a description of the audio format supported by the audio port. 102 | GetAudioFormat() (AudioFormat, error) 103 | 104 | /* SIGNALS */ 105 | 106 | // DtmfReceived (s dtmf); 107 | //Emitted when a DTMF tone is received (only on supported modem) 108 | // s dtmf:DTMF tone identifier [0-9A-D*#]. 109 | SubscribeDtmfReceived() <-chan *dbus.Signal 110 | 111 | ParseDtmfReceived(v *dbus.Signal) (string, error) 112 | 113 | // StateChanged (i old, 114 | // i new, 115 | // u reason); 116 | // Emitted when call changes state 117 | // i old: Old state MMCallState 118 | // i new: New state MMCallState 119 | // u reason: A MMCallStateReason value, specifying the reason for this state change. 120 | SubscribeStateChanged() <-chan *dbus.Signal 121 | 122 | // ParseStateChanged returns the parsed dbus signal 123 | ParseStateChanged(v *dbus.Signal) (oldState MMCallState, newState MMCallState, reason MMCallStateReason, err error) 124 | 125 | // Listen to changed properties 126 | // returns []interface 127 | // index 0 = name of the interface on which the properties are defined 128 | // index 1 = changed properties with new values as map[string]dbus.Variant 129 | // index 2 = invalidated properties: changed properties but the new values are not send with them 130 | SubscribePropertiesChanged() <-chan *dbus.Signal 131 | 132 | // ParsePropertiesChanged parses the dbus signal 133 | ParsePropertiesChanged(v *dbus.Signal) (interfaceName string, changedProperties map[string]dbus.Variant, invalidatedProperties []string, err error) 134 | 135 | Unsubscribe() 136 | } 137 | 138 | // NewCall returns new Call Interface 139 | func NewCall(objectPath dbus.ObjectPath) (Call, error) { 140 | var ca call 141 | return &ca, ca.init(ModemManagerInterface, objectPath) 142 | } 143 | 144 | type call struct { 145 | dbusBase 146 | sigChan chan *dbus.Signal 147 | } 148 | 149 | type AudioFormat struct { 150 | Encoding string `json:"encoding"` // The audio encoding format. For example, "pcm" for PCM audio. 151 | Resolution string `json:"resolution"` // The sampling precision and its encoding format. For example, "s16le" for signed 16-bit little-endian samples 152 | Rate uint32 `json:"rate"` // The sampling rate as an unsigned integer. For example, 8000 for 8000hz. 153 | } 154 | 155 | // MarshalJSON returns a byte array 156 | func (af AudioFormat) MarshalJSON() ([]byte, error) { 157 | return json.Marshal(map[string]interface{}{ 158 | "Encoding": af.Encoding, 159 | "Resolution": af.Resolution, 160 | "Rate": af.Rate, 161 | }) 162 | } 163 | func (af AudioFormat) String() string { 164 | return returnString(af) 165 | 166 | } 167 | 168 | func (ca call) GetObjectPath() dbus.ObjectPath { 169 | return ca.obj.Path() 170 | } 171 | 172 | func (ca call) Start() error { 173 | return ca.call(CallStart) 174 | } 175 | 176 | func (ca call) Accept() error { 177 | return ca.call(CallAccept) 178 | } 179 | 180 | func (ca call) Deflect(number string) error { 181 | return ca.call(CallDeflect, &number) 182 | } 183 | 184 | func (ca call) JoinMultiparty() error { 185 | return ca.call(CallJoinMultiparty) 186 | } 187 | 188 | func (ca call) LeaveMultiparty() error { 189 | return ca.call(CallLeaveMultiparty) 190 | } 191 | 192 | func (ca call) Hangup() error { 193 | return ca.call(CallHangup) 194 | } 195 | 196 | func (ca call) SendDtmf(dtmf string) error { 197 | return ca.call(CallSendDtmf, &dtmf) 198 | } 199 | 200 | func (ca call) GetState() (MMCallState, error) { 201 | res, err := ca.getInt32Property(CallPropertyState) 202 | if err != nil { 203 | return MmCallStateUnknown, err 204 | } 205 | return MMCallState(res), nil 206 | } 207 | 208 | func (ca call) GetStateReason() (MMCallStateReason, error) { 209 | res, err := ca.getInt32Property(CallPropertyStateReason) 210 | if err != nil { 211 | return MmCallStateReasonUnknown, err 212 | } 213 | return MMCallStateReason(res), nil 214 | } 215 | 216 | func (ca call) GetDirection() (MMCallDirection, error) { 217 | res, err := ca.getInt32Property(CallPropertyDirection) 218 | if err != nil { 219 | return MmCallDirectionUnknown, err 220 | } 221 | return MMCallDirection(res), nil 222 | } 223 | 224 | func (ca call) GetNumber() (string, error) { 225 | return ca.getStringProperty(CallPropertyNumber) 226 | } 227 | 228 | func (ca call) GetMultiparty() (bool, error) { 229 | return ca.getBoolProperty(CallPropertyMultiparty) 230 | } 231 | 232 | func (ca call) GetAudioPort() (string, error) { 233 | return ca.getStringProperty(CallPropertyAudioPort) 234 | } 235 | 236 | func (ca call) GetAudioFormat() (af AudioFormat, err error) { 237 | tmpMap, err := ca.getMapStringVariantProperty(CallPropertyAudioFormat) 238 | if err != nil { 239 | return af, err 240 | } 241 | for key, element := range tmpMap { 242 | switch key { 243 | case "encoding": 244 | tmpValue, ok := element.Value().(string) 245 | if ok { 246 | af.Encoding = tmpValue 247 | } 248 | case "resolution": 249 | tmpValue, ok := element.Value().(string) 250 | if ok { 251 | af.Resolution = tmpValue 252 | } 253 | case "rate": 254 | tmpValue, ok := element.Value().(uint32) 255 | if ok { 256 | af.Rate = tmpValue 257 | } 258 | 259 | } 260 | } 261 | return 262 | } 263 | 264 | func (ca call) SubscribeDtmfReceived() <-chan *dbus.Signal { 265 | if ca.sigChan != nil { 266 | return ca.sigChan 267 | } 268 | rule := fmt.Sprintf("type='signal', member='%s',path_namespace='%s'", CallSignalStateChanged, fmt.Sprint(ca.GetObjectPath())) 269 | ca.conn.BusObject().Call(dbusMethodAddMatch, 0, rule) 270 | ca.sigChan = make(chan *dbus.Signal, 10) 271 | ca.conn.Signal(ca.sigChan) 272 | return ca.sigChan 273 | } 274 | 275 | func (ca call) ParseDtmfReceived(v *dbus.Signal) (dtmf string, err error) { 276 | if len(v.Body) != 1 { 277 | err = errors.New("error by parsing dtmf received signal") 278 | return 279 | } 280 | dtmf, ok := v.Body[0].(string) 281 | if !ok { 282 | err = errors.New("error by parsing dtmf") 283 | return 284 | } 285 | return 286 | 287 | } 288 | 289 | func (ca call) SubscribeStateChanged() <-chan *dbus.Signal { 290 | if ca.sigChan != nil { 291 | return ca.sigChan 292 | } 293 | rule := fmt.Sprintf("type='signal', member='%s',path_namespace='%s'", CallSignalStateChanged, fmt.Sprint(ca.GetObjectPath())) 294 | ca.conn.BusObject().Call(dbusMethodAddMatch, 0, rule) 295 | ca.sigChan = make(chan *dbus.Signal, 10) 296 | ca.conn.Signal(ca.sigChan) 297 | return ca.sigChan 298 | } 299 | 300 | func (ca call) ParseStateChanged(v *dbus.Signal) (oldState MMCallState, newState MMCallState, reason MMCallStateReason, err error) { 301 | if len(v.Body) != 3 { 302 | err = errors.New("error by parsing property changed signal") 303 | return 304 | } 305 | oState, ok := v.Body[0].(int32) 306 | if !ok { 307 | err = errors.New("error by parsing old state") 308 | return 309 | } 310 | oldState = MMCallState(oState) 311 | 312 | nState, ok := v.Body[1].(int32) 313 | if !ok { 314 | err = errors.New("error by parsing new state") 315 | return 316 | } 317 | newState = MMCallState(nState) 318 | 319 | tmpReason, ok := v.Body[2].(uint32) 320 | if !ok { 321 | err = errors.New("error by parsing reason") 322 | return 323 | } 324 | reason = MMCallStateReason(tmpReason) 325 | return 326 | } 327 | 328 | func (ca call) SubscribePropertiesChanged() <-chan *dbus.Signal { 329 | if ca.sigChan != nil { 330 | return ca.sigChan 331 | } 332 | rule := fmt.Sprintf("type='signal', member='%s',path_namespace='%s'", dbusPropertiesChanged, fmt.Sprint(ca.GetObjectPath())) 333 | ca.conn.BusObject().Call(dbusMethodAddMatch, 0, rule) 334 | ca.sigChan = make(chan *dbus.Signal, 10) 335 | ca.conn.Signal(ca.sigChan) 336 | return ca.sigChan 337 | } 338 | 339 | func (ca call) ParsePropertiesChanged(v *dbus.Signal) (interfaceName string, changedProperties map[string]dbus.Variant, invalidatedProperties []string, err error) { 340 | return ca.parsePropertiesChanged(v) 341 | } 342 | 343 | func (ca call) Unsubscribe() { 344 | ca.conn.RemoveSignal(ca.sigChan) 345 | ca.sigChan = nil 346 | } 347 | 348 | func (ca call) MarshalJSON() ([]byte, error) { 349 | 350 | state, err := ca.GetState() 351 | if err != nil { 352 | return nil, err 353 | } 354 | stateReason, err := ca.GetStateReason() 355 | if err != nil { 356 | return nil, err 357 | } 358 | direction, err := ca.GetDirection() 359 | if err != nil { 360 | return nil, err 361 | } 362 | number, err := ca.GetNumber() 363 | if err != nil { 364 | return nil, err 365 | } 366 | multiparty, err := ca.GetMultiparty() 367 | if err != nil { 368 | return nil, err 369 | } 370 | audioPort, err := ca.GetAudioPort() 371 | if err != nil { 372 | return nil, err 373 | } 374 | audioFormat, err := ca.GetAudioFormat() 375 | if err != nil { 376 | return nil, err 377 | } 378 | audioFormatJson, err := audioFormat.MarshalJSON() 379 | if err != nil { 380 | return nil, err 381 | } 382 | return json.Marshal(map[string]interface{}{ 383 | "State": state, 384 | "StateReason": stateReason, 385 | "Direction": direction, 386 | "Number": number, 387 | "Multiparty": multiparty, 388 | "AudioPort": audioPort, 389 | "AudioFormat": audioFormatJson, 390 | }) 391 | } 392 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2020 Malte Grosse 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | ------------------------------------------------------------------------------ 24 | 25 | The MIT License (MIT) 26 | 27 | Copyright (c) 2019 Wifx Sàrl 28 | 29 | Permission is hereby granted, free of charge, to any person obtaining a copy 30 | of this software and associated documentation files (the "Software"), to deal 31 | in the Software without restriction, including without limitation the rights 32 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 33 | copies of the Software, and to permit persons to whom the Software is 34 | furnished to do so, subject to the following conditions: 35 | 36 | The above copyright notice and this permission notice shall be included in all 37 | copies or substantial portions of the Software. 38 | 39 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 40 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 41 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 42 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 43 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 44 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 45 | SOFTWARE. 46 | 47 | ------------------------------------------------------------------------------ 48 | 49 | The MIT License (MIT) 50 | 51 | Copyright (c) 2016 Bellerophon Mobile 52 | 53 | Permission is hereby granted, free of charge, to any person obtaining a copy 54 | of this software and associated documentation files (the "Software"), to deal 55 | in the Software without restriction, including without limitation the rights 56 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 57 | copies of the Software, and to permit persons to whom the Software is 58 | furnished to do so, subject to the following conditions: 59 | 60 | The above copyright notice and this permission notice shall be included in all 61 | copies or substantial portions of the Software. 62 | 63 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 64 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 65 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 66 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 67 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 68 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 69 | SOFTWARE. -------------------------------------------------------------------------------- /ModemCdma.go: -------------------------------------------------------------------------------- 1 | package modemmanager 2 | 3 | import ( 4 | "encoding/json" 5 | "errors" 6 | "fmt" 7 | "github.com/godbus/dbus/v5" 8 | "reflect" 9 | ) 10 | 11 | // Paths of methods and properties 12 | const ( 13 | ModemCdmaInterface = ModemInterface + ".ModemCdma" 14 | 15 | /* Methods */ 16 | ModemCdmaActivate = ModemCdmaInterface + ".Activate" 17 | ModemCdmaActivateManual = ModemCdmaInterface + ".ActivateManual" 18 | 19 | /* Property */ 20 | ModemCdmaPropertyActivationState = ModemCdmaInterface + ".ActivationState" // readable u 21 | ModemCdmaPropertyMeid = ModemCdmaInterface + ".Meid" // readable s 22 | ModemCdmaPropertyEsn = ModemCdmaInterface + ".Esn" // readable s 23 | ModemCdmaPropertySid = ModemCdmaInterface + ".Sid" // readable u 24 | ModemCdmaPropertyNid = ModemCdmaInterface + ".Nid" // readable u 25 | ModemCdmaPropertyCdma1xRegistrationState = ModemCdmaInterface + ".Cdma1xRegistrationState" // readable u 26 | ModemCdmaPropertyEvdoRegistrationState = ModemCdmaInterface + ".EvdoRegistrationState" // readable u 27 | 28 | /* Signal */ 29 | ModemCdmaSignalActivationStateChanged = "ActivationStateChanged" 30 | ) 31 | 32 | // ModemCdma interface provides access to specific actions that may be performed in modems with CDMA capabilities. 33 | // This interface will only be available once the modem is ready to be registered in the cellular network. 34 | // Mixed 3GPP+3GPP2 devices will require a valid unlocked SIM card before any of the features in the interface can be used. 35 | type ModemCdma interface { 36 | /* METHODS */ 37 | 38 | // get object path 39 | GetObjectPath() dbus.ObjectPath 40 | 41 | //Provisions the modem for use with a given carrier using the modem's Over-The-Air (OTA) activation functionality, if any. 42 | //Some modems will reboot after this call is made. 43 | // IN s carrier_code: Name of carrier, or carrier-specific code. 44 | Activate(carrierCode string) error 45 | 46 | // Sets the modem provisioning data directly, without contacting the carrier over the air. 47 | // Some modems will reboot after this call is made. 48 | ActivateManual(property CdmaProperty) error 49 | 50 | /* PROPERTIES */ 51 | 52 | // A MMModemCdmaActivationState value specifying the state of the activation in the 3GPP2 network. 53 | GetActivationState() (MMModemCdmaActivationState, error) 54 | 55 | // The modem's Mobile Equipment Identifier. 56 | GetMeid() (string, error) 57 | 58 | // The modem's Electronic Serial Number (superceded by MEID but still used by older devices). 59 | GetEsn() (string, error) 60 | 61 | // The System Identifier of the serving CDMA 1x network, if known, and if the modem is registered with a CDMA 1x network. 62 | // See ifast.org or the mobile broadband provider database for mappings of SIDs to network providers. 63 | GetSid() (uint32, error) 64 | 65 | // The Network Identifier of the serving CDMA 1x network, if known, and if the modem is registered with a CDMA 1x network. 66 | GetNid() (uint32, error) 67 | 68 | // A MMModemCdmaRegistrationState value specifying the CDMA 1x registration state. 69 | GetCdma1xRegistrationState() (MMModemCdmaRegistrationState, error) 70 | 71 | // A MMModemCdmaRegistratiCdmaProperty onState value specifying the EVDO registration state. 72 | GetEvdoRegistrationState() (MMModemCdmaRegistrationState, error) 73 | 74 | MarshalJSON() ([]byte, error) 75 | 76 | /* SIGNALS */ 77 | 78 | // The device activation state changed. 79 | // u activation_state: Current activation state, given as a MMModemCdmaActivationState. 80 | // u activation_error: Carrier-specific error code, given as a MMCdmaActivationError. 81 | // a{sv} status_changes:Properties that have changed as a result of this activation state change, including "mdn" and "min". The dictionary may be empty if the changed properties are unknown. 82 | SubscribeActivationStateChanged() <-chan *dbus.Signal 83 | // ParsePropertiesChanged parses the dbus signal 84 | ParseActivationStateChanged(v *dbus.Signal) (activationState MMModemCdmaActivationState, activationError MMCdmaActivationError, changedProperties map[string]dbus.Variant, err error) 85 | 86 | Unsubscribe() 87 | } 88 | 89 | // NewModemCdma returns new ModemCdma Interface 90 | func NewModemCdma(objectPath dbus.ObjectPath) (ModemCdma, error) { 91 | var mc modemCdma 92 | return &mc, mc.init(ModemManagerInterface, objectPath) 93 | } 94 | 95 | type modemCdma struct { 96 | dbusBase 97 | sigChan chan *dbus.Signal 98 | } 99 | 100 | // CdmaProperty describes the parameters for activating manually the modem 101 | type CdmaProperty struct { 102 | Spc string `json:"spc"` // The Service Programming Code, given as a string of exactly 6 digit characters. Mandatory parameter. 103 | Sid uint16 `json:"sid"` // The System Identification Number, given as a 16-bit unsigned integer (signature "q"). Mandatory parameter. 104 | Mdn string `json:"mdn"` // The Mobile Directory Number, given as a string of maximum 15 characters. Mandatory parameter. 105 | Min string `json:"min"` // The Mobile Identification Number, given as a string of maximum 15 characters. Mandatory parameter. 106 | MnHaKey string `json:"mn-ha-key"` // The MN-HA key, given as a string of maximum 16 characters. 107 | MnAaaKey string `json:"mn-aaa-key"` // The MN-AAA key, given as a string of maximum 16 characters. 108 | Prl []byte `json:"prl"` // The Preferred Roaming List, given as an array of maximum 16384 bytes. 109 | } 110 | 111 | // MarshalJSON returns a byte array 112 | func (cdma CdmaProperty) MarshalJSON() ([]byte, error) { 113 | return json.Marshal(map[string]interface{}{ 114 | "Spc": cdma.Spc, 115 | "Sid": cdma.Sid, 116 | "Mdn": cdma.Mdn, 117 | "Min": cdma.Min, 118 | "MnHaKey": cdma.MnHaKey, 119 | "MnAaaKey": cdma.MnAaaKey, 120 | "Prl": cdma.Prl, 121 | }) 122 | } 123 | func (cdma CdmaProperty) String() string { 124 | return returnString(cdma) 125 | } 126 | 127 | func (mc modemCdma) GetObjectPath() dbus.ObjectPath { 128 | return mc.obj.Path() 129 | } 130 | func (mc modemCdma) Activate(carrierCode string) error { 131 | // todo: untested 132 | return mc.call(ModemCdmaActivate, &carrierCode) 133 | } 134 | 135 | func (mc modemCdma) ActivateManual(property CdmaProperty) error { 136 | // todo: untested 137 | v := reflect.ValueOf(property) 138 | st := reflect.TypeOf(property) 139 | 140 | type dynMap interface{} 141 | var myMap map[string]dynMap 142 | myMap = make(map[string]dynMap) 143 | for i := 0; i < v.NumField(); i++ { 144 | field := st.Field(i) 145 | tag := field.Tag.Get("json") 146 | value := v.Field(i).Interface() 147 | if v.Field(i).IsZero() { 148 | continue 149 | } 150 | myMap[tag] = value 151 | } 152 | return mc.call(ModemCdmaActivateManual, &myMap) 153 | } 154 | 155 | func (mc modemCdma) GetActivationState() (MMModemCdmaActivationState, error) { 156 | res, err := mc.getUint32Property(ModemCdmaPropertyActivationState) 157 | if err != nil { 158 | return MmModemCdmaActivationStateUnknown, err 159 | } 160 | return MMModemCdmaActivationState(res), nil 161 | } 162 | 163 | func (mc modemCdma) GetMeid() (string, error) { 164 | return mc.getStringProperty(ModemCdmaPropertyMeid) 165 | } 166 | 167 | func (mc modemCdma) GetEsn() (string, error) { 168 | return mc.getStringProperty(ModemCdmaPropertyEsn) 169 | } 170 | 171 | func (mc modemCdma) GetSid() (uint32, error) { 172 | return mc.getUint32Property(ModemCdmaPropertySid) 173 | } 174 | 175 | func (mc modemCdma) GetNid() (uint32, error) { 176 | return mc.getUint32Property(ModemCdmaPropertyNid) 177 | } 178 | 179 | func (mc modemCdma) GetCdma1xRegistrationState() (MMModemCdmaRegistrationState, error) { 180 | res, err := mc.getUint32Property(ModemCdmaPropertyCdma1xRegistrationState) 181 | if err != nil { 182 | return MmModemCdmaRegistrationStateUnknown, err 183 | } 184 | return MMModemCdmaRegistrationState(res), nil 185 | } 186 | 187 | func (mc modemCdma) GetEvdoRegistrationState() (MMModemCdmaRegistrationState, error) { 188 | res, err := mc.getUint32Property(ModemCdmaPropertyEvdoRegistrationState) 189 | if err != nil { 190 | return MmModemCdmaRegistrationStateUnknown, err 191 | } 192 | return MMModemCdmaRegistrationState(res), nil 193 | } 194 | 195 | func (mc modemCdma) SubscribeActivationStateChanged() <-chan *dbus.Signal { 196 | if mc.sigChan != nil { 197 | return mc.sigChan 198 | } 199 | rule := fmt.Sprintf("type='signal', member='%s',path_namespace='%s'", ModemCdmaSignalActivationStateChanged, fmt.Sprint(mc.GetObjectPath())) 200 | mc.conn.BusObject().Call(dbusMethodAddMatch, 0, rule) 201 | mc.sigChan = make(chan *dbus.Signal, 10) 202 | mc.conn.Signal(mc.sigChan) 203 | return mc.sigChan 204 | } 205 | 206 | func (mc modemCdma) ParseActivationStateChanged(v *dbus.Signal) (activationState MMModemCdmaActivationState, activationError MMCdmaActivationError, changedProperties map[string]dbus.Variant, err error) { 207 | if len(v.Body) != 3 { 208 | err = errors.New("error by parsing activation changed signal") 209 | return 210 | } 211 | aState, ok := v.Body[0].(uint32) 212 | if !ok { 213 | err = errors.New("error by parsing activation state") 214 | return 215 | } 216 | activationState = MMModemCdmaActivationState(aState) 217 | 218 | eState, ok := v.Body[1].(uint32) 219 | if !ok { 220 | err = errors.New("error by parsing activation error state") 221 | return 222 | } 223 | activationError = MMCdmaActivationError(eState) 224 | 225 | changedProperties, ok = v.Body[2].(map[string]dbus.Variant) 226 | if !ok { 227 | err = errors.New("error by parsing changed") 228 | return 229 | } 230 | return 231 | } 232 | 233 | func (mc modemCdma) Unsubscribe() { 234 | mc.conn.RemoveSignal(mc.sigChan) 235 | mc.sigChan = nil 236 | } 237 | 238 | func (mc modemCdma) MarshalJSON() ([]byte, error) { 239 | activationState, err := mc.GetActivationState() 240 | if err != nil { 241 | return nil, err 242 | } 243 | meid, err := mc.GetMeid() 244 | if err != nil { 245 | return nil, err 246 | } 247 | esn, err := mc.GetEsn() 248 | if err != nil { 249 | return nil, err 250 | } 251 | sid, err := mc.GetSid() 252 | if err != nil { 253 | return nil, err 254 | } 255 | nid, err := mc.GetNid() 256 | if err != nil { 257 | return nil, err 258 | } 259 | cdma1xRegistrationState, err := mc.GetCdma1xRegistrationState() 260 | if err != nil { 261 | return nil, err 262 | } 263 | evdoRegistrationState, err := mc.GetEvdoRegistrationState() 264 | if err != nil { 265 | return nil, err 266 | } 267 | return json.Marshal(map[string]interface{}{ 268 | "ActivationState": activationState, 269 | "Meid": meid, 270 | "Esn": esn, 271 | "Sid": sid, 272 | "Nid": nid, 273 | "Cdma1xRegistrationState": cdma1xRegistrationState, 274 | "EvdoRegistrationState": evdoRegistrationState, 275 | }) 276 | } 277 | -------------------------------------------------------------------------------- /ModemFirmware.go: -------------------------------------------------------------------------------- 1 | package modemmanager 2 | 3 | import ( 4 | "encoding/json" 5 | "errors" 6 | "fmt" 7 | "github.com/godbus/dbus/v5" 8 | ) 9 | 10 | // Paths of methods and properties 11 | const ( 12 | ModemFirmwareInterface = ModemInterface + ".Firmware" 13 | 14 | /* Methods */ 15 | ModemFirmwareList = ModemFirmwareInterface + ".List" 16 | ModemFirmwareSelect = ModemFirmwareInterface + ".Select" 17 | 18 | /* Property */ 19 | ModemFirmwarePropertyUpdateSettings = ModemFirmwareInterface + ".UpdateSettings" // readable (ua{sv}) 20 | 21 | ) 22 | 23 | // ModemFirmware provides access to perform different firmware-related operations in the modem, 24 | // including listing the available firmware images in the module and selecting which of them to use. 25 | // This interface does not provide direct access to perform firmware updates in the device. Instead, it 26 | // exposes information about the expected firmware update method as well as method-specific details required for the 27 | // upgrade to happen. The actual firmware upgrade may be performed via the Linux Vendor Firmware Service and the fwupd daemon. 28 | // This interface will always be available as long a the modem is considered valid. 29 | type ModemFirmware interface { 30 | /* METHODS */ 31 | 32 | // Returns object path 33 | GetObjectPath() dbus.ObjectPath 34 | 35 | // List installed firmware images. 36 | // Firmware slots and firmware images are identified by arbitrary opaque strings. 37 | // List (OUT s selected, OUT aa{sv} installed); 38 | 39 | List() ([]FirmwareProperty, error) 40 | 41 | // Selects a different firmware image to use, and immediately resets the modem so that it begins using the new firmware image. 42 | // The method will fail if the identifier does not match any of the names returned by List(), or if the image could not be selected for some reason. 43 | // Installed images can be selected non-destructively. 44 | // IN s uniqueid: The unique ID of the firmware image to select. 45 | Select(string) error 46 | 47 | MarshalJSON() ([]byte, error) 48 | 49 | /* PROPERTIES */ 50 | // Detailed settings that provide information about how the module should be updated. 51 | GetUpdateSettings() (UpdateSettingsProperty, error) 52 | } 53 | 54 | // NewModemFirmware returns new ModemFirmware Interface 55 | func NewModemFirmware(objectPath dbus.ObjectPath) (ModemFirmware, error) { 56 | var fi modemFirmware 57 | return &fi, fi.init(ModemManagerInterface, objectPath) 58 | } 59 | 60 | type modemFirmware struct { 61 | dbusBase 62 | } 63 | 64 | // FirmwareProperty represents all properties of a firmware 65 | type FirmwareProperty struct { 66 | ImageType MMFirmwareImageType `json:"image-type"` // (Required) Type of the firmware image, given as a MMFirmwareImageType value (signature "u"). Firmware images of type MM_FIRMWARE_IMAGE_TYPE_GENERIC will only expose only the mandatory properties. 67 | UniqueId string `json:"unique-id"` // (Required) A user-readable unique ID for the firmware image, given as a string value (signature "s"). 68 | GobiPriVersion string `json:"gobi-pri-version"` // (Optional) The version of the PRI firmware image, in images of type MM_FIRMWARE_IMAGE_TYPE_GOBI, given as a string value (signature "s"). 69 | GobiPriInfo string `json:"gobi-pri-info"` // (Optional) Additional information of the PRI image, in images of type MM_FIRMWARE_IMAGE_TYPE_GOBI, given as a string value (signature "s"). 70 | GobiBootVersion string `json:"gobi-boot-version"` // (Optional) The boot version of the PRI firmware image, in images of type MM_FIRMWARE_IMAGE_TYPE_GOBI, given as a string value (signature "s"). 71 | GobiPriUniqueId string `json:"gobi-pri-unique-id"` // (Optional) The unique ID of the PRI firmware image, in images of type MM_FIRMWARE_IMAGE_TYPE_GOBI, given as a string value (signature "s"). 72 | GobiModemUniqueId string `json:"gobi-modem-unique-id"` // (Optional) The unique ID of the Modem firmware image, in images of type MM_FIRMWARE_IMAGE_TYPE_GOBI, given as a string value (signature "s"). 73 | Selected bool `json:"selected"` // Shows if certain firmware is selected 74 | } 75 | 76 | // MarshalJSON returns a byte array 77 | func (fp FirmwareProperty) MarshalJSON() ([]byte, error) { 78 | return json.Marshal(map[string]interface{}{ 79 | "ImageType": fmt.Sprint(fp.ImageType), 80 | "UniqueId": fp.UniqueId, 81 | "GobiPriVersion": fp.GobiPriVersion, 82 | "GobiPriInfo": fp.GobiPriInfo, 83 | "GobiBootVersion": fp.GobiBootVersion, 84 | "GobiPriUniqueId": fp.GobiPriUniqueId, 85 | "GobiModemUniqueId": fp.GobiModemUniqueId, 86 | "Selected": fp.Selected, 87 | }) 88 | } 89 | func (fp FirmwareProperty) String() string { 90 | return "ImageType: " + fmt.Sprint(fp.ImageType) + 91 | ", UniqueId: " + fp.UniqueId + 92 | ", GobiPriVersion: " + fp.GobiPriVersion + 93 | ", GobiPriInfo: " + fp.GobiPriInfo + 94 | ", GobiBootVersion: " + fp.GobiBootVersion + 95 | ", GobiPriUniqueId: " + fp.GobiPriUniqueId + 96 | ", GobiModemUniqueId: " + fp.GobiModemUniqueId + 97 | ", Selected: " + fmt.Sprint(fp.Selected) 98 | } 99 | 100 | // UpdateSettingsProperty represents all available update settings 101 | type UpdateSettingsProperty struct { 102 | UpdateMethods []MMModemFirmwareUpdateMethod `json:"update-methods"` // The settings are given as a bitmask of MMModemFirmwareUpdateMethod values specifying the type of firmware update procedures 103 | DeviceIds []string `json:"device-ids"` // (Required) This property exposes the list of device IDs associated to a given device, from most specific to least specific. (signature 'as'). E.g. a list containing: "USB\VID_413C&PID_81D7&REV_0001", "USB\VID_413C&PID_81D7" and "USB\VID_413C" 104 | Version string `json:"version"` // (Required) This property exposes the current firmware version string of the module. If the module uses separate version numbers for firmware version and carrier configuration, this version string will be a combination of both, and so it may be different to the version string showed in the "Revision" property. (signature 's') 105 | FastbootAt string `json:"fastboot-at"` // only if update method fastboot: (Required) This property exposes the AT command that should be sent to the module to trigger a reset into fastboot mode (signature 's') 106 | } 107 | 108 | // MarshalJSON returns a byte array 109 | func (us UpdateSettingsProperty) MarshalJSON() ([]byte, error) { 110 | return json.Marshal(map[string]interface{}{ 111 | "UpdateMethods": fmt.Sprint(us.UpdateMethods), 112 | "DeviceIds": us.DeviceIds, 113 | "Version": us.Version, 114 | "FastbootAt": us.FastbootAt, 115 | }) 116 | } 117 | 118 | func (us UpdateSettingsProperty) String() string { 119 | return "UpdateMethods: " + fmt.Sprint(us.UpdateMethods) + 120 | ", DeviceIds: " + fmt.Sprint(us.DeviceIds) + 121 | ", Version: " + us.Version + 122 | ", FastbootAt: " + us.FastbootAt 123 | } 124 | 125 | func (fi modemFirmware) GetObjectPath() dbus.ObjectPath { 126 | return fi.obj.Path() 127 | } 128 | 129 | func (fi modemFirmware) Select(uid string) error { 130 | return fi.call(ModemFirmwareSelect, uid) 131 | } 132 | 133 | func (fi modemFirmware) List() (properties []FirmwareProperty, err error) { 134 | var resMap []map[string]dbus.Variant 135 | var tmpString string 136 | err = fi.callWithReturn2(&tmpString, &resMap, ModemFirmwareList) 137 | if err != nil { 138 | return 139 | } 140 | for _, el := range resMap { 141 | var property FirmwareProperty 142 | for key, element := range el { 143 | switch key { 144 | case "image-type": 145 | tmpValue, ok := element.Value().(uint32) 146 | if ok { 147 | property.ImageType = MMFirmwareImageType(tmpValue) 148 | } 149 | case "unique-id": 150 | tmpValue, ok := element.Value().(string) 151 | if ok { 152 | property.UniqueId = tmpValue 153 | if tmpValue == tmpString { 154 | property.Selected = true 155 | } 156 | } 157 | case "gobi-pri-version": 158 | tmpValue, ok := element.Value().(string) 159 | if ok { 160 | property.GobiPriVersion = tmpValue 161 | 162 | } 163 | case "gobi-pri-info": 164 | tmpValue, ok := element.Value().(string) 165 | if ok { 166 | property.GobiPriInfo = tmpValue 167 | 168 | } 169 | case "gobi-boot-version": 170 | tmpValue, ok := element.Value().(string) 171 | if ok { 172 | property.GobiBootVersion = tmpValue 173 | } 174 | case "gobi-pri-unique-id": 175 | tmpValue, ok := element.Value().(string) 176 | if ok { 177 | property.GobiPriUniqueId = tmpValue 178 | } 179 | case "gobi-modem-unique-id": 180 | tmpValue, ok := element.Value().(string) 181 | if ok { 182 | property.GobiModemUniqueId = tmpValue 183 | } 184 | } 185 | } 186 | properties = append(properties, property) 187 | } 188 | return 189 | } 190 | 191 | func (fi modemFirmware) GetUpdateSettings() (property UpdateSettingsProperty, err error) { 192 | res, err := fi.getPairProperty(ModemFirmwarePropertyUpdateSettings) 193 | if err != nil { 194 | return 195 | } 196 | var tmp MMModemFirmwareUpdateMethod 197 | bitmask, ok := res.GetLeft().(uint32) 198 | if !ok { 199 | return property, errors.New("wrong type") 200 | } 201 | property.UpdateMethods = tmp.BitmaskToSlice(bitmask) 202 | resMap, ok := res.GetRight().(map[string]dbus.Variant) 203 | if !ok { 204 | return property, errors.New("wrong type") 205 | } 206 | for key, element := range resMap { 207 | switch key { 208 | case "device-ids": 209 | tmpValue, ok := element.Value().([]string) 210 | if ok { 211 | property.DeviceIds = tmpValue 212 | } 213 | case "version": 214 | tmpValue, ok := element.Value().(string) 215 | if ok { 216 | property.Version = tmpValue 217 | } 218 | case "fastboot-at": 219 | tmpValue, ok := element.Value().(string) 220 | if ok { 221 | property.FastbootAt = tmpValue 222 | } 223 | } 224 | 225 | } 226 | return 227 | } 228 | 229 | func (fi modemFirmware) MarshalJSON() ([]byte, error) { 230 | updateSettings, err := fi.GetUpdateSettings() 231 | if err != nil { 232 | return nil, err 233 | } 234 | updateSettingsJson, err := updateSettings.MarshalJSON() 235 | if err != nil { 236 | return nil, err 237 | } 238 | return json.Marshal(map[string]interface{}{ 239 | "UpdateSettings": updateSettingsJson, 240 | }) 241 | } 242 | -------------------------------------------------------------------------------- /ModemManager.go: -------------------------------------------------------------------------------- 1 | package modemmanager 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | "github.com/godbus/dbus/v5" 7 | "reflect" 8 | ) 9 | 10 | // Paths of methods and properties 11 | const ( 12 | ModemManagerInterface = "org.freedesktop.ModemManager1" 13 | 14 | ModemManagerObjectPath = "/org/freedesktop/ModemManager1" 15 | modemManagerMainObjectPath = "/org/freedesktop/ModemManager/" 16 | 17 | /* Methods */ 18 | ModemManagerScanDevices = ModemManagerInterface + ".ScanDevices" 19 | ModemManagerSetLogging = ModemManagerInterface + ".SetLogging" 20 | ModemManagerReportKernelEvent = ModemManagerInterface + ".ReportKernelEvent" 21 | ModemManagerInhibitDevice = ModemManagerInterface + ".InhibitDevice" 22 | 23 | /* Property */ 24 | ModemManagerPropertyVersion = ModemManagerInterface + ".Version" // readable s 25 | 26 | ) 27 | 28 | // The ModemManager interface allows controlling and querying the status of the ModemManager daemon. 29 | type ModemManager interface { 30 | /* METHODS */ 31 | 32 | // Start a new scan for connected modem devices. 33 | ScanDevices() error 34 | 35 | // List modem devices. renamed from ListDevices to GetModems 36 | GetModems() ([]Modem, error) 37 | 38 | // Set logging verbosity. 39 | SetLogging(level MMLoggingLevel) error 40 | 41 | // Event Properties. 42 | // Reports a kernel event to ModemManager. 43 | // This method is only available if udev is not being used to report kernel events. 44 | // The properties dictionary is composed of key/value string pairs. The possible keys are: 45 | // see EventProperty and MMKernelPropertyAction 46 | ReportKernelEvent(EventProperties) error 47 | 48 | // org.freedesktop.ModemManager1.Modem:Device property. inhibit: TRUE to inhibit the modem and FALSE to uninhibit it. 49 | // Inhibit or uninhibit the device. 50 | // When the modem is inhibited ModemManager will close all its ports and unexport it from the bus, so that users of the interface are no longer able to operate with it. 51 | // This operation binds the inhibition request to the existence of the caller in the DBus bus. If the caller disappears from the bus, the inhibition will automatically removed. 52 | // IN s uid: the unique ID of the physical device, given in the 53 | // IN b inhibit: 54 | InhibitDevice(uid string, inhibit bool) error 55 | 56 | // The runtime version of the ModemManager daemon. 57 | GetVersion() (string, error) 58 | 59 | MarshalJSON() ([]byte, error) 60 | 61 | /* SIGNALS */ 62 | 63 | // Listen to changed properties 64 | // returns []interface 65 | // index 0 = name of the interface on which the properties are defined 66 | // index 1 = changed properties with new values as map[string]dbus.Variant 67 | // index 2 = invalidated properties: changed properties but the new values are not send with them 68 | SubscribePropertiesChanged() <-chan *dbus.Signal 69 | 70 | // ParsePropertiesChanged parses the dbus signal 71 | ParsePropertiesChanged(v *dbus.Signal) (interfaceName string, changedProperties map[string]dbus.Variant, invalidatedProperties []string, err error) 72 | Unsubscribe() 73 | } 74 | 75 | // NewModemManager returns new ModemManager Interface 76 | func NewModemManager() (ModemManager, error) { 77 | var mm modemManager 78 | return &mm, mm.init(ModemManagerInterface, ModemManagerObjectPath) 79 | } 80 | 81 | type modemManager struct { 82 | dbusBase 83 | sigChan chan *dbus.Signal 84 | } 85 | 86 | // EventProperties defines the properties which should be reported to the kernel 87 | type EventProperties struct { 88 | Action MMKernelPropertyAction `json:"action"` // The type of action, given as a string value (signature "s"). This parameter is MANDATORY. 89 | Name string `json:"name"` // The device name, given as a string value (signature "s"). This parameter is MANDATORY. 90 | Subsystem string `json:"subsystem"` // The device subsystem, given as a string value (signature "s"). This parameter is MANDATORY. 91 | Uid string `json:"uid"` // The unique ID of the physical device, given as a string value (signature "s"). This parameter is OPTIONAL, if not given the sysfs path of the physical device will be used. This parameter must be the same for all devices exposed by the same physical device. 92 | } 93 | 94 | // MarshalJSON returns a byte array 95 | func (ep EventProperties) MarshalJSON() ([]byte, error) { 96 | return json.Marshal(map[string]interface{}{ 97 | "Action": ep.Action, 98 | "Name": ep.Name, 99 | "Subsystem": ep.Subsystem, 100 | "Uid": ep.Uid, 101 | }) 102 | } 103 | 104 | func (mm modemManager) GetModems() (modems []Modem, err error) { 105 | devPaths, err := mm.getManagedObjects(ModemManagerInterface, ModemManagerObjectPath) 106 | if err != nil { 107 | return nil, err 108 | } 109 | for idx := range devPaths { 110 | modem, err := NewModem(devPaths[idx]) 111 | if err != nil { 112 | return nil, err 113 | } 114 | modems = append(modems, modem) 115 | } 116 | return 117 | } 118 | 119 | func (mm modemManager) ScanDevices() error { 120 | err := mm.call(ModemManagerScanDevices) 121 | return err 122 | } 123 | 124 | func (mm modemManager) SetLogging(level MMLoggingLevel) error { 125 | err := mm.call(ModemManagerSetLogging, &level) 126 | return err 127 | } 128 | 129 | func (mm modemManager) ReportKernelEvent(properties EventProperties) error { 130 | // todo: untested 131 | v := reflect.ValueOf(properties) 132 | st := reflect.TypeOf(properties) 133 | type dynMap interface{} 134 | var myMap map[string]dynMap 135 | myMap = make(map[string]dynMap) 136 | for i := 0; i < v.NumField(); i++ { 137 | field := st.Field(i) 138 | tag := field.Tag.Get("json") 139 | value := v.Field(i).Interface() 140 | if v.Field(i).IsZero() { 141 | continue 142 | } 143 | myMap[tag] = value 144 | } 145 | return mm.call(ModemManagerReportKernelEvent, &myMap) 146 | } 147 | 148 | func (mm modemManager) InhibitDevice(uid string, inhibit bool) error { 149 | // todo: untested 150 | err := mm.call(ModemManagerInhibitDevice, &uid, &inhibit) 151 | return err 152 | } 153 | 154 | func (mm modemManager) GetVersion() (string, error) { 155 | v, err := mm.getStringProperty(ModemManagerPropertyVersion) 156 | return v, err 157 | } 158 | func (mm modemManager) SubscribePropertiesChanged() <-chan *dbus.Signal { 159 | if mm.sigChan != nil { 160 | return mm.sigChan 161 | } 162 | rule := fmt.Sprintf("type='signal', member='%s',path_namespace='%s'", dbusPropertiesChanged, ModemManagerObjectPath) 163 | mm.conn.BusObject().Call(dbusMethodAddMatch, 0, rule) 164 | mm.sigChan = make(chan *dbus.Signal, 10) 165 | mm.conn.Signal(mm.sigChan) 166 | return mm.sigChan 167 | } 168 | func (mm modemManager) ParsePropertiesChanged(v *dbus.Signal) (interfaceName string, changedProperties map[string]dbus.Variant, invalidatedProperties []string, err error) { 169 | return mm.parsePropertiesChanged(v) 170 | } 171 | 172 | func (mm modemManager) Unsubscribe() { 173 | mm.conn.RemoveSignal(mm.sigChan) 174 | mm.sigChan = nil 175 | } 176 | 177 | func (mm modemManager) MarshalJSON() ([]byte, error) { 178 | version, err := mm.GetVersion() 179 | if err != nil { 180 | return nil, err 181 | } 182 | return json.Marshal(map[string]interface{}{ 183 | "Version": version, 184 | }) 185 | } 186 | -------------------------------------------------------------------------------- /ModemMessaging.go: -------------------------------------------------------------------------------- 1 | package modemmanager 2 | 3 | import ( 4 | "encoding/json" 5 | "errors" 6 | "fmt" 7 | "github.com/godbus/dbus/v5" 8 | ) 9 | 10 | // Paths of methods and properties 11 | const ( 12 | ModemMessagingInterface = ModemInterface + ".Messaging" 13 | 14 | /* Methods */ 15 | ModemMessagingList = ModemMessagingInterface + ".List" 16 | ModemMessagingDelete = ModemMessagingInterface + ".Delete" 17 | ModemMessagingCreate = ModemMessagingInterface + ".Create" 18 | 19 | /* Property */ 20 | ModemMessagingPropertyMessages = ModemMessagingInterface + ".Messages" 21 | ModemMessagingPropertySupportedStorages = ModemMessagingInterface + ".SupportedStorages" 22 | ModemMessagingPropertyDefaultStorage = ModemMessagingInterface + ".DefaultStorage" 23 | 24 | /* Signal */ 25 | ModemMessagingSignalAdded = "Added" 26 | ModemMessagingSignalDeleted = "Deleted" 27 | ) 28 | 29 | // The ModemMessaging interface handles sending SMS messages and notification of new incoming messages. 30 | // This interface will only be available once the modem is ready to be registered in the cellular network. 31 | // 3GPP devices will require a valid unlocked SIM card before any of the features in the interface can 32 | // be used (including listing stored messages). 33 | type ModemMessaging interface { 34 | /* METHODS */ 35 | // Returns object path 36 | GetObjectPath() dbus.ObjectPath 37 | 38 | MarshalJSON() ([]byte, error) 39 | 40 | // Retrieve all SMS messages. This method should only be used once and subsequent information retrieved either 41 | // by listening for the "Added" signal, or by querying the specific SMS object of interest. 42 | List() ([]Sms, error) 43 | 44 | // Delete an SMS message. 45 | Delete(Sms) error 46 | 47 | // Creates a new message object. 48 | // The 'Number' and either 'Text' or 'Data' properties are mandatory, others are optional. 49 | // If the SMSC is not specified and one is required, the default SMSC is used. 50 | // Optional Parameters are given has Pairs, where left side is property name as string, and right side the value as string 51 | // When sending, if the text/data is larger than the limit of the technology or modem, the message will be broken into multiple parts or messages. 52 | 53 | CreateSms(number string, text string, optionalParameters ...Pair) (Sms, error) 54 | CreateMms(number string, data []byte, optionalParameters ...Pair) (Sms, error) 55 | 56 | /* PROPERTIES */ 57 | 58 | // The list of SMS object paths. 59 | GetMessages() ([]Sms, error) 60 | 61 | // A list of MMSmsStorage values, specifying the storages supported by this modem for storing and receiving SMS. 62 | GetSupportedStorages() ([]MMSmsStorage, error) 63 | 64 | // A MMSmsStorage value, specifying the storage to be used when receiving or storing SMS. 65 | GetDefaultStorage() (MMSmsStorage, error) 66 | 67 | /* SIGNALS */ 68 | 69 | // Added (o path, 70 | // b received); 71 | // Emitted when any part of a new SMS has been received or added (but not for subsequent parts, if any). 72 | // For messages received from the network, not all parts may have been received and the message may not be complete. 73 | // Check the 'State' property to determine if the message is complete. 74 | // o path: Object path of the new SMS. 75 | // b received: TRUE if the message was received from the network, as opposed to being added locally. 76 | // 77 | SubscribeAdded() <-chan *dbus.Signal 78 | 79 | ParseAdded(v *dbus.Signal) (Sms, bool, error) 80 | 81 | // Deleted (o path); 82 | // Emitted when a message has been deleted. 83 | // o path: Object path of the now deleted SMS. 84 | SubscribeDeleted() <-chan *dbus.Signal 85 | 86 | Unsubscribe() 87 | } 88 | 89 | // NewModemMessaging returns new ModemMessagingInterface 90 | func NewModemMessaging(objectPath dbus.ObjectPath) (ModemMessaging, error) { 91 | var me modemMessaging 92 | return &me, me.init(ModemManagerInterface, objectPath) 93 | } 94 | 95 | type modemMessaging struct { 96 | dbusBase 97 | sigChan chan *dbus.Signal 98 | } 99 | 100 | func (me modemMessaging) GetObjectPath() dbus.ObjectPath { 101 | return me.obj.Path() 102 | } 103 | 104 | func (me modemMessaging) List() (sms []Sms, err error) { 105 | var smsPaths []dbus.ObjectPath 106 | err = me.callWithReturn(&smsPaths, ModemMessagingList) 107 | if err != nil { 108 | return 109 | } 110 | 111 | for idx := range smsPaths { 112 | singleSms, err := NewSms(smsPaths[idx]) 113 | if err != nil { 114 | return nil, err 115 | } 116 | sms = append(sms, singleSms) 117 | } 118 | return 119 | } 120 | 121 | func (me modemMessaging) Delete(sms Sms) error { 122 | objPath := sms.GetObjectPath() 123 | return me.call(ModemMessagingDelete, &objPath) 124 | } 125 | 126 | func (me modemMessaging) CreateSms(number string, text string, optionalParameters ...Pair) (Sms, error) { 127 | type dynMap interface{} 128 | var myMap map[string]dynMap 129 | myMap = make(map[string]dynMap) 130 | myMap["number"] = number 131 | myMap["text"] = text 132 | for _, pair := range optionalParameters { 133 | myMap[fmt.Sprint(pair.GetLeft())] = fmt.Sprint(pair.GetRight()) 134 | } 135 | var path dbus.ObjectPath 136 | err := me.callWithReturn(&path, ModemMessagingCreate, &myMap) 137 | if err != nil { 138 | return nil, err 139 | } 140 | singleSms, err := NewSms(path) 141 | if err != nil { 142 | return nil, err 143 | } 144 | return singleSms, nil 145 | } 146 | 147 | func (me modemMessaging) CreateMms(number string, data []byte, optionalParameters ...Pair) (Sms, error) { 148 | // todo: untested 149 | type dynMap interface{} 150 | var myMap map[string]dynMap 151 | myMap = make(map[string]dynMap) 152 | myMap["number"] = number 153 | myMap["data"] = data 154 | for _, pair := range optionalParameters { 155 | myMap[fmt.Sprint(pair.GetLeft())] = fmt.Sprint(pair.GetRight()) 156 | } 157 | var path dbus.ObjectPath 158 | err := me.callWithReturn(&path, ModemMessagingCreate, &myMap) 159 | if err != nil { 160 | return nil, err 161 | } 162 | singleSms, err := NewSms(path) 163 | if err != nil { 164 | return nil, err 165 | } 166 | return singleSms, nil 167 | } 168 | 169 | func (me modemMessaging) GetMessages() (sms []Sms, err error) { 170 | smsPaths, err := me.getSliceObjectProperty(ModemMessagingPropertyMessages) 171 | if err != nil { 172 | return 173 | } 174 | for idx := range smsPaths { 175 | singleSms, err := NewSms(smsPaths[idx]) 176 | if err != nil { 177 | return nil, err 178 | } 179 | sms = append(sms, singleSms) 180 | } 181 | return 182 | } 183 | 184 | func (me modemMessaging) GetSupportedStorages() (storages []MMSmsStorage, err error) { 185 | s, err := me.getSliceUint32Property(ModemMessagingPropertySupportedStorages) 186 | if err != nil { 187 | return 188 | } 189 | for _, c := range s { 190 | storages = append(storages, MMSmsStorage(c)) 191 | } 192 | return 193 | } 194 | 195 | func (me modemMessaging) GetDefaultStorage() (storage MMSmsStorage, err error) { 196 | s, err := me.getUint32Property(ModemMessagingPropertyDefaultStorage) 197 | if err != nil { 198 | return 199 | } 200 | return MMSmsStorage(s), nil 201 | } 202 | 203 | func (me modemMessaging) SubscribeAdded() <-chan *dbus.Signal { 204 | if me.sigChan != nil { 205 | return me.sigChan 206 | } 207 | rule := fmt.Sprintf("type='signal', member='%s',path_namespace='%s'", ModemMessagingSignalAdded, fmt.Sprint(me.GetObjectPath())) 208 | me.conn.BusObject().Call(dbusMethodAddMatch, 0, rule) 209 | me.sigChan = make(chan *dbus.Signal, 10) 210 | me.conn.Signal(me.sigChan) 211 | return me.sigChan 212 | } 213 | 214 | func (me modemMessaging) ParseAdded(v *dbus.Signal) (sms Sms, received bool, err error) { 215 | // todo untested 216 | if len(v.Body) != 2 { 217 | err = errors.New("error by parsing added signal") 218 | return 219 | } 220 | path, ok := v.Body[0].(dbus.ObjectPath) 221 | if !ok { 222 | err = errors.New("error by parsing object path") 223 | return 224 | } 225 | sms, err = NewSms(path) 226 | if err != nil { 227 | return 228 | } 229 | received, ok = v.Body[1].(bool) 230 | if !ok { 231 | err = errors.New("error by parsing received") 232 | return 233 | } 234 | return 235 | } 236 | 237 | func (me modemMessaging) SubscribeDeleted() <-chan *dbus.Signal { 238 | if me.sigChan != nil { 239 | return me.sigChan 240 | } 241 | rule := fmt.Sprintf("type='signal', member='%s',path_namespace='%s'", ModemMessagingSignalDeleted, fmt.Sprint(me.GetObjectPath())) 242 | me.conn.BusObject().Call(dbusMethodAddMatch, 0, rule) 243 | me.sigChan = make(chan *dbus.Signal, 10) 244 | me.conn.Signal(me.sigChan) 245 | return me.sigChan 246 | } 247 | 248 | func (me modemMessaging) Unsubscribe() { 249 | me.conn.RemoveSignal(me.sigChan) 250 | me.sigChan = nil 251 | } 252 | 253 | func (me modemMessaging) MarshalJSON() ([]byte, error) { 254 | messages, err := me.GetMessages() 255 | if err != nil { 256 | return nil, err 257 | } 258 | var messagesJson [][]byte 259 | for _, x := range messages { 260 | tmpB, err := x.MarshalJSON() 261 | if err != nil { 262 | return nil, err 263 | } 264 | messagesJson = append(messagesJson, tmpB) 265 | } 266 | supportedStorages, err := me.GetSupportedStorages() 267 | if err != nil { 268 | return nil, err 269 | } 270 | defaultStorage, err := me.GetDefaultStorage() 271 | if err != nil { 272 | return nil, err 273 | } 274 | return json.Marshal(map[string]interface{}{ 275 | "Messages": messagesJson, 276 | "SupportedStorages": supportedStorages, 277 | "DefaultStorage": defaultStorage, 278 | }) 279 | 280 | } 281 | -------------------------------------------------------------------------------- /ModemOma.go: -------------------------------------------------------------------------------- 1 | package modemmanager 2 | 3 | import ( 4 | "encoding/json" 5 | "errors" 6 | "fmt" 7 | "github.com/godbus/dbus/v5" 8 | ) 9 | 10 | // Paths of methods and properties 11 | const ( 12 | ModemOmaInterface = ModemInterface + ".Oma" 13 | 14 | /* Methods */ 15 | ModemOmaSetup = ModemOmaInterface + ".Setup" 16 | ModemOmaStartClientInitiatedSession = ModemOmaInterface + ".StartClientInitiatedSession" 17 | ModemOmaAcceptNetworkInitiatedSession = ModemOmaInterface + ".AcceptNetworkInitiatedSession" 18 | ModemOmaCancelSession = ModemOmaInterface + ".CancelSession" 19 | /* Property */ 20 | ModemOmaPropertyFeatures = ModemOmaInterface + ".Features" // readable u 21 | ModemOmaPropertyPendingNetworkInitiatedSessions = ModemOmaInterface + ".PendingNetworkInitiatedSessions" // readable a(uu) 22 | ModemOmaPropertySessionType = ModemOmaInterface + ".SessionType" // readable u 23 | ModemOmaPropertySessionState = ModemOmaInterface + ".SessionState" // readable i 24 | /* Signal */ 25 | ModemOmaSignalSessionStateChanged = "SessionStateChanged" 26 | ) 27 | 28 | // ModemOma allows clients to handle device management operations as specified by the Open Mobile Alliance (OMA). 29 | // Device management sessions are either on-demand (client-initiated), or automatically initiated by either the device 30 | // itself or the network. 31 | // This interface will only be available once the modem is ready to be registered in the cellular network. 32 | // 3GPP devices will require a valid unlocked SIM card before any of the features in the interface can be used. 33 | type ModemOma interface { 34 | /* METHODS */ 35 | // Returns object path 36 | GetObjectPath() dbus.ObjectPath 37 | MarshalJSON() ([]byte, error) 38 | 39 | // Configures which OMA device management features should be enabled. 40 | // Bitmask of MMModemOmaFeature flags, specifying which device management 41 | // features should get enabled or disabled. MM_OMA_FEATURE_NONE will disable all features. 42 | Setup(features []MMOmaFeature) error 43 | 44 | // Starts a client-initiated device management session. 45 | // Type of client-initiated device management session,given as a MMModemOmaSessionType 46 | StartClientInitiatedSession(sessionType MMOmaSessionType) error 47 | 48 | // Accepts or rejects a network-initiated device management session. 49 | // IN u session_id: Unique ID of the network-initiated device management session. 50 | // IN b accept: Boolean specifying whether the session is accepted or rejected. 51 | AcceptNetworkInitiatedSession(sessionId uint32, accept bool) error 52 | 53 | // Cancels the current on-going device management session. 54 | CancelSession() error 55 | 56 | /* PROPERTIES */ 57 | 58 | // Bitmask of MMModemOmaFeature flags, specifying which device management features are enabled or disabled. 59 | GetFeatures() ([]MMOmaFeature, error) 60 | 61 | // List of network-initiated sessions which are waiting to be accepted or rejected, given as an array of unsigned integer pairs, where: 62 | // The first integer is a MMOmaSessionType. 63 | // The second integer is the unique session ID. 64 | GetPendingNetworkInitiatedSessions() ([]ModemOmaInitiatedSession, error) 65 | 66 | // Type of the current on-going device management session, given as a MMOmaSessionType. 67 | GetSessionType() (MMOmaSessionType, error) 68 | 69 | // State of the current on-going device management session, given as a MMOmaSessionState. 70 | GetSessionState() (MMOmaSessionState, error) 71 | 72 | /* SIGNALS */ 73 | 74 | // The session state changed. 75 | // i old_session_state: Previous session state, given as a MMOmaSessionState. 76 | // i new_session_state: Current session state, given as a MMOmaSessionState. 77 | // u session_state_failed_reason: Reason of failure, given as a MMOmaSessionStateFailedReason, if session_state is MM_OMA_SESSION_STATE_FAILED. 78 | SubscribeSessionStateChanged() <-chan *dbus.Signal 79 | 80 | ParseSessionStateChanged(v *dbus.Signal) (oldState MMOmaSessionState, newState MMOmaSessionState, failureReason MMOmaSessionStateFailedReason, err error) 81 | Unsubscribe() 82 | } 83 | 84 | // NewModemOma returns new ModemOma Interface 85 | func NewModemOma(objectPath dbus.ObjectPath) (ModemOma, error) { 86 | var om modemOma 87 | return &om, om.init(ModemManagerInterface, objectPath) 88 | } 89 | 90 | type modemOma struct { 91 | dbusBase 92 | sigChan chan *dbus.Signal 93 | } 94 | 95 | type ModemOmaInitiatedSession struct { 96 | SessionType MMOmaSessionType `json:"session-type"` // network-initiated session type 97 | SessionId uint32 `json:"session-id"` // network-initiated session id 98 | } 99 | 100 | // MarshalJSON returns a byte array 101 | func (mois ModemOmaInitiatedSession) MarshalJSON() ([]byte, error) { 102 | return json.Marshal(map[string]interface{}{ 103 | "SessionType": fmt.Sprint(mois.SessionType), 104 | "SessionId": mois.SessionId, 105 | }) 106 | } 107 | 108 | func (mois ModemOmaInitiatedSession) String() string { 109 | return "SessionType: " + fmt.Sprint(mois.SessionType) + 110 | ", SessionId: " + fmt.Sprint(mois.SessionId) 111 | } 112 | func (om modemOma) GetObjectPath() dbus.ObjectPath { 113 | return om.obj.Path() 114 | } 115 | func (om modemOma) Setup(features []MMOmaFeature) error { 116 | // todo: untested 117 | var tmp MMOmaFeature 118 | return om.call(ModemOmaSetup, tmp.SliceToBitmask(features)) 119 | } 120 | 121 | func (om modemOma) StartClientInitiatedSession(sessionType MMOmaSessionType) error { 122 | // todo: untested 123 | return om.call(ModemOmaStartClientInitiatedSession, sessionType) 124 | } 125 | 126 | func (om modemOma) AcceptNetworkInitiatedSession(sessionId uint32, accept bool) error { 127 | // todo: untested 128 | return om.call(ModemOmaAcceptNetworkInitiatedSession, sessionId, accept) 129 | } 130 | 131 | func (om modemOma) CancelSession() error { 132 | // todo: untested 133 | return om.call(ModemOmaCancelSession) 134 | } 135 | 136 | func (om modemOma) GetFeatures() ([]MMOmaFeature, error) { 137 | var tmp MMOmaFeature 138 | res, err := om.getUint32Property(ModemOmaPropertyFeatures) 139 | if err != nil { 140 | return nil, err 141 | } 142 | return tmp.BitmaskToSlice(res), nil 143 | 144 | } 145 | 146 | func (om modemOma) GetPendingNetworkInitiatedSessions() (result []ModemOmaInitiatedSession, err error) { 147 | res, err := om.getSliceSlicePairProperty(ModemOmaPropertyPendingNetworkInitiatedSessions) 148 | if err != nil { 149 | return nil, err 150 | } 151 | for _, e := range res { 152 | var tmp ModemOmaInitiatedSession 153 | sType, ok := e.GetLeft().(uint32) 154 | if !ok { 155 | return nil, errors.New("wrong type") 156 | } 157 | tmp.SessionType = MMOmaSessionType(sType) 158 | sId, ok := e.GetLeft().(uint32) 159 | if !ok { 160 | return nil, errors.New("wrong type") 161 | } 162 | tmp.SessionId = sId 163 | result = append(result, tmp) 164 | } 165 | return 166 | } 167 | 168 | func (om modemOma) GetSessionType() (MMOmaSessionType, error) { 169 | res, err := om.getUint32Property(ModemOmaPropertySessionType) 170 | if err != nil { 171 | return MmOmaSessionTypeUnknown, err 172 | } 173 | return MMOmaSessionType(res), nil 174 | } 175 | 176 | func (om modemOma) GetSessionState() (MMOmaSessionState, error) { 177 | res, err := om.getUint32Property(ModemOmaPropertySessionState) 178 | if err != nil { 179 | return MmOmaSessionStateUnknown, err 180 | } 181 | return MMOmaSessionState(res), nil 182 | } 183 | 184 | func (om modemOma) SubscribeSessionStateChanged() <-chan *dbus.Signal { 185 | if om.sigChan != nil { 186 | return om.sigChan 187 | } 188 | rule := fmt.Sprintf("type='signal', member='%s',path_namespace='%s'", ModemOmaSignalSessionStateChanged, fmt.Sprint(om.GetObjectPath())) 189 | om.conn.BusObject().Call(dbusMethodAddMatch, 0, rule) 190 | om.sigChan = make(chan *dbus.Signal, 10) 191 | om.conn.Signal(om.sigChan) 192 | return om.sigChan 193 | } 194 | 195 | func (om modemOma) ParseSessionStateChanged(v *dbus.Signal) (oldState MMOmaSessionState, newState MMOmaSessionState, failureReason MMOmaSessionStateFailedReason, err error) { 196 | // todo: untested 197 | if len(v.Body) < 2 { 198 | err = errors.New("error by parsing session changed signal") 199 | return 200 | } 201 | oState, ok := v.Body[0].(int32) 202 | if !ok { 203 | err = errors.New("error by parsing old state") 204 | return 205 | } 206 | oldState = MMOmaSessionState(oState) 207 | nState, ok := v.Body[1].(int32) 208 | if !ok { 209 | err = errors.New("error by parsing new state") 210 | return 211 | } 212 | newState = MMOmaSessionState(nState) 213 | if len(v.Body) == 3 { 214 | rFailure, ok := v.Body[2].(uint32) 215 | if !ok { 216 | err = errors.New("error by parsing failure reason") 217 | return 218 | } 219 | failureReason = MMOmaSessionStateFailedReason(rFailure) 220 | 221 | } 222 | return 223 | } 224 | 225 | func (om modemOma) Unsubscribe() { 226 | om.conn.RemoveSignal(om.sigChan) 227 | om.sigChan = nil 228 | } 229 | 230 | func (om modemOma) MarshalJSON() ([]byte, error) { 231 | features, err := om.GetFeatures() 232 | if err != nil { 233 | return nil, err 234 | } 235 | var pendingNetworkInitiatedSessionsJson [][]byte 236 | pendingNetworkInitiatedSessions, err := om.GetPendingNetworkInitiatedSessions() 237 | if err != nil { 238 | return nil, err 239 | } 240 | for _, x := range pendingNetworkInitiatedSessions { 241 | tmpB, err := x.MarshalJSON() 242 | if err != nil { 243 | return nil, err 244 | } 245 | pendingNetworkInitiatedSessionsJson = append(pendingNetworkInitiatedSessionsJson, tmpB) 246 | } 247 | sessionType, err := om.GetSessionType() 248 | if err != nil { 249 | return nil, err 250 | } 251 | sessionState, err := om.GetSessionState() 252 | if err != nil { 253 | return nil, err 254 | } 255 | return json.Marshal(map[string]interface{}{ 256 | "Features": features, 257 | "PendingNetworkInitiatedSessions": pendingNetworkInitiatedSessionsJson, 258 | "SessionType": sessionType, 259 | "SessionState": sessionState}) 260 | } 261 | -------------------------------------------------------------------------------- /ModemSignal.go: -------------------------------------------------------------------------------- 1 | package modemmanager 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | "github.com/godbus/dbus/v5" 7 | "reflect" 8 | ) 9 | 10 | // Paths of methods and properties 11 | const ( 12 | ModemSignalInterface = ModemInterface + ".Signal" 13 | 14 | /* Methods */ 15 | ModemSignalSetup = ModemSignalInterface + ".Setup" 16 | /* Property */ 17 | ModemSignalPropertyRate = ModemSignalInterface + ".Rate" 18 | ModemSignalPropertyCdma = ModemSignalInterface + ".Cdma" 19 | ModemSignalPropertyEvdo = ModemSignalInterface + ".Evdo" 20 | ModemSignalPropertyGsm = ModemSignalInterface + ".Gsm" 21 | ModemSignalPropertyUmts = ModemSignalInterface + ".Umts" 22 | ModemSignalPropertyLte = ModemSignalInterface + ".Lte" 23 | ) 24 | 25 | // ModemSignal provides access to extended signal quality information. 26 | // This interface will only be available once the modem is ready to be registered in the cellular network. 27 | // 3GPP devices will require a valid unlocked SIM card before any of the features in the interface can be used. 28 | type ModemSignal interface { 29 | /* METHODS */ 30 | 31 | // Returns object path 32 | GetObjectPath() dbus.ObjectPath 33 | 34 | MarshalJSON() ([]byte, error) 35 | 36 | // Setup extended signal quality information retrieval. 37 | // refresh rate to set, in seconds. 0 to disable retrieval. 38 | Setup(rate uint32) error 39 | 40 | /* PROPERTIES */ 41 | //Refresh rate for the extended signal quality information updates, in seconds. A value of 0 disables the retrieval of the values. 42 | GetRate() (rate uint32, err error) 43 | 44 | // Returns all available cmda,evdo, gsm,umts or lte signal properties objects where rssi is set 45 | GetCurrentSignals() (sp []SignalProperty, err error) 46 | 47 | // The CDMA1x access technology. 48 | GetCdma() (SignalProperty, error) 49 | 50 | // The CDMA EV-DO access technology. 51 | GetEvdo() (SignalProperty, error) 52 | 53 | // The GSM/GPRS access technology. 54 | GetGsm() (SignalProperty, error) 55 | 56 | // The UMTS (WCDMA) access technology. 57 | GetUmts() (SignalProperty, error) 58 | 59 | // The LTE access technology. 60 | GetLte() (SignalProperty, error) 61 | } 62 | 63 | // NewModemSignal returns new ModemSignal Interface 64 | func NewModemSignal(objectPath dbus.ObjectPath) (ModemSignal, error) { 65 | var si modemSignal 66 | return &si, si.init(ModemManagerInterface, objectPath) 67 | } 68 | 69 | type modemSignal struct { 70 | dbusBase 71 | } 72 | 73 | // SignalProperty represents all available signal properties 74 | type SignalProperty struct { 75 | Type MMSignalPropertyType `json:"property-type"` // define the Signal Property Type 76 | Rssi float64 `json:"rssi"` // The CDMA1x / CDMA EV-DO / GSM / UMTS / LTE RSSI (Received Signal Strength Indication), in dBm, given as a floating point value (Applicable for all types). 77 | Ecio float64 `json:"ecio"` // The CDMA1x Ec/Io / CDMA EV-DO Ec/Io / UMTS Ec/Io level in dBm, given as a floating point value (Only applicable for type Cdma, Evdo, Umts). 78 | Sinr float64 `json:"sinr"` // CDMA EV-DO SINR level, in dB, given as a floating point value (Only applicable for type Evdo). 79 | Io float64 `json:"io"` // The CDMA EV-DO Io, in dBm, given as a floating point value (Only applicable for type Evdo). 80 | Rscp float64 `json:"rscp"` // The UMTS RSCP (Received Signal Code Power), in dBm, given as a floating point value (Only applicable for type Umts). 81 | Rsrq float64 `json:"rsrq"` // The LTE RSRP (Reference Signal Received Power), in dBm, given as a floating point value (Only applicable for type LTE). 82 | Rsrp float64 `json:"rsrp"` // The LTE RSRP (Reference Signal Received Power), in dBm, given as a floating point value (Only applicable for type LTE). 83 | Snr float64 `json:"snr"` // The LTE S/R ratio, in dB, given as a floating point value (Only applicable for type LTE). 84 | } 85 | 86 | // MarshalJSON returns a byte array 87 | func (sp SignalProperty) MarshalJSON() ([]byte, error) { 88 | return json.Marshal(map[string]interface{}{ 89 | "Type": fmt.Sprint(sp.Type), 90 | "Rssi": sp.Rssi, 91 | "Ecio": sp.Ecio, 92 | "Sinr": sp.Sinr, 93 | "Io": sp.Io, 94 | "Rscp": sp.Rscp, 95 | "Rsrq": sp.Rsrq, 96 | "Rsrp": sp.Rsrp, 97 | "Snr": sp.Snr, 98 | }) 99 | } 100 | 101 | func (sp SignalProperty) String() string { 102 | return "Type: " + fmt.Sprint(sp.Type) + 103 | ", Rssi: " + fmt.Sprint(sp.Rssi) + 104 | ", Ecio: " + fmt.Sprint(sp.Ecio) + 105 | ", Sinr: " + fmt.Sprint(sp.Sinr) + 106 | ", Io: " + fmt.Sprint(sp.Io) + 107 | ", Rscp: " + fmt.Sprint(sp.Rscp) + 108 | ", Rsrq: " + fmt.Sprint(sp.Rsrq) + 109 | ", Rsrp: " + fmt.Sprint(sp.Rsrp) + 110 | ", Snr: " + fmt.Sprint(sp.Snr) 111 | } 112 | func convertMapToSignalProperty(inputMap map[string]dbus.Variant, signalType MMSignalPropertyType) (sp SignalProperty) { 113 | sp.Type = signalType 114 | for key, element := range inputMap { 115 | switch key { 116 | case "rssi": 117 | tmpValue, ok := element.Value().(float64) 118 | if ok { 119 | sp.Rssi = tmpValue 120 | } 121 | 122 | case "sinr": 123 | tmpValue, ok := element.Value().(float64) 124 | if ok { 125 | sp.Sinr = tmpValue 126 | } 127 | 128 | case "ecio": 129 | tmpValue, ok := element.Value().(float64) 130 | if ok { 131 | sp.Ecio = tmpValue 132 | } 133 | 134 | case "io": 135 | tmpValue, ok := element.Value().(float64) 136 | if ok { 137 | sp.Io = tmpValue 138 | } 139 | 140 | case "rscp": 141 | tmpValue, ok := element.Value().(float64) 142 | if ok { 143 | sp.Rscp = tmpValue 144 | } 145 | 146 | case "rsrq": 147 | tmpValue, ok := element.Value().(float64) 148 | if ok { 149 | 150 | sp.Rsrq = tmpValue 151 | } 152 | 153 | case "rsrp": 154 | tmpValue, ok := element.Value().(float64) 155 | if ok { 156 | sp.Rsrp = tmpValue 157 | } 158 | 159 | case "snr": 160 | tmpValue, ok := element.Value().(float64) 161 | if ok { 162 | sp.Snr = tmpValue 163 | } 164 | 165 | } 166 | } 167 | return 168 | } 169 | 170 | func (si modemSignal) GetObjectPath() dbus.ObjectPath { 171 | return si.obj.Path() 172 | } 173 | 174 | func (si modemSignal) Setup(rate uint32) error { 175 | return si.call(ModemSignalSetup, &rate) 176 | } 177 | 178 | func (si modemSignal) GetRate() (rate uint32, err error) { 179 | return si.getUint32Property(ModemSignalPropertyRate) 180 | } 181 | 182 | func (si modemSignal) GetCdma() (sp SignalProperty, err error) { 183 | res, err := si.getMapStringVariantProperty(ModemSignalPropertyCdma) 184 | if err != nil { 185 | return 186 | } 187 | sp = convertMapToSignalProperty(res, MMSignalPropertyTypeCdma) 188 | return 189 | } 190 | 191 | func (si modemSignal) GetEvdo() (sp SignalProperty, err error) { 192 | res, err := si.getMapStringVariantProperty(ModemSignalPropertyEvdo) 193 | if err != nil { 194 | return 195 | } 196 | sp = convertMapToSignalProperty(res, MMSignalPropertyTypeEvdo) 197 | return 198 | } 199 | 200 | func (si modemSignal) GetGsm() (sp SignalProperty, err error) { 201 | res, err := si.getMapStringVariantProperty(ModemSignalPropertyGsm) 202 | if err != nil { 203 | return 204 | } 205 | sp = convertMapToSignalProperty(res, MMSignalPropertyTypeGsm) 206 | return 207 | } 208 | 209 | func (si modemSignal) GetUmts() (sp SignalProperty, err error) { 210 | res, err := si.getMapStringVariantProperty(ModemSignalPropertyUmts) 211 | if err != nil { 212 | return 213 | } 214 | sp = convertMapToSignalProperty(res, MMSignalPropertyTypeUmts) 215 | return 216 | } 217 | 218 | func (si modemSignal) GetLte() (sp SignalProperty, err error) { 219 | res, err := si.getMapStringVariantProperty(ModemSignalPropertyLte) 220 | if err != nil { 221 | return 222 | } 223 | 224 | sp = convertMapToSignalProperty(res, MMSignalPropertyTypeLte) 225 | return 226 | } 227 | func (si modemSignal) isRssiSet(sp SignalProperty) bool { 228 | v := reflect.ValueOf(sp) 229 | st := reflect.TypeOf(sp) 230 | for i := 0; i < v.NumField(); i++ { 231 | field := st.Field(i) 232 | tag := field.Tag.Get("json") 233 | if tag == "rssi" { 234 | if !v.Field(i).IsZero() { 235 | return true 236 | } 237 | } 238 | } 239 | return false 240 | 241 | } 242 | func (si modemSignal) GetCurrentSignals() (sp []SignalProperty, err error) { 243 | mSignalCdma, err := si.GetCdma() 244 | if err != nil { 245 | return sp, err 246 | } 247 | if si.isRssiSet(mSignalCdma) { 248 | sp = append(sp, mSignalCdma) 249 | } 250 | 251 | mSignalEvdo, err := si.GetEvdo() 252 | if err != nil { 253 | return sp, err 254 | } 255 | if si.isRssiSet(mSignalEvdo) { 256 | sp = append(sp, mSignalEvdo) 257 | } 258 | 259 | mSignalGsm, err := si.GetGsm() 260 | if err != nil { 261 | return sp, err 262 | } 263 | if si.isRssiSet(mSignalGsm) { 264 | sp = append(sp, mSignalGsm) 265 | } 266 | 267 | mSignalUmts, err := si.GetUmts() 268 | if err != nil { 269 | return sp, err 270 | } 271 | if si.isRssiSet(mSignalUmts) { 272 | sp = append(sp, mSignalUmts) 273 | } 274 | 275 | mSignalLte, err := si.GetLte() 276 | if err != nil { 277 | return sp, err 278 | } 279 | if si.isRssiSet(mSignalLte) { 280 | sp = append(sp, mSignalLte) 281 | } 282 | return 283 | 284 | } 285 | 286 | func (si modemSignal) MarshalJSON() ([]byte, error) { 287 | rate, err := si.GetRate() 288 | if err != nil { 289 | return nil, err 290 | } 291 | var currentSignalsJson [][]byte 292 | currentSignals, err := si.GetCurrentSignals() 293 | if err != nil { 294 | return nil, err 295 | } 296 | for _, x := range currentSignals { 297 | tmpB, err := x.MarshalJSON() 298 | if err != nil { 299 | return nil, err 300 | } 301 | currentSignalsJson = append(currentSignalsJson, tmpB) 302 | } 303 | return json.Marshal(map[string]interface{}{ 304 | "Rate": rate, 305 | "CurrentSignals": currentSignalsJson, 306 | }) 307 | } 308 | -------------------------------------------------------------------------------- /ModemSimple.go: -------------------------------------------------------------------------------- 1 | package modemmanager 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | "github.com/godbus/dbus/v5" 7 | "reflect" 8 | ) 9 | 10 | // Paths of methods and properties 11 | const ( 12 | ModemSimpleInterface = ModemInterface + ".Simple" 13 | 14 | /* Methods */ 15 | ModemSimpleConnect = ModemSimpleInterface + ".Connect" 16 | ModemSimpleDisconnect = ModemSimpleInterface + ".Disconnect" 17 | ModemSimpleGetStatus = ModemSimpleInterface + ".GetStatus" 18 | /* Property */ 19 | 20 | ) 21 | 22 | // The ModemSimple interface allows controlling and querying the status of Modems. 23 | // This interface will only be available once the modem is ready to be registered in the 24 | // cellular network. 3GPP devices will require a valid unlocked SIM card before any of the 25 | // features in the interface can be used. 26 | type ModemSimple interface { 27 | /* METHODS */ 28 | 29 | // Returns object path 30 | GetObjectPath() dbus.ObjectPath 31 | 32 | // Do everything needed to connect the modem using the given properties. 33 | //This method will attempt to find a matching packet data bearer and activate it if necessary, 34 | //returning the bearer's IP details. If no matching bearer is found, a new bearer will be created and activated, but this operation may fail if no resources are available to complete this connection attempt (ie, if a conflicting bearer is already active). 35 | //This call may make a large number of changes to modem configuration based on properties passed in. 36 | //For example, given a PIN-locked, disabled GSM/UMTS modem, this call may unlock the SIM PIN, alter the 37 | //access technology preference, wait for network registration (or force registration to a specific provider), 38 | //create a new packet data bearer using the given "apn", and connect that bearer. 39 | Connect(properties SimpleProperties) (Bearer, error) 40 | 41 | // Disconnect an active packet data connection. while if "/" (ie, no object given) this method will disconnect all active packet data bearers. 42 | Disconnect(bearer Bearer) error 43 | 44 | // Get the general modem status. 45 | GetStatus() (SimpleStatus, error) 46 | } 47 | 48 | // SimpleProperties defines all available properties 49 | type SimpleProperties struct { 50 | Pin string `json:"pin"` // SIM-PIN unlock code, given as a string value (signature "s"). 51 | OperatorId string `json:"operator-id"` // ETSI MCC-MNC of a network to force registration with, given as a string value (signature "s"). 52 | Apn string `json:"apn"` // For GSM/UMTS and LTE devices the APN to use, given as a string value (signature "s"). 53 | IpType MMBearerIpFamily `json:"ip-type"` // For GSM/UMTS and LTE devices the IP addressing type to use, given as a MMBearerIpFamily value (signature "u"). 54 | AllowedAuth MMBearerAllowedAuth `json:"allowed-auth"` // The authentication method to use, given as a MMBearerAllowedAuth value (signature "u"). Optional in 3GPP. 55 | User string `json:"user"` // User name (if any) required by the network, given as a string value (signature "s"). Optional in 3GPP. 56 | Password string `json:"password"` // Password (if any) required by the network, given as a string value (signature "s"). Optional in 3GPP. 57 | Number string `json:"number"` // For POTS devices the number to dial,, given as a string value (signature "s"). 58 | AllowedRoaming bool `json:"allow-roaming"` // FALSE to allow only connections to home networks, given as a boolean value (signature "b"). 59 | RmProtocol MMModemCdmaRmProtocol `json:"rm-protocol"` // For CDMA devices, the protocol of the Rm interface, given as a MMModemCdmaRmProtocol value (signature "u"). 60 | 61 | } 62 | 63 | // MarshalJSON returns a byte array 64 | func (sp SimpleProperties) MarshalJSON() ([]byte, error) { 65 | return json.Marshal(map[string]interface{}{ 66 | "Pin": sp.Pin, 67 | "OperatorId": sp.OperatorId, 68 | "Apn": sp.Apn, 69 | "IpType": fmt.Sprint(sp.IpType), 70 | "AllowedAuth": fmt.Sprint(sp.AllowedAuth), 71 | "User": sp.User, 72 | "Password": sp.Password, 73 | "Number": sp.Number, 74 | "AllowedRoaming": sp.AllowedRoaming, 75 | "RmProtocol": fmt.Sprint(sp.RmProtocol)}) 76 | } 77 | 78 | func (sp SimpleProperties) String() string { 79 | return returnString(sp) 80 | } 81 | 82 | // SimpleStatus represents all properties of the current connection state 83 | type SimpleStatus struct { 84 | State MMModemState `json:"state"` // A MMModemState value specifying the overall state of the modem, given as an unsigned integer value (signature "u") 85 | SignalQuality uint32 `json:"signal-quality"` // Signal quality value, given only when registered, as an unsigned integer value (signature "u"). 86 | CurrentBands []MMModemBand `json:"current-bands"` // List of MMModemBand values, given only when registered, as a list of unsigned integer values (signature "au"). 87 | AccessTechnology MMModemAccessTechnology `json:"access-technologies"` // A MMModemAccessTechnology value, given only when registered, as an unsigned integer value (signature "u"). 88 | M3GppRegistrationState MMModem3gppRegistrationState `json:"m3gpp-registration-state"` // A MMModem3gppRegistrationState value specifying the state of the registration, given only when registered in a 3GPP network, as an unsigned integer value (signature "u"). 89 | M3GppOperatorCode string `json:"m3gpp-operator-code"` // Operator MCC-MNC, given only when registered in a 3GPP network, as a string value (signature "s"). 90 | M3GppOperatorName string `json:"m3gpp-operator-name"` // Operator name, given only when registered in a 3GPP network, as a string value (signature "s"). 91 | CdmaCdma1xRegistrationState MMModemCdmaRegistrationState `json:"cdma-cdma1x-registration-state"` // A MMModemCdmaRegistrationState value specifying the state of the registration, given only when registered in a CDMA1x network, as an unsigned integer value (signature "u"). 92 | CdmaEvdoRegistrationState MMModemCdmaRegistrationState `json:"cdma-evdo-registration-state"` // A MMModemCdmaRegistrationState value specifying the state of the registration, given only when registered in a EV-DO network, as an unsigned integer value (signature "u"). 93 | CdmaSid uint32 `json:"cdma-sid"` // The System Identifier of the serving network, if registered in a CDMA1x network and if known. Given as an unsigned integer value (signature "u"). 94 | CdmaNid uint32 `json:"cdma-nid"` // The Network Identifier of the serving network, if registered in a CDMA1x network and if known. Given as an unsigned integer value (signature "u"). 95 | } 96 | 97 | func (ss SimpleStatus) String() string { 98 | return returnString(ss) 99 | } 100 | 101 | // MarshalJSON returns a byte array 102 | func (ss SimpleStatus) MarshalJSON() ([]byte, error) { 103 | return json.Marshal(map[string]interface{}{ 104 | "State": fmt.Sprint(ss.State), 105 | "SignalQuality": ss.SignalQuality, 106 | "CurrentBands": fmt.Sprint(ss.CurrentBands), 107 | "AccessTechnology": fmt.Sprint(ss.AccessTechnology), 108 | "M3GppRegistrationState": fmt.Sprint(ss.M3GppRegistrationState), 109 | "M3GppOperatorCode": ss.M3GppOperatorCode, 110 | "M3GppOperatorName": ss.M3GppOperatorName, 111 | "CdmaCdma1xRegistrationState": fmt.Sprint(ss.CdmaCdma1xRegistrationState), 112 | "CdmaEvdoRegistrationState": fmt.Sprint(ss.CdmaEvdoRegistrationState), 113 | "CdmaSid": ss.CdmaSid, 114 | "CdmaNid": ss.CdmaNid, 115 | }) 116 | } 117 | 118 | // NewModemSimple returns new ModemSimple Interface 119 | func NewModemSimple(objectPath dbus.ObjectPath) (ModemSimple, error) { 120 | var ms modemSimple 121 | return &ms, ms.init(ModemManagerInterface, objectPath) 122 | } 123 | 124 | type modemSimple struct { 125 | dbusBase 126 | } 127 | 128 | func (ms modemSimple) Connect(properties SimpleProperties) (Bearer, error) { 129 | v := reflect.ValueOf(properties) 130 | st := reflect.TypeOf(properties) 131 | type dynMap interface{} 132 | var myMap map[string]dynMap 133 | myMap = make(map[string]dynMap) 134 | for i := 0; i < v.NumField(); i++ { 135 | field := st.Field(i) 136 | tag := field.Tag.Get("json") 137 | value := v.Field(i).Interface() 138 | if v.Field(i).IsZero() { 139 | continue 140 | } 141 | myMap[tag] = value 142 | } 143 | var path dbus.ObjectPath 144 | err := ms.callWithReturn(&path, ModemSimpleConnect, &myMap) 145 | if err != nil { 146 | return nil, err 147 | } 148 | return NewBearer(path) 149 | } 150 | 151 | func (ms modemSimple) Disconnect(bearer Bearer) error { 152 | return ms.call(ModemSimpleDisconnect, bearer.GetObjectPath()) 153 | } 154 | 155 | func (ms modemSimple) GetStatus() (status SimpleStatus, err error) { 156 | type dynMap interface{} 157 | var myMap map[string]dynMap 158 | myMap = make(map[string]dynMap) 159 | err = ms.callWithReturn(&myMap, ModemSimpleGetStatus) 160 | if err != nil { 161 | return status, err 162 | } 163 | for key, element := range myMap { 164 | switch key { 165 | case "state": 166 | tmpState, ok := element.(uint32) 167 | if ok { 168 | status.State = MMModemState(tmpState) 169 | } 170 | 171 | case "signal-quality": 172 | tmpSignalPair, ok := element.([]interface{}) 173 | if ok { 174 | for idx := range tmpSignalPair { 175 | if idx == 0 { 176 | status.SignalQuality, _ = tmpSignalPair[idx].(uint32) 177 | } 178 | } 179 | } 180 | 181 | case "current-bands": 182 | var bands []MMModemBand 183 | tmpBands, ok := element.([]uint32) 184 | if ok { 185 | for idx := range tmpBands { 186 | bands = append(bands, MMModemBand(tmpBands[idx])) 187 | } 188 | status.CurrentBands = bands 189 | } 190 | // typo in dbus docs 191 | case "access-technologies": 192 | tmpValue, ok := element.(uint32) 193 | if ok { 194 | status.AccessTechnology = MMModemAccessTechnology(tmpValue) 195 | 196 | } 197 | 198 | case "m3gpp-registration-state": 199 | tmpValue, ok := element.(uint32) 200 | if ok { 201 | status.M3GppRegistrationState = MMModem3gppRegistrationState(tmpValue) 202 | } 203 | case "m3gpp-operator-code": 204 | tmpValue, ok := element.(string) 205 | if ok { 206 | status.M3GppOperatorCode = tmpValue 207 | } 208 | case "m3gpp-operator-name": 209 | tmpValue, ok := element.(string) 210 | if ok { 211 | status.M3GppOperatorName = tmpValue 212 | } 213 | case "cdma-cdma1x-registration-state": 214 | tmpValue, ok := element.(uint32) 215 | if ok { 216 | status.CdmaCdma1xRegistrationState = MMModemCdmaRegistrationState(tmpValue) 217 | } 218 | case "cdma-evdo-registration-state": 219 | tmpValue, ok := element.(uint32) 220 | if ok { 221 | status.CdmaEvdoRegistrationState = MMModemCdmaRegistrationState(tmpValue) 222 | } 223 | case "cdma-sid": 224 | tmpValue, ok := element.(uint32) 225 | if ok { 226 | status.CdmaSid = tmpValue 227 | } 228 | case "cdma-nid": 229 | tmpValue, ok := element.(uint32) 230 | if ok { 231 | status.CdmaNid = tmpValue 232 | } 233 | } 234 | } 235 | return status, nil 236 | 237 | } 238 | 239 | func (ms modemSimple) GetObjectPath() dbus.ObjectPath { 240 | return ms.obj.Path() 241 | } 242 | -------------------------------------------------------------------------------- /ModemTime.go: -------------------------------------------------------------------------------- 1 | package modemmanager 2 | 3 | import ( 4 | "encoding/json" 5 | "errors" 6 | "fmt" 7 | "github.com/godbus/dbus/v5" 8 | "time" 9 | ) 10 | 11 | // Paths of methods and properties of ModemTime 12 | const ( 13 | ModemTimeInterface = ModemInterface + ".Time" 14 | 15 | /* Methods */ 16 | ModemTimeGetNetworkTime = ModemTimeInterface + ".GetNetworkTime" 17 | 18 | /* Property */ 19 | ModemTimePropertyNetworkTimezone = ModemTimeInterface + ".NetworkTimezone" // readable a{sv} 20 | 21 | /* Signal */ 22 | ModemTimeSignalNetworkTimeChanged = "NetworkTimeChanged" 23 | ) 24 | 25 | // ModemTime interface allows clients to receive network time and timezone updates broadcast by mobile networks. 26 | // This interface will only be available once the modem is ready to be registered in the cellular network. 27 | // 3GPP devices will require a valid unlocked SIM card before any of the features in the interface can be used. 28 | type ModemTime interface { 29 | /* METHODS */ 30 | 31 | // get object path 32 | GetObjectPath() dbus.ObjectPath 33 | 34 | // time, and (if available) UTC offset in ISO 8601 format. If the network time is unknown, the empty string. 35 | // Gets the current network time in local time. 36 | // This method will only work if the modem tracks, or can request, the current network time; it will not attempt to use previously-received network time updates on the host to guess the current network time. 37 | // OUT s time: If the network time is known, a string containing local date, 38 | GetNetworkTime() (time.Time, error) 39 | 40 | MarshalJSON() ([]byte, error) 41 | 42 | /* PROPERTIES */ 43 | // The timezone data provided by the network. 44 | GetNetworkTimezone() (ModemTimeZone, error) 45 | 46 | /* SIGNALS */ 47 | // Sent when the network time is updated. 48 | // s time: A string containing date and time in ISO 8601 format. 49 | SubscribeNetworkTimeChanged() <-chan *dbus.Signal 50 | 51 | ParseNetworkTimeChanged(v *dbus.Signal) (networkTime time.Time, err error) 52 | 53 | Unsubscribe() 54 | } 55 | 56 | // NewModemTime returns new ModemTime Interface 57 | func NewModemTime(objectPath dbus.ObjectPath) (ModemTime, error) { 58 | var ti modemTime 59 | return &ti, ti.init(ModemManagerInterface, objectPath) 60 | } 61 | 62 | type modemTime struct { 63 | dbusBase 64 | sigChan chan *dbus.Signal 65 | } 66 | 67 | // Represents the TimeZone of the Modem 68 | type ModemTimeZone struct { 69 | Offset int32 `json:"offset"` // Offset of the timezone from UTC, in minutes (including DST, if applicable), given as a signed integer value (signature "i"). 70 | DstOffset int32 `json:"dst-offset"` // Amount of offset that is due to DST (daylight saving time), given as a signed integer value (signature "i"). 71 | LeapSeconds int32 `json:"leap-seconds"` // Number of leap seconds included in the network time, given as a signed integer value (signature "i"). 72 | } 73 | 74 | // MarshalJSON returns a byte array 75 | func (mtz ModemTimeZone) MarshalJSON() ([]byte, error) { 76 | return json.Marshal(map[string]interface{}{ 77 | "Offset": mtz.Offset, 78 | "DstOffset": mtz.DstOffset, 79 | "LeapSeconds": mtz.LeapSeconds, 80 | }) 81 | } 82 | 83 | func (mtz ModemTimeZone) String() string { 84 | return "Offset: " + fmt.Sprint(mtz.Offset) + 85 | ", DstOffset: " + fmt.Sprint(mtz.DstOffset) + 86 | ", LeapSeconds: " + fmt.Sprint(mtz.LeapSeconds) 87 | } 88 | 89 | func (ti modemTime) GetObjectPath() dbus.ObjectPath { 90 | return ti.obj.Path() 91 | } 92 | 93 | func (ti modemTime) GetNetworkTime() (time.Time, error) { 94 | var tmpTime string 95 | err := ti.callWithReturn(&tmpTime, ModemTimeGetNetworkTime) 96 | if err != nil { 97 | return time.Now(), err 98 | } 99 | t, err := time.Parse(time.RFC3339Nano, tmpTime) 100 | if err != nil { 101 | return time.Now(), err 102 | } 103 | return t, err 104 | } 105 | 106 | func (ti modemTime) GetNetworkTimezone() (mTz ModemTimeZone, err error) { 107 | tmpMap, err := ti.getMapStringVariantProperty(ModemTimePropertyNetworkTimezone) 108 | if err != nil { 109 | return mTz, err 110 | } 111 | for key, element := range tmpMap { 112 | switch key { 113 | case "offset": 114 | tmpValue, ok := element.Value().(int32) 115 | if ok { 116 | mTz.Offset = tmpValue 117 | } 118 | case "dst-offset": 119 | tmpValue, ok := element.Value().(int32) 120 | if ok { 121 | mTz.DstOffset = tmpValue 122 | } 123 | case "leap-seconds": 124 | tmpValue, ok := element.Value().(int32) 125 | if ok { 126 | mTz.LeapSeconds = tmpValue 127 | } 128 | } 129 | } 130 | return 131 | } 132 | 133 | func (ti modemTime) SubscribeNetworkTimeChanged() <-chan *dbus.Signal { 134 | if ti.sigChan != nil { 135 | return ti.sigChan 136 | } 137 | rule := fmt.Sprintf("type='signal', member='%s',path_namespace='%s'", ModemTimeSignalNetworkTimeChanged, fmt.Sprint(ti.GetObjectPath())) 138 | ti.conn.BusObject().Call(dbusMethodAddMatch, 0, rule) 139 | ti.sigChan = make(chan *dbus.Signal, 10) 140 | ti.conn.Signal(ti.sigChan) 141 | return ti.sigChan 142 | } 143 | 144 | func (ti modemTime) ParseNetworkTimeChanged(v *dbus.Signal) (networkTime time.Time, err error) { 145 | // todo: untested 146 | if len(v.Body) != 1 { 147 | err = errors.New("error by parsing network time changed signal") 148 | return 149 | } 150 | tmpTime, ok := v.Body[0].(string) 151 | if !ok { 152 | err = errors.New("error by parsing time string") 153 | return 154 | } 155 | return time.Parse(time.RFC3339Nano, tmpTime) 156 | } 157 | 158 | func (ti modemTime) Unsubscribe() { 159 | ti.conn.RemoveSignal(ti.sigChan) 160 | ti.sigChan = nil 161 | } 162 | 163 | func (ti modemTime) MarshalJSON() ([]byte, error) { 164 | networkTimezone, err := ti.GetNetworkTimezone() 165 | if err != nil { 166 | return nil, err 167 | } 168 | networkTimezoneJson, err := networkTimezone.MarshalJSON() 169 | if err != nil { 170 | return nil, err 171 | } 172 | return json.Marshal(map[string]interface{}{ 173 | "NetworkTimezone": networkTimezoneJson, 174 | }) 175 | } 176 | -------------------------------------------------------------------------------- /ModemUssd.go: -------------------------------------------------------------------------------- 1 | package modemmanager 2 | 3 | import ( 4 | "encoding/json" 5 | "github.com/godbus/dbus/v5" 6 | ) 7 | 8 | // Paths of methods and properties 9 | const ( 10 | Modem3gppUssdInterface = Modem3gppInterface + ".Ussd" 11 | 12 | /* Methods */ 13 | Modem3gppUssdInitiate = Modem3gppUssdInterface + ".Initiate" 14 | Modem3gppUssdRespond = Modem3gppUssdInterface + ".Respond" 15 | Modem3gppUssdCancel = Modem3gppUssdInterface + ".Cancel" 16 | /* Property */ 17 | Modem3gppUssdPropertyState = Modem3gppUssdInterface + ".State" // readable u 18 | Modem3gppUssdPropertyNetworkNotification = Modem3gppUssdInterface + ".NetworkNotification" // readable s 19 | Modem3gppUssdProperty = Modem3gppUssdInterface + ".NetworkRequest" // readable s 20 | ) 21 | 22 | // The Ussd interface provides access to actions based on the USSD protocol. 23 | // This interface will only be available once the modem is ready to be registered in the 24 | // cellular network. 3GPP devices will require a valid unlocked SIM card before any of the features 25 | // in the interface can be used. 26 | // Todo: Untested, USSD via QMI not available: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/26 27 | type Ussd interface { 28 | /* METHODS */ 29 | 30 | // Returns object path 31 | GetObjectPath() dbus.ObjectPath 32 | // Sends a USSD command string to the network initiating a USSD session. 33 | // When the request is handled by the network, the method returns the response or an appropriate error. The network may be awaiting further response from the ME after returning from this method and no new command can be initiated until this one is cancelled or ended. 34 | // IN s command: The command to start the USSD session with. 35 | // OUT s reply:The network response to the command which started the USSD session. 36 | Initiate(command string) (reply string, err error) 37 | 38 | // Respond to a USSD request that is either initiated by the mobile network, or that is awaiting 39 | // further input after Initiate() was called. 40 | // IN s response: 41 | // The response to network-initiated USSD command, or a response to a request for further input. 42 | // OUT s reply: 43 | // The network reply to this response to the network-initiated USSD command. The reply may require 44 | // further responses. 45 | Respond(response string) (reply string, err error) 46 | 47 | // Cancel an ongoing USSD session, either mobile or network initiated. 48 | Cancel() error 49 | 50 | MarshalJSON() ([]byte, error) 51 | 52 | /* PROPERTIES */ 53 | 54 | // A MMModem3gppUssdSessionState value, indicating the state of any ongoing USSD session. 55 | GetState() (MMModem3gppUssdSessionState, error) 56 | 57 | // Contains any network-initiated request to which no USSD response is required. 58 | // When no USSD session is active, or when there is no network- initiated request, this property will be a zero-length string. 59 | GetNetworkNotification() (string, error) 60 | 61 | // Contains any pending network-initiated request for a response. Client should call Respond() with the 62 | // appropriate response to this request. 63 | // When no USSD session is active, or when there is no pending network-initiated request, this property will be 64 | // a zero-length string. 65 | GetNetworkRequest() (string, error) 66 | } 67 | 68 | // NewUssd returns new ModemUssd Interface 69 | func NewUssd(objectPath dbus.ObjectPath) (Ussd, error) { 70 | var mu ussd 71 | return &mu, mu.init(ModemManagerInterface, objectPath) 72 | } 73 | 74 | type ussd struct { 75 | dbusBase 76 | } 77 | 78 | func (mu ussd) GetObjectPath() dbus.ObjectPath { 79 | return mu.obj.Path() 80 | } 81 | 82 | func (mu ussd) Initiate(command string) (reply string, err error) { 83 | err = mu.callWithReturn(&reply, Modem3gppUssdInitiate, command) 84 | return 85 | } 86 | 87 | func (mu ussd) Respond(response string) (reply string, err error) { 88 | err = mu.callWithReturn(&reply, Modem3gppUssdRespond, response) 89 | return 90 | } 91 | 92 | func (mu ussd) Cancel() error { 93 | return mu.call(Modem3gppUssdCancel) 94 | } 95 | 96 | func (mu ussd) GetState() (MMModem3gppUssdSessionState, error) { 97 | res, err := mu.getUint32Property(Modem3gppUssdPropertyState) 98 | if err != nil { 99 | return MmModem3gppUssdSessionStateUnknown, err 100 | } 101 | return MMModem3gppUssdSessionState(res), nil 102 | } 103 | 104 | func (mu ussd) GetNetworkNotification() (string, error) { 105 | return mu.getStringProperty(Modem3gppUssdPropertyNetworkNotification) 106 | } 107 | 108 | func (mu ussd) GetNetworkRequest() (string, error) { 109 | return mu.getStringProperty(Modem3gppUssdProperty) 110 | } 111 | 112 | func (mu ussd) MarshalJSON() ([]byte, error) { 113 | state, err := mu.GetState() 114 | if err != nil { 115 | return nil, err 116 | } 117 | networkNotification, err := mu.GetNetworkNotification() 118 | if err != nil { 119 | return nil, err 120 | } 121 | networkRequest, err := mu.GetNetworkRequest() 122 | if err != nil { 123 | return nil, err 124 | } 125 | return json.Marshal(map[string]interface{}{ 126 | "State": state, 127 | "NetworkNotification": networkNotification, 128 | "NetworkRequest": networkRequest, 129 | }) 130 | } 131 | -------------------------------------------------------------------------------- /ModemVoice.go: -------------------------------------------------------------------------------- 1 | package modemmanager 2 | 3 | import ( 4 | "encoding/json" 5 | "errors" 6 | "fmt" 7 | "strings" 8 | 9 | "github.com/godbus/dbus/v5" 10 | ) 11 | 12 | // Paths of methods and properties of ModemVoice 13 | const ( 14 | ModemVoiceInterface = ModemInterface + ".Voice" 15 | ModemVoiceObjectPath = ModemManagerObjectPath + "/Voice" 16 | /* Methods */ 17 | ModemVoiceListCalls = ModemVoiceInterface + ".ListCalls" 18 | ModemVoiceDeleteCall = ModemVoiceInterface + ".DeleteCall" 19 | ModemVoiceCreateCall = ModemVoiceInterface + ".CreateCall" 20 | 21 | ModemVoiceHoldAndAccept = ModemVoiceInterface + ".HoldAndAccept" 22 | ModemVoiceHangupAndAccept = ModemVoiceInterface + ".HangupAndAccept" 23 | ModemVoiceHangupAll = ModemVoiceInterface + ".HangupAll" 24 | ModemVoiceTransfer = ModemVoiceInterface + ".Transfer" 25 | ModemVoiceCallWaitingSetup = ModemVoiceInterface + ".CallWaitingSetup" 26 | ModemVoiceCallWaitingQuery = ModemVoiceInterface + ".CallWaitingQuery" 27 | 28 | /* Property */ 29 | ModemVoicePropertyCalls = ModemVoiceInterface + ".Calls" 30 | ModemVoicePropertyEmergencyOnly = ModemVoiceInterface + ".EmergencyOnly" 31 | 32 | /* Signal */ 33 | ModemVoiceSignalCallAdded = "CallAdded" 34 | ModemVoiceSignalCallDeleted = "CallDeleted" 35 | ) 36 | 37 | // ModemVoice interface handles Calls. 38 | // This interface will only be available once the modem is ready to be registered in the cellular network. 39 | // 3GPP devices will require a valid unlocked SIM card before any of the features in the interface can be used. 40 | type ModemVoice interface { 41 | /* METHODS */ 42 | // Returns object path 43 | GetObjectPath() dbus.ObjectPath 44 | 45 | // Retrieve all Calls 46 | // This method should only be used once and subsequent information retrieved either by listening for 47 | // the org.freedesktop.ModemManager1.Modem.Voice::Added signal, or by querying the specific Call object of interest. 48 | ListCalls() ([]Call, error) 49 | 50 | // Delete a Call from the list of calls. 51 | // The call will be hangup if it is still active. 52 | DeleteCall(Call) error 53 | 54 | // Creates a new call object for a new outgoing call. 55 | // The 'Number' is the only expected property to set by the user. 56 | CreateCall(number string, optionalParameters ...Pair) (Call, error) 57 | 58 | // Place all active calls on hold, if any, and accept the next call. 59 | // Waiting calls have preference over held calls, so the next call being active will be any waiting call, or otherwise, any held call. 60 | // The user should monitor the state of all available ongoing calls to be reported of which one becomes active. 61 | // No error is returned if there are no waiting or held calls. 62 | HoldAndAccept() error 63 | 64 | // Hangup all active calls, if any, and accept the next call. 65 | // Waiting calls have preference over held calls, so the next call being active will be any waiting call, or otherwise, any held call. 66 | // The user should monitor the state of all available ongoing calls to be reported of which one becomes active. 67 | // No error is returned if there are no waiting or held calls. In this case, this method would be equivalent to calling Hangup() on the active call. 68 | HangupAndAccept() error 69 | 70 | // Hangup all active calls. 71 | // Depending on how the device implements the action, calls on hold or in waiting state may also be terminated. 72 | // No error is returned if there are no ongoing calls. 73 | HangupAll() error 74 | 75 | // Join the currently active and held calls together into a single multiparty call, but disconnects from them. 76 | // The affected calls will be considered terminated from the point of view of the subscriber. 77 | Transfer() error 78 | 79 | // Activates or deactivates the call waiting network service, as per 3GPP TS 22.083. 80 | // This operation requires communication with the network in order to complete, so the modem must be successfully registered. 81 | CallWaitingSetup(enable bool) error 82 | 83 | // Queries the status of the call waiting network service, as per 3GPP TS 22.083. 84 | // This operation requires communication with the network in order to complete, so the modem must be successfully registered. 85 | CallWaitingQuery(status bool) error 86 | 87 | MarshalJSON() ([]byte, error) 88 | 89 | /* PROPERTIES */ 90 | 91 | // The list of calls object paths. 92 | GetCalls() ([]Call, error) 93 | 94 | // A flag indicating whether emergency calls are the only allowed ones. 95 | // If this flag is set, users should only attempt voice calls to emergency numbers, as standard voice calls will likely fail. 96 | GetEmergencyOnly() (bool, error) 97 | 98 | /* SIGNALS */ 99 | 100 | // CallAdded (o path); 101 | // Emitted when a call has been added. 102 | // o path:Object path of the new call. 103 | SubscribeCallAdded() <-chan *dbus.Signal 104 | // CallDeleted (o path); 105 | // Emitted when a call has been deleted. 106 | // o path:Object path of the now deleted Call. 107 | SubscribeCallDeleted() <-chan *dbus.Signal 108 | 109 | ParseCallAdded(v *dbus.Signal) (Call, error) 110 | 111 | Unsubscribe() 112 | } 113 | 114 | // NewModemVoice returns new ModemVoice Interface 115 | func NewModemVoice(objectPath dbus.ObjectPath, modem modem) (ModemVoice, error) { 116 | var vo modemVoice 117 | vo.modem = modem 118 | return &vo, vo.init(ModemManagerInterface, objectPath) 119 | } 120 | 121 | type modemVoice struct { 122 | modem modem 123 | dbusBase 124 | sigChan chan *dbus.Signal 125 | } 126 | 127 | func (m modemVoice) GetObjectPath() dbus.ObjectPath { 128 | return m.obj.Path() 129 | } 130 | 131 | func (m modemVoice) ListCalls() (calls []Call, err error) { 132 | var callPaths []dbus.ObjectPath 133 | err = m.callWithReturn(&callPaths, ModemVoiceListCalls) 134 | if err != nil { 135 | return 136 | } 137 | 138 | for idx := range callPaths { 139 | singleCall, err := NewCall(callPaths[idx]) 140 | if err != nil { 141 | return nil, err 142 | } 143 | calls = append(calls, singleCall) 144 | } 145 | return 146 | } 147 | 148 | func (m modemVoice) DeleteCall(c Call) error { 149 | objPath := c.GetObjectPath() 150 | return m.call(ModemVoiceDeleteCall, &objPath) 151 | } 152 | 153 | func (m modemVoice) CreateCall(number string, optionalParameters ...Pair) (c Call, err error) { 154 | type dynMap interface{} 155 | myMap := make(map[string]dynMap) 156 | myMap["number"] = number 157 | for _, pair := range optionalParameters { 158 | myMap[fmt.Sprint(pair.GetLeft())] = fmt.Sprint(pair.GetRight()) 159 | } 160 | var path dbus.ObjectPath 161 | err = m.callWithReturn(&path, ModemVoiceCreateCall, &myMap) 162 | if err != nil { 163 | return nil, err 164 | } 165 | singleCall, err := NewCall(path) 166 | if err != nil { 167 | return nil, err 168 | } 169 | return singleCall, nil 170 | } 171 | 172 | func (m modemVoice) HoldAndAccept() error { 173 | return m.call(ModemVoiceHoldAndAccept) 174 | } 175 | 176 | func (m modemVoice) HangupAndAccept() error { 177 | return m.call(ModemVoiceHangupAndAccept) 178 | } 179 | 180 | func (m modemVoice) HangupAll() error { 181 | return m.call(ModemVoiceHangupAll) 182 | } 183 | 184 | func (m modemVoice) Transfer() error { 185 | return m.call(ModemVoiceTransfer) 186 | } 187 | 188 | func (m modemVoice) CallWaitingSetup(enable bool) error { 189 | return m.call(ModemVoiceCallWaitingSetup, &enable) 190 | } 191 | 192 | func (m modemVoice) CallWaitingQuery(status bool) error { 193 | return m.call(ModemVoiceCallWaitingQuery, &status) 194 | } 195 | 196 | func (m modemVoice) GetCalls() (c []Call, err error) { 197 | callPaths, err := m.getSliceObjectProperty(ModemVoicePropertyCalls) 198 | if err != nil { 199 | return nil, err 200 | } 201 | for idx := range callPaths { 202 | singleCall, err := NewCall(callPaths[idx]) 203 | if err != nil { 204 | return nil, err 205 | } 206 | c = append(c, singleCall) 207 | } 208 | return 209 | } 210 | 211 | func (m modemVoice) GetEmergencyOnly() (bool, error) { 212 | return m.getBoolProperty(ModemVoicePropertyEmergencyOnly) 213 | } 214 | 215 | func (m modemVoice) SubscribeCallAdded() <-chan *dbus.Signal { 216 | if m.sigChan != nil { 217 | return m.sigChan 218 | } 219 | rule := fmt.Sprintf("type='signal', member='%s',path_namespace='%s'", ModemVoiceSignalCallAdded, fmt.Sprint(m.modem.GetObjectPath())) 220 | m.conn.BusObject().Call(dbusMethodAddMatch, 0, rule) 221 | m.sigChan = make(chan *dbus.Signal, 10) 222 | m.conn.Signal(m.sigChan) 223 | return m.sigChan 224 | } 225 | func (m modemVoice) SubscribeCallDeleted() <-chan *dbus.Signal { 226 | if m.sigChan != nil { 227 | return m.sigChan 228 | } 229 | rule := fmt.Sprintf("type='signal', member='%s',path_namespace='%s'", ModemVoiceSignalCallDeleted, fmt.Sprint(m.modem.GetObjectPath())) 230 | m.conn.BusObject().Call(dbusMethodAddMatch, 0, rule) 231 | m.sigChan = make(chan *dbus.Signal, 10) 232 | m.conn.Signal(m.sigChan) 233 | return m.sigChan 234 | } 235 | 236 | func (m modemVoice) ParseCallAdded(v *dbus.Signal) (call Call, err error) { 237 | 238 | if strings.Contains(v.Name, ModemVoiceSignalCallAdded) == false { 239 | return nil, errors.New("error by parsing calladded signal") 240 | } 241 | 242 | if len(v.Body) != 1 { 243 | err = errors.New("error by parsing activation changed signal") 244 | return 245 | } 246 | path, ok := v.Body[0].(dbus.ObjectPath) 247 | if !ok { 248 | err = errors.New("error by parsing object path") 249 | return 250 | } 251 | 252 | return NewCall(path) 253 | } 254 | 255 | func (m modemVoice) Unsubscribe() { 256 | m.conn.RemoveSignal(m.sigChan) 257 | m.sigChan = nil 258 | } 259 | 260 | func (m modemVoice) MarshalJSON() ([]byte, error) { 261 | var callsJson [][]byte 262 | calls, err := m.GetCalls() 263 | if err != nil { 264 | return nil, err 265 | } 266 | for _, x := range calls { 267 | tmpB, err := x.MarshalJSON() 268 | if err != nil { 269 | return nil, err 270 | } 271 | callsJson = append(callsJson, tmpB) 272 | } 273 | emergencyOnly, err := m.GetEmergencyOnly() 274 | if err != nil { 275 | return nil, err 276 | } 277 | return json.Marshal(map[string]interface{}{ 278 | "Calls": callsJson, 279 | "EmergencyOnly": emergencyOnly, 280 | }) 281 | } 282 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Alt Go-ModemManager](./go-modemmanager.png) 2 | 3 | [![GoDoc](https://godoc.org/github.com/maltegrosse/go-modemmanager?status.svg)](https://pkg.go.dev/github.com/maltegrosse/go-modemmanager) 4 | [![License](http://img.shields.io/:license-mit-blue.svg?style=flat-square)](http://badges.mit-license.org) 5 | ![Go](https://github.com/maltegrosse/go-modemmanager/workflows/Go/badge.svg) 6 | [![Go Report Card](https://goreportcard.com/badge/github.com/maltegrosse/go-modemmanager)](https://goreportcard.com/report/github.com/maltegrosse/go-modemmanager) 7 | 8 | Go D-Bus bindings for ModemManager 9 | 10 | 11 | Additional information: [ModemManager D-Bus Specs](https://www.freedesktop.org/software/ModemManager/api/1.12.0/ref-dbus.html) 12 | 13 | Tested with [ModemManager - Version 1.12.8](https://gitlab.freedesktop.org/mobile-broadband/ModemManager), Go 1.13, on `Debian Buster (armv7)` with `Kernel 5.4.x` and `libqmi 1.24.6`. 14 | 15 | Test hardware: [SolidRun Hummingboard Edge](https://www.solid-run.com/nxp-family/hummingboard/) and a `Quectel EC25 - EC25EFA` mini pcie modem. 16 | 17 | ## Notes 18 | ModemManager works great together with GeoClue. A dbus wrapper can be found [here](https://github.com/maltegrosse/go-geoclue2). 19 | 20 | A NetworkManager dbus wrapper in golang can be found [here](https://github.com/Wifx/gonetworkmanager). 21 | 22 | ## Status 23 | Some methods/properties are untested as they are not supported by my modem/lack of how to use them. See `todo` tags in the code. 24 | 25 | ## Installation 26 | 27 | This packages requires Go 1.13 (for the dbus lib). If you installed it and set up your GOPATH, just run: 28 | 29 | `go get -u github.com/maltegrosse/go-modemmanager` 30 | 31 | ## Usage 32 | 33 | You can find some examples in the [examples](examples) directory. 34 | 35 | ## Limitations 36 | Not all interfaces, methods and properties are supported in QMI or AT mode. In addition, not all methods and properties are supported by every modem. 37 | A brief overview of the availability of each interface by using Quectel EC-25: 38 | 39 | | Interface | QMI | AT | 40 | |---------------|-------|-------| 41 | | ModemManager1 | true | true | 42 | | Modem | true | true | 43 | | Simple | true | true | 44 | | Modem3gpp | true | true | 45 | | Ussd | false | true | 46 | | ModemCdma | false | false | 47 | | Messaging | true | false | 48 | | Location | true | true | 49 | | Time | true | true | 50 | | Firmware | true | true | 51 | | Signal | true | false | 52 | | Oma | false | false | 53 | | Bearer | true | true | 54 | | Sim | true | true | 55 | | SMS | true | true | 56 | | Call | true | true | 57 | 58 | ## License 59 | **[MIT license](http://opensource.org/licenses/mit-license.php)** 60 | 61 | Copyright 2020 © Malte Grosse. 62 | 63 | Other: 64 | - [ModemManager Logo under GPLv2+](https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/tree/master/data) 65 | 66 | - [GoLang Logo under Creative Commons Attribution 3.0](https://blog.golang.org/go-brand) 67 | -------------------------------------------------------------------------------- /Sim.go: -------------------------------------------------------------------------------- 1 | package modemmanager 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | "github.com/godbus/dbus/v5" 7 | ) 8 | 9 | // Paths of methods and properties 10 | const ( 11 | SimInterface = ModemManagerInterface + ".Sim" 12 | 13 | /* Methods */ 14 | SimSendPin = SimInterface + ".SendPin" 15 | SimSendSendPuk = SimInterface + ".SendPuk" 16 | SimEnablePin = SimInterface + ".EnablePin" 17 | SimChangePin = SimInterface + ".ChangePin" 18 | 19 | /* Property */ 20 | SimPropertySimIdentifier = SimInterface + ".SimIdentifier" // readable s 21 | SimPropertyImsi = SimInterface + ".Imsi" // readable s 22 | SimPropertyOperatorIdentifier = SimInterface + ".OperatorIdentifier" // readable s 23 | SimPropertyOperatorName = SimInterface + ".OperatorName" // readable s 24 | SimPropertyEmergencyNumbers = SimInterface + ".EmergencyNumbers" // readable as 25 | 26 | ) 27 | 28 | // The Sim interface handles communication with SIM, USIM, and RUIM (CDMA SIM) cards. 29 | type Sim interface { 30 | /* METHODS */ 31 | 32 | // Returns object path 33 | GetObjectPath() dbus.ObjectPath 34 | 35 | // Send the PIN to unlock the SIM card. 36 | SendPin(pin string) error 37 | 38 | // Send the PUK and a new PIN to unlock the SIM card. 39 | SendPuk(pin string, puk string) error 40 | 41 | // Enable or disable the PIN checking. 42 | // IN s pin: A string containing the PIN code. 43 | // IN b enabled: TRUE to enable PIN checking, FALSE otherwise. 44 | EnablePin(pin string, enable bool) error 45 | 46 | // Change the PIN code. 47 | // IN s old_pin: A string containing the current PIN code. 48 | // I N s new_pin: A string containing the new PIN code. 49 | ChangePin(oldPin string, newPin string) error 50 | 51 | /* PROPERTIES */ 52 | 53 | // The ICCID of the SIM card. 54 | // This may be available before the PIN has been entered depending on the device itself. 55 | GetSimIdentifier() (string, error) 56 | 57 | // The IMSI of the SIM card, if any. 58 | GetImsi() (string, error) 59 | 60 | // The OperatorIdentifier 61 | GetOperatorIdentifier() (string, error) 62 | 63 | // The name of the network operator, as given by the SIM card, if known. 64 | GetOperatorName() (string, error) 65 | 66 | // List of emergency numbers programmed in the SIM card. 67 | // These numbers should be treated as numbers for emergency calls in addition to 112 and 911. 68 | GetEmergencyNumbers() ([]string, error) 69 | 70 | MarshalJSON() ([]byte, error) 71 | 72 | /* SIGNALS */ 73 | 74 | // Listen to changed properties 75 | // returns []interface 76 | // index 0 = name of the interface on which the properties are defined 77 | // index 1 = changed properties with new values as map[string]dbus.Variant 78 | // index 2 = invalidated properties: changed properties but the new values are not send with them 79 | SubscribePropertiesChanged() <-chan *dbus.Signal 80 | 81 | // ParsePropertiesChanged parses the dbus signal 82 | ParsePropertiesChanged(v *dbus.Signal) (interfaceName string, changedProperties map[string]dbus.Variant, invalidatedProperties []string, err error) 83 | Unsubscribe() 84 | } 85 | 86 | // NewSim returns new Sim Interface 87 | func NewSim(objectPath dbus.ObjectPath) (Sim, error) { 88 | var sm sim 89 | return &sm, sm.init(ModemManagerInterface, objectPath) 90 | } 91 | 92 | type sim struct { 93 | dbusBase 94 | sigChan chan *dbus.Signal 95 | } 96 | 97 | func (sm sim) GetObjectPath() dbus.ObjectPath { 98 | return sm.obj.Path() 99 | } 100 | func (sm sim) SendPin(pin string) error { 101 | return sm.call(SimSendPin, &pin) 102 | } 103 | 104 | func (sm sim) SendPuk(pin string, puk string) error { 105 | return sm.call(SimSendSendPuk, &pin, &puk) 106 | } 107 | 108 | func (sm sim) EnablePin(pin string, enable bool) error { 109 | return sm.call(SimEnablePin, &pin, &enable) 110 | } 111 | 112 | func (sm sim) ChangePin(oldPin string, newPin string) error { 113 | return sm.call(SimChangePin, &oldPin, &newPin) 114 | } 115 | 116 | func (sm sim) GetSimIdentifier() (string, error) { 117 | return sm.getStringProperty(SimPropertySimIdentifier) 118 | } 119 | 120 | func (sm sim) GetImsi() (string, error) { 121 | return sm.getStringProperty(SimPropertyImsi) 122 | } 123 | 124 | func (sm sim) GetOperatorIdentifier() (string, error) { 125 | return sm.getStringProperty(SimPropertyOperatorIdentifier) 126 | } 127 | 128 | func (sm sim) GetOperatorName() (string, error) { 129 | return sm.getStringProperty(SimPropertyOperatorName) 130 | } 131 | 132 | func (sm sim) GetEmergencyNumbers() ([]string, error) { 133 | return sm.getSliceStringProperty(SimPropertyEmergencyNumbers) 134 | } 135 | 136 | func (sm sim) SubscribePropertiesChanged() <-chan *dbus.Signal { 137 | if sm.sigChan != nil { 138 | return sm.sigChan 139 | } 140 | rule := fmt.Sprintf("type='signal', member='%s',path_namespace='%s'", dbusPropertiesChanged, fmt.Sprint(sm.GetObjectPath())) 141 | sm.conn.BusObject().Call(dbusMethodAddMatch, 0, rule) 142 | sm.sigChan = make(chan *dbus.Signal, 10) 143 | sm.conn.Signal(sm.sigChan) 144 | return sm.sigChan 145 | } 146 | func (sm sim) ParsePropertiesChanged(v *dbus.Signal) (interfaceName string, changedProperties map[string]dbus.Variant, invalidatedProperties []string, err error) { 147 | return sm.parsePropertiesChanged(v) 148 | } 149 | 150 | func (sm sim) Unsubscribe() { 151 | sm.conn.RemoveSignal(sm.sigChan) 152 | sm.sigChan = nil 153 | } 154 | 155 | func (sm sim) MarshalJSON() ([]byte, error) { 156 | simIdentifier, err := sm.GetSimIdentifier() 157 | if err != nil { 158 | return nil, err 159 | } 160 | imsi, err := sm.GetImsi() 161 | if err != nil { 162 | return nil, err 163 | } 164 | operatorIdentifier, err := sm.GetOperatorIdentifier() 165 | if err != nil { 166 | return nil, err 167 | } 168 | operatorName, err := sm.GetOperatorName() 169 | if err != nil { 170 | return nil, err 171 | } 172 | emergencyNumbers, err := sm.GetEmergencyNumbers() 173 | if err != nil { 174 | return nil, err 175 | } 176 | return json.Marshal(map[string]interface{}{ 177 | "SimIdentifier": simIdentifier, 178 | "Imsi": imsi, 179 | "OperatorIdentifier": operatorIdentifier, 180 | "OperatorName": operatorName, 181 | "EmergencyNumbers": emergencyNumbers, 182 | }) 183 | } 184 | -------------------------------------------------------------------------------- /examples/check_interfaces.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/maltegrosse/go-modemmanager" 6 | "log" 7 | ) 8 | 9 | func main() { 10 | // switch from qmi to at: 11 | // rmmod qmi_wwan 12 | // systemctl restart ModemManager 13 | // switch back 14 | // modprobe qmi_wwan 15 | // systemctl restart ModemManager 16 | tmpByteSlice := []byte("TEST") 17 | fmt.Println(string(tmpByteSlice)) 18 | mmgr, err := modemmanager.NewModemManager() 19 | if err != nil { 20 | log.Fatal(err.Error()) 21 | } 22 | version, err := mmgr.GetVersion() 23 | if err != nil { 24 | log.Fatal(err.Error()) 25 | } 26 | fmt.Println("ModemManager Version: ", version) 27 | 28 | tmpByteSlice, err = mmgr.MarshalJSON() 29 | if err != nil { 30 | fmt.Println(err) 31 | fmt.Println("ModemManager not available") 32 | } else { 33 | 34 | fmt.Println("ModemManager available") 35 | } 36 | 37 | err = mmgr.ScanDevices() 38 | if err != nil { 39 | log.Fatal(err.Error()) 40 | } 41 | 42 | modems, err := mmgr.GetModems() 43 | if err != nil { 44 | log.Fatal(err.Error()) 45 | } 46 | fmt.Println("found ", len(modems), " modem(s) ") 47 | for _, modem := range modems { 48 | fmt.Println("ObjectPath: ", modem.GetObjectPath()) 49 | drivers, err := modem.GetDrivers() 50 | if err != nil { 51 | log.Fatal(err.Error()) 52 | } 53 | fmt.Println("Drivers: ", drivers) 54 | 55 | tmpByteSlice, err = modem.MarshalJSON() 56 | if err != nil { 57 | fmt.Println(err) 58 | fmt.Println("Modem not available") 59 | } else { 60 | fmt.Println("Modem available") 61 | } 62 | 63 | bearers, err := modem.GetBearers() 64 | if err != nil { 65 | log.Fatal(err.Error()) 66 | } 67 | for _, bearer := range bearers { 68 | fmt.Println("Found bearer at:", bearer.GetObjectPath()) 69 | tmpByteSlice, err = bearer.MarshalJSON() 70 | if err != nil { 71 | fmt.Println(err) 72 | fmt.Println("Bearer not available") 73 | } else { 74 | fmt.Println("Bearer available") 75 | } 76 | } 77 | sim, err := modem.GetSim() 78 | if err != nil { 79 | log.Fatal(err.Error()) 80 | } 81 | fmt.Println(" Found Sim: ", sim.GetObjectPath()) 82 | tmpByteSlice, err = sim.MarshalJSON() 83 | if err != nil { 84 | fmt.Println(err) 85 | fmt.Println("SIM not available") 86 | } else { 87 | fmt.Println("SIM available") 88 | } 89 | 90 | modemSimple, err := modem.GetSimpleModem() 91 | if err != nil { 92 | log.Fatal(err.Error()) 93 | } 94 | fmt.Println("ModemSimple for: ", modemSimple.GetObjectPath()) 95 | simpleModemStatus, err := modemSimple.GetStatus() 96 | if err != nil { 97 | fmt.Println(simpleModemStatus) 98 | fmt.Println(err) 99 | fmt.Println("ModemSimple not available") 100 | } else { 101 | fmt.Println("ModemSimple available") 102 | } 103 | 104 | modem3gpp, err := modem.Get3gpp() 105 | if err != nil { 106 | log.Fatal(err.Error()) 107 | } 108 | fmt.Println("Modem3gpp for: ", modem3gpp.GetObjectPath()) 109 | tmpByteSlice, err = modem3gpp.MarshalJSON() 110 | if err != nil { 111 | fmt.Println(err) 112 | fmt.Println("Modem3GPP not available") 113 | } else { 114 | fmt.Println("Modem3GPP available") 115 | } 116 | 117 | ussd, err := modem3gpp.GetUssd() 118 | if err != nil { 119 | log.Fatal(err.Error()) 120 | } 121 | fmt.Println("Ussd for: ", ussd.GetObjectPath()) 122 | tmpByteSlice, err = ussd.MarshalJSON() 123 | if err != nil { 124 | fmt.Println(err) 125 | fmt.Println("Ussd not available") 126 | } else { 127 | fmt.Println("Ussd available") 128 | } 129 | 130 | mCdma, err := modem.GetCdma() 131 | if err != nil { 132 | log.Fatal(err.Error()) 133 | } 134 | fmt.Println("ModemCdma for: ", mCdma.GetObjectPath()) 135 | tmpByteSlice, err = mCdma.MarshalJSON() 136 | if err != nil { 137 | fmt.Println(err) 138 | fmt.Println("Cdma not available") 139 | } else { 140 | fmt.Println("Cdma available") 141 | } 142 | 143 | messaging, err := modem.GetMessaging() 144 | if err != nil { 145 | log.Fatal(err.Error()) 146 | } 147 | fmt.Println("ModemMessaging for: ", messaging.GetObjectPath()) 148 | tmpByteSlice, err = messaging.MarshalJSON() 149 | if err != nil { 150 | fmt.Println(err) 151 | fmt.Println("Messaging not available") 152 | } else { 153 | fmt.Println("Messaging available") 154 | } 155 | 156 | modemLocation, err := modem.GetLocation() 157 | if err != nil { 158 | log.Fatal(err.Error()) 159 | } 160 | fmt.Println("ModemLocation for: ", modemLocation.GetObjectPath()) 161 | tmpByteSlice, err = modemLocation.MarshalJSON() 162 | if err != nil { 163 | fmt.Println(err) 164 | fmt.Println("Location not available") 165 | } else { 166 | fmt.Println("Location available") 167 | } 168 | 169 | modemTime, err := modem.GetTime() 170 | if err != nil { 171 | log.Fatal(err.Error()) 172 | } 173 | fmt.Println("ModemTime for: ", modemTime.GetObjectPath()) 174 | tmpByteSlice, err = modemTime.MarshalJSON() 175 | if err != nil { 176 | fmt.Println(err) 177 | fmt.Println("Time not available") 178 | } else { 179 | fmt.Println("Time available") 180 | } 181 | 182 | voice, err := modem.GetVoice() 183 | if err != nil { 184 | log.Fatal(err.Error()) 185 | } 186 | fmt.Println("ModemVoice for", voice.GetObjectPath()) 187 | tmpByteSlice, err = voice.MarshalJSON() 188 | if err != nil { 189 | fmt.Println(err) 190 | fmt.Println("Voice not available") 191 | } else { 192 | fmt.Println("Voice available") 193 | } 194 | 195 | modemFirmware, err := modem.GetFirmware() 196 | if err != nil { 197 | log.Fatal(err.Error()) 198 | } 199 | fmt.Println("ModemFirmware for: ", modemFirmware.GetObjectPath()) 200 | tmpByteSlice, err = modemFirmware.MarshalJSON() 201 | if err != nil { 202 | fmt.Println(err) 203 | fmt.Println("Firmware not available") 204 | } else { 205 | fmt.Println("Firmware available") 206 | } 207 | 208 | modemSignal, err := modem.GetSignal() 209 | if err != nil { 210 | log.Fatal(err.Error()) 211 | } 212 | fmt.Println("Modem Signal for: ", modemSignal.GetObjectPath()) 213 | tmpByteSlice, err = modemSignal.MarshalJSON() 214 | if err != nil { 215 | fmt.Println(err) 216 | fmt.Println("Signal not available") 217 | } else { 218 | fmt.Println("Signal available") 219 | } 220 | 221 | modemOma, err := modem.GetOma() 222 | if err != nil { 223 | log.Fatal(err.Error()) 224 | } 225 | fmt.Println("ModemOMA for: ", modemOma.GetObjectPath()) 226 | tmpByteSlice, err = modemOma.MarshalJSON() 227 | if err != nil { 228 | fmt.Println(err) 229 | fmt.Println("Oma not available") 230 | } else { 231 | fmt.Println("Oma available") 232 | } 233 | 234 | } 235 | } 236 | -------------------------------------------------------------------------------- /examples/test_listener.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/maltegrosse/go-modemmanager" 6 | "log" 7 | "reflect" 8 | ) 9 | 10 | func main() { 11 | mmgr, err := modemmanager.NewModemManager() 12 | if err != nil { 13 | log.Fatal(err.Error()) 14 | } 15 | version, err := mmgr.GetVersion() 16 | if err != nil { 17 | log.Fatal(err.Error()) 18 | } 19 | fmt.Println("ModemManager Version: ", version) 20 | modems, err := mmgr.GetModems() 21 | if err != nil { 22 | log.Fatal(err.Error()) 23 | } 24 | for _, modem := range modems { 25 | fmt.Println("ObjectPath: ", modem.GetObjectPath()) 26 | listenToModemPropertiesChanged(modem) 27 | 28 | } 29 | } 30 | func listenToModemPropertiesChanged(modem modemmanager.Modem) { 31 | c := modem.SubscribePropertiesChanged() 32 | for v := range c { 33 | fmt.Println(v) 34 | interfaceName, changedProperties, invalidatedProperties, err := modem.ParsePropertiesChanged(v) 35 | if err != nil { 36 | fmt.Println(err) 37 | } else { 38 | fmt.Println(interfaceName, changedProperties, invalidatedProperties) 39 | } 40 | 41 | } 42 | } 43 | func listenToModemStateChanged(modem modemmanager.Modem) { 44 | c := modem.SubscribeStateChanged() 45 | for v := range c { 46 | oldState, newState, reason, err := modem.ParseStateChanged(v) 47 | if err == nil { 48 | fmt.Println(oldState, newState, reason) 49 | } 50 | 51 | } 52 | 53 | } 54 | 55 | func listenToModemVoiceCallAdded(modem modemmanager.Modem) { 56 | // listen new calls 57 | voice, err := modem.GetVoice() 58 | if err != nil { 59 | log.Fatal(err.Error()) 60 | } 61 | fmt.Println(voice.GetObjectPath()) 62 | c := voice.SubscribeCallAdded() 63 | fmt.Println("start listening ....") 64 | for v := range c { 65 | fmt.Println(v) 66 | fmt.Println(reflect.TypeOf(v)) 67 | fmt.Println("name", v.Name) 68 | fmt.Println("path", v.Path) 69 | fmt.Println("body", v.Body) 70 | fmt.Println("sender", v.Sender) 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /go-modemmanager.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maltegrosse/go-modemmanager/ce71bf86f4f42b6b7eb3f42330e67566d5bce18a/go-modemmanager.png -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/maltegrosse/go-modemmanager 2 | 3 | go 1.13 4 | 5 | require github.com/godbus/dbus/v5 v5.0.3 6 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | github.com/godbus/dbus/v5 v5.0.3 h1:ZqHaoEF7TBzh4jzPmqVhE/5A1z9of6orkAe5uHoAeME= 2 | github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= 3 | -------------------------------------------------------------------------------- /mmbearerallowedauth_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMBearerAllowedAuth -trimprefix=MmBearerAllowedAuth"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmBearerAllowedAuthUnknown-0] 12 | _ = x[MmBearerAllowedAuthNone-1] 13 | _ = x[MmBearerAllowedAuthPap-2] 14 | _ = x[MmBearerAllowedAuthChap-4] 15 | _ = x[MmBearerAllowedAuthMschap-8] 16 | _ = x[MmBearerAllowedAuthMschapv2-16] 17 | _ = x[MmBearerAllowedAuthEap-32] 18 | } 19 | 20 | const ( 21 | _MMBearerAllowedAuth_name_0 = "UnknownNonePap" 22 | _MMBearerAllowedAuth_name_1 = "Chap" 23 | _MMBearerAllowedAuth_name_2 = "Mschap" 24 | _MMBearerAllowedAuth_name_3 = "Mschapv2" 25 | _MMBearerAllowedAuth_name_4 = "Eap" 26 | ) 27 | 28 | var ( 29 | _MMBearerAllowedAuth_index_0 = [...]uint8{0, 7, 11, 14} 30 | ) 31 | 32 | func (i MMBearerAllowedAuth) String() string { 33 | switch { 34 | case i <= 2: 35 | return _MMBearerAllowedAuth_name_0[_MMBearerAllowedAuth_index_0[i]:_MMBearerAllowedAuth_index_0[i+1]] 36 | case i == 4: 37 | return _MMBearerAllowedAuth_name_1 38 | case i == 8: 39 | return _MMBearerAllowedAuth_name_2 40 | case i == 16: 41 | return _MMBearerAllowedAuth_name_3 42 | case i == 32: 43 | return _MMBearerAllowedAuth_name_4 44 | default: 45 | return "MMBearerAllowedAuth(" + strconv.FormatInt(int64(i), 10) + ")" 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /mmbeareripfamily_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMBearerIpFamily -trimprefix=MmBearerIpFamily"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmBearerIpFamilyNone-0] 12 | _ = x[MmBearerIpFamilyIpv4-1] 13 | _ = x[MmBearerIpFamilyIpv6-2] 14 | _ = x[MmBearerIpFamilyIpv4v6-4] 15 | _ = x[MmBearerIpFamilyAny-4294967295] 16 | } 17 | 18 | const ( 19 | _MMBearerIpFamily_name_0 = "NoneIpv4Ipv6" 20 | _MMBearerIpFamily_name_1 = "Ipv4v6" 21 | _MMBearerIpFamily_name_2 = "Any" 22 | ) 23 | 24 | var ( 25 | _MMBearerIpFamily_index_0 = [...]uint8{0, 4, 8, 12} 26 | ) 27 | 28 | func (i MMBearerIpFamily) String() string { 29 | switch { 30 | case i <= 2: 31 | return _MMBearerIpFamily_name_0[_MMBearerIpFamily_index_0[i]:_MMBearerIpFamily_index_0[i+1]] 32 | case i == 4: 33 | return _MMBearerIpFamily_name_1 34 | case i == 4294967295: 35 | return _MMBearerIpFamily_name_2 36 | default: 37 | return "MMBearerIpFamily(" + strconv.FormatInt(int64(i), 10) + ")" 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /mmbeareripmethod_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMBearerIpMethod -trimprefix=MmBearerIpMethod"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmBearerIpMethodUnknown-0] 12 | _ = x[MmBearerIpMethodPpp-1] 13 | _ = x[MmBearerIpMethodStatic-2] 14 | _ = x[MmBearerIpMethodDhcp-3] 15 | } 16 | 17 | const _MMBearerIpMethod_name = "UnknownPppStaticDhcp" 18 | 19 | var _MMBearerIpMethod_index = [...]uint8{0, 7, 10, 16, 20} 20 | 21 | func (i MMBearerIpMethod) String() string { 22 | if i >= MMBearerIpMethod(len(_MMBearerIpMethod_index)-1) { 23 | return "MMBearerIpMethod(" + strconv.FormatInt(int64(i), 10) + ")" 24 | } 25 | return _MMBearerIpMethod_name[_MMBearerIpMethod_index[i]:_MMBearerIpMethod_index[i+1]] 26 | } 27 | -------------------------------------------------------------------------------- /mmbearertype_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMBearerType -trimprefix=MmBearerType"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmBearerTypeUnknown-0] 12 | _ = x[MmBearerTypeDefault-1] 13 | _ = x[MmBearerTypeDefaultAttach-2] 14 | _ = x[MmBearerTypeDedicated-3] 15 | } 16 | 17 | const _MMBearerType_name = "UnknownDefaultDefaultAttachDedicated" 18 | 19 | var _MMBearerType_index = [...]uint8{0, 7, 14, 27, 36} 20 | 21 | func (i MMBearerType) String() string { 22 | if i >= MMBearerType(len(_MMBearerType_index)-1) { 23 | return "MMBearerType(" + strconv.FormatInt(int64(i), 10) + ")" 24 | } 25 | return _MMBearerType_name[_MMBearerType_index[i]:_MMBearerType_index[i+1]] 26 | } 27 | -------------------------------------------------------------------------------- /mmcalldirection_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMCallDirection -trimprefix=MmCallDirection"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmCallDirectionUnknown-0] 12 | _ = x[MmCallDirectionIncoming-1] 13 | _ = x[MmCallDirectionOutgoing-2] 14 | } 15 | 16 | const _MMCallDirection_name = "UnknownIncomingOutgoing" 17 | 18 | var _MMCallDirection_index = [...]uint8{0, 7, 15, 23} 19 | 20 | func (i MMCallDirection) String() string { 21 | if i >= MMCallDirection(len(_MMCallDirection_index)-1) { 22 | return "MMCallDirection(" + strconv.FormatInt(int64(i), 10) + ")" 23 | } 24 | return _MMCallDirection_name[_MMCallDirection_index[i]:_MMCallDirection_index[i+1]] 25 | } 26 | -------------------------------------------------------------------------------- /mmcallstate_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMCallState -trimprefix=MmCallState"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmCallStateUnknown-0] 12 | _ = x[MmCallStateDialing-1] 13 | _ = x[MmCallStateRingingOut-2] 14 | _ = x[MmCallStateRingingIn-3] 15 | _ = x[MmCallStateActive-4] 16 | _ = x[MmCallStateHeld-5] 17 | _ = x[MmCallStateWaiting-6] 18 | _ = x[MmCallStateTerminated-7] 19 | } 20 | 21 | const _MMCallState_name = "UnknownDialingRingingOutRingingInActiveHeldWaitingTerminated" 22 | 23 | var _MMCallState_index = [...]uint8{0, 7, 14, 24, 33, 39, 43, 50, 60} 24 | 25 | func (i MMCallState) String() string { 26 | if i >= MMCallState(len(_MMCallState_index)-1) { 27 | return "MMCallState(" + strconv.FormatInt(int64(i), 10) + ")" 28 | } 29 | return _MMCallState_name[_MMCallState_index[i]:_MMCallState_index[i+1]] 30 | } 31 | -------------------------------------------------------------------------------- /mmcallstatereason_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMCallStateReason -trimprefix=MmCallStateReason"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmCallStateReasonUnknown-0] 12 | _ = x[MmCallStateReasonOutgoingStarted-1] 13 | _ = x[MmCallStateReasonIncomingNew-2] 14 | _ = x[MmCallStateReasonAccepted-3] 15 | _ = x[MmCallStateReasonTerminated-4] 16 | _ = x[MmCallStateReasonRefusedOrBusy-5] 17 | _ = x[MmCallStateReasonError-6] 18 | _ = x[MmCallStateReasonAudioSetupFailed-7] 19 | _ = x[MmCallStateReasonTransferred-8] 20 | _ = x[MmCallStateReasonDeflected-9] 21 | } 22 | 23 | const _MMCallStateReason_name = "UnknownOutgoingStartedIncomingNewAcceptedTerminatedRefusedOrBusyErrorAudioSetupFailedTransferredDeflected" 24 | 25 | var _MMCallStateReason_index = [...]uint8{0, 7, 22, 33, 41, 51, 64, 69, 85, 96, 105} 26 | 27 | func (i MMCallStateReason) String() string { 28 | if i >= MMCallStateReason(len(_MMCallStateReason_index)-1) { 29 | return "MMCallStateReason(" + strconv.FormatInt(int64(i), 10) + ")" 30 | } 31 | return _MMCallStateReason_name[_MMCallStateReason_index[i]:_MMCallStateReason_index[i+1]] 32 | } 33 | -------------------------------------------------------------------------------- /mmcdmaactivationerror_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMCdmaActivationError -trimprefix=MmCdmaActivationError"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmCdmaActivationErrorNone-0] 12 | _ = x[MmCdmaActivationErrorUnknown-1] 13 | _ = x[MmCdmaActivationErrorRoaming-2] 14 | _ = x[MmCdmaActivationErrorWrongRadioInterface-3] 15 | _ = x[MmCdmaActivationErrorCouldNotConnect-4] 16 | _ = x[MmCdmaActivationErrorSecurityAuthenticationFailed-5] 17 | _ = x[MmCdmaActivationErrorProvisioningFailed-6] 18 | _ = x[MmCdmaActivationErrorNoSignal-7] 19 | _ = x[MmCdmaActivationErrorTimedOut-8] 20 | _ = x[MmCdmaActivationErrorStartFailed-9] 21 | } 22 | 23 | const _MMCdmaActivationError_name = "NoneUnknownRoamingWrongRadioInterfaceCouldNotConnectSecurityAuthenticationFailedProvisioningFailedNoSignalTimedOutStartFailed" 24 | 25 | var _MMCdmaActivationError_index = [...]uint8{0, 4, 11, 18, 37, 52, 80, 98, 106, 114, 125} 26 | 27 | func (i MMCdmaActivationError) String() string { 28 | if i >= MMCdmaActivationError(len(_MMCdmaActivationError_index)-1) { 29 | return "MMCdmaActivationError(" + strconv.FormatInt(int64(i), 10) + ")" 30 | } 31 | return _MMCdmaActivationError_name[_MMCdmaActivationError_index[i]:_MMCdmaActivationError_index[i+1]] 32 | } 33 | -------------------------------------------------------------------------------- /mmconnectionerror_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMConnectionError -trimprefix=MMConnectionError"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmConnectionErrorUnknown-0] 12 | _ = x[MmConnectionErrorNoCarrier-1] 13 | _ = x[MmConnectionErrorNoDialtone-2] 14 | _ = x[MmConnectionErrorBusy-3] 15 | _ = x[MmConnectionErrorNoAnswer-4] 16 | } 17 | 18 | const _MMConnectionError_name = "MmConnectionErrorUnknownMmConnectionErrorNoCarrierMmConnectionErrorNoDialtoneMmConnectionErrorBusyMmConnectionErrorNoAnswer" 19 | 20 | var _MMConnectionError_index = [...]uint8{0, 24, 50, 77, 98, 123} 21 | 22 | func (i MMConnectionError) String() string { 23 | if i >= MMConnectionError(len(_MMConnectionError_index)-1) { 24 | return "MMConnectionError(" + strconv.FormatInt(int64(i), 10) + ")" 25 | } 26 | return _MMConnectionError_name[_MMConnectionError_index[i]:_MMConnectionError_index[i+1]] 27 | } 28 | -------------------------------------------------------------------------------- /mmcoreerror_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMCoreError -trimprefix=MMCoreError"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmCoreErrorFailed-0] 12 | _ = x[MmCoreErrorCancelled-1] 13 | _ = x[MmCoreErrorAborted-2] 14 | _ = x[MmCoreErrorUnsupported-3] 15 | _ = x[MmCoreErrorNoPlugins-4] 16 | _ = x[MmCoreErrorUnauthorized-5] 17 | _ = x[MmCoreErrorInvalidArgs-6] 18 | _ = x[MmCoreErrorInProgress-7] 19 | _ = x[MmCoreErrorWrongState-8] 20 | _ = x[MmCoreErrorConnected-9] 21 | _ = x[MmCoreErrorTooMany-10] 22 | _ = x[MmCoreErrorNotFound-11] 23 | _ = x[MmCoreErrorRetry-12] 24 | _ = x[MmCoreErrorExists-13] 25 | } 26 | 27 | const _MMCoreError_name = "MmCoreErrorFailedMmCoreErrorCancelledMmCoreErrorAbortedMmCoreErrorUnsupportedMmCoreErrorNoPluginsMmCoreErrorUnauthorizedMmCoreErrorInvalidArgsMmCoreErrorInProgressMmCoreErrorWrongStateMmCoreErrorConnectedMmCoreErrorTooManyMmCoreErrorNotFoundMmCoreErrorRetryMmCoreErrorExists" 28 | 29 | var _MMCoreError_index = [...]uint16{0, 17, 37, 55, 77, 97, 120, 142, 163, 184, 204, 222, 241, 257, 274} 30 | 31 | func (i MMCoreError) String() string { 32 | if i >= MMCoreError(len(_MMCoreError_index)-1) { 33 | return "MMCoreError(" + strconv.FormatInt(int64(i), 10) + ")" 34 | } 35 | return _MMCoreError_name[_MMCoreError_index[i]:_MMCoreError_index[i+1]] 36 | } 37 | -------------------------------------------------------------------------------- /mmfirmwareimagetype_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMFirmwareImageType -trimprefix=MmFirmwareImageType"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmFirmwareImageTypeUnknown-0] 12 | _ = x[MmFirmwareImageTypeGeneric-1] 13 | _ = x[MmFirmwareImageTypeGobi-2] 14 | } 15 | 16 | const _MMFirmwareImageType_name = "UnknownGenericGobi" 17 | 18 | var _MMFirmwareImageType_index = [...]uint8{0, 7, 14, 18} 19 | 20 | func (i MMFirmwareImageType) String() string { 21 | if i >= MMFirmwareImageType(len(_MMFirmwareImageType_index)-1) { 22 | return "MMFirmwareImageType(" + strconv.FormatInt(int64(i), 10) + ")" 23 | } 24 | return _MMFirmwareImageType_name[_MMFirmwareImageType_index[i]:_MMFirmwareImageType_index[i+1]] 25 | } 26 | -------------------------------------------------------------------------------- /mmmessageerror_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMMessageError -trimprefix=MMMessageError"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmMessageErrorMeFailure-300] 12 | _ = x[MmMessageErrorSmsServiceReserved-301] 13 | _ = x[MmMessageErrorNotAllowed-302] 14 | _ = x[MmMessageErrorNotSupported-303] 15 | _ = x[MmMessageErrorInvalidPduParameter-304] 16 | _ = x[MmMessageErrorInvalidTextParameter-305] 17 | _ = x[MmMessageErrorSimNotInserted-310] 18 | _ = x[MmMessageErrorSimPin-311] 19 | _ = x[MmMessageErrorPhSimPin-312] 20 | _ = x[MmMessageErrorSimFailure-313] 21 | _ = x[MmMessageErrorSimBusy-314] 22 | _ = x[MmMessageErrorSimWrong-315] 23 | _ = x[MmMessageErrorSimPuk-316] 24 | _ = x[MmMessageErrorSimPin2-317] 25 | _ = x[MmMessageErrorSimPuk2-318] 26 | _ = x[MmMessageErrorMemoryFailure-320] 27 | _ = x[MmMessageErrorInvalidIndex-321] 28 | _ = x[MmMessageErrorMemoryFull-322] 29 | _ = x[MmMessageErrorSmscAddressUnknown-330] 30 | _ = x[MmMessageErrorNoNetwork-331] 31 | _ = x[MmMessageErrorNetworkTimeout-332] 32 | _ = x[MmMessageErrorNoCnmaAckExpected-340] 33 | _ = x[MmMessageErrorUnknown-500] 34 | } 35 | 36 | const ( 37 | _MMMessageError_name_0 = "MmMessageErrorMeFailureMmMessageErrorSmsServiceReservedMmMessageErrorNotAllowedMmMessageErrorNotSupportedMmMessageErrorInvalidPduParameterMmMessageErrorInvalidTextParameter" 38 | _MMMessageError_name_1 = "MmMessageErrorSimNotInsertedMmMessageErrorSimPinMmMessageErrorPhSimPinMmMessageErrorSimFailureMmMessageErrorSimBusyMmMessageErrorSimWrongMmMessageErrorSimPukMmMessageErrorSimPin2MmMessageErrorSimPuk2" 39 | _MMMessageError_name_2 = "MmMessageErrorMemoryFailureMmMessageErrorInvalidIndexMmMessageErrorMemoryFull" 40 | _MMMessageError_name_3 = "MmMessageErrorSmscAddressUnknownMmMessageErrorNoNetworkMmMessageErrorNetworkTimeout" 41 | _MMMessageError_name_4 = "MmMessageErrorNoCnmaAckExpected" 42 | _MMMessageError_name_5 = "MmMessageErrorUnknown" 43 | ) 44 | 45 | var ( 46 | _MMMessageError_index_0 = [...]uint8{0, 23, 55, 79, 105, 138, 172} 47 | _MMMessageError_index_1 = [...]uint8{0, 28, 48, 70, 94, 115, 137, 157, 178, 199} 48 | _MMMessageError_index_2 = [...]uint8{0, 27, 53, 77} 49 | _MMMessageError_index_3 = [...]uint8{0, 32, 55, 83} 50 | ) 51 | 52 | func (i MMMessageError) String() string { 53 | switch { 54 | case 300 <= i && i <= 305: 55 | i -= 300 56 | return _MMMessageError_name_0[_MMMessageError_index_0[i]:_MMMessageError_index_0[i+1]] 57 | case 310 <= i && i <= 318: 58 | i -= 310 59 | return _MMMessageError_name_1[_MMMessageError_index_1[i]:_MMMessageError_index_1[i+1]] 60 | case 320 <= i && i <= 322: 61 | i -= 320 62 | return _MMMessageError_name_2[_MMMessageError_index_2[i]:_MMMessageError_index_2[i+1]] 63 | case 330 <= i && i <= 332: 64 | i -= 330 65 | return _MMMessageError_name_3[_MMMessageError_index_3[i]:_MMMessageError_index_3[i+1]] 66 | case i == 340: 67 | return _MMMessageError_name_4 68 | case i == 500: 69 | return _MMMessageError_name_5 70 | default: 71 | return "MMMessageError(" + strconv.FormatInt(int64(i), 10) + ")" 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /mmmobileequipmenterror_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMMobileEquipmentError -trimprefix=MMMobileEquipmentError"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmMobileEquipmentErrorPhoneFailure-0] 12 | _ = x[MmMobileEquipmentErrorNoConnection-1] 13 | _ = x[MmMobileEquipmentErrorLinkReserved-2] 14 | _ = x[MmMobileEquipmentErrorNotAllowed-3] 15 | _ = x[MmMobileEquipmentErrorNotSupported-4] 16 | _ = x[MmMobileEquipmentErrorPhSimPin-5] 17 | _ = x[MmMobileEquipmentErrorPhFsimPin-6] 18 | _ = x[MmMobileEquipmentErrorPhFsimPuk-7] 19 | _ = x[MmMobileEquipmentErrorSimNotInserted-10] 20 | _ = x[MmMobileEquipmentErrorSimPin-11] 21 | _ = x[MmMobileEquipmentErrorSimPuk-12] 22 | _ = x[MmMobileEquipmentErrorSimFailure-13] 23 | _ = x[MmMobileEquipmentErrorSimBusy-14] 24 | _ = x[MmMobileEquipmentErrorSimWrong-15] 25 | _ = x[MmMobileEquipmentErrorIncorrectPassword-16] 26 | _ = x[MmMobileEquipmentErrorSimPin2-17] 27 | _ = x[MmMobileEquipmentErrorSimPuk2-18] 28 | _ = x[MmMobileEquipmentErrorMemoryFull-20] 29 | _ = x[MmMobileEquipmentErrorInvalidIndex-21] 30 | _ = x[MmMobileEquipmentErrorNotFound-22] 31 | _ = x[MmMobileEquipmentErrorMemoryFailure-23] 32 | _ = x[MmMobileEquipmentErrorTextTooLong-24] 33 | _ = x[MmMobileEquipmentErrorInvalidChars-25] 34 | _ = x[MmMobileEquipmentErrorDialStringTooLong-26] 35 | _ = x[MmMobileEquipmentErrorDialStringInvalid-27] 36 | _ = x[MmMobileEquipmentErrorNoNetwork-30] 37 | _ = x[MmMobileEquipmentErrorNetworkTimeout-31] 38 | _ = x[MmMobileEquipmentErrorNetworkNotAllowed-32] 39 | _ = x[MmMobileEquipmentErrorNetworkPin-40] 40 | _ = x[MmMobileEquipmentErrorNetworkPuk-41] 41 | _ = x[MmMobileEquipmentErrorNetworkSubsetPin-42] 42 | _ = x[MmMobileEquipmentErrorNetworkSubsetPuk-43] 43 | _ = x[MmMobileEquipmentErrorServicePin-44] 44 | _ = x[MmMobileEquipmentErrorServicePuk-45] 45 | _ = x[MmMobileEquipmentErrorCorpPin-46] 46 | _ = x[MmMobileEquipmentErrorCorpPuk-47] 47 | _ = x[MmMobileEquipmentErrorHiddenKeyRequired-48] 48 | _ = x[MmMobileEquipmentErrorEapMethodNotSupported-49] 49 | _ = x[MmMobileEquipmentErrorIncorrectParameters-50] 50 | _ = x[MmMobileEquipmentErrorUnknown-100] 51 | _ = x[MmMobileEquipmentErrorGprsImsiUnknownInHlr-102] 52 | _ = x[MmMobileEquipmentErrorGprsIllegalMs-103] 53 | _ = x[MmMobileEquipmentErrorGprsImsiUnknownInVlr-104] 54 | _ = x[MmMobileEquipmentErrorGprsIllegalMe-106] 55 | _ = x[MmMobileEquipmentErrorGprsServiceNotAllowed-107] 56 | _ = x[MmMobileEquipmentErrorGprsAndNonGprsServicesNotAllowed-108] 57 | _ = x[MmMobileEquipmentErrorGprsPlmnNotAllowed-111] 58 | _ = x[MmMobileEquipmentErrorGprsLocationNotAllowed-112] 59 | _ = x[MmMobileEquipmentErrorGprsRoamingNotAllowed-113] 60 | _ = x[MmMobileEquipmentErrorGprsNoCellsInLocationArea-115] 61 | _ = x[MmMobileEquipmentErrorGprsNetworkFailure-117] 62 | _ = x[MmMobileEquipmentErrorGprsCongestion-122] 63 | _ = x[MmMobileEquipmentErrorGprsNotAuthorizedForCsg-125] 64 | _ = x[MmMobileEquipmentErrorGprsInsufficientResources-126] 65 | _ = x[MmMobileEquipmentErrorGprsMissingOrUnknownApn-127] 66 | _ = x[MmMobileEquipmentErrorGprsUnknownPdpAddressOrType-128] 67 | _ = x[MmMobileEquipmentErrorGprsUserAuthenticationFailed-129] 68 | _ = x[MmMobileEquipmentErrorGprsActivationRejectedByGgsnOrGw-130] 69 | _ = x[MmMobileEquipmentErrorGprsActivationRejectedUnspecified-131] 70 | _ = x[MmMobileEquipmentErrorGprsServiceOptionNotSupported-132] 71 | _ = x[MmMobileEquipmentErrorGprsServiceOptionNotSubscribed-133] 72 | _ = x[MmMobileEquipmentErrorGprsServiceOptionOutOfOrder-134] 73 | _ = x[MmMobileEquipmentErrorGprsFeatureNotSupported-140] 74 | _ = x[MmMobileEquipmentErrorGprsSemanticErrorInTftOperation-141] 75 | _ = x[MmMobileEquipmentErrorGprsSyntacticalErrorInTftOperation-142] 76 | _ = x[MmMobileEquipmentErrorGprsUnknownPdpContext-143] 77 | _ = x[MmMobileEquipmentErrorGprsSemanticErrorsInPacketFilter-144] 78 | _ = x[MmMobileEquipmentErrorGprsSyntacticalErrorInPacketFilter-145] 79 | _ = x[MmMobileEquipmentErrorGprsPdpContextWithoutTftAlreadyActivated-146] 80 | _ = x[MmMobileEquipmentErrorGprsUnknown-148] 81 | _ = x[MmMobileEquipmentErrorGprsPdpAuthFailure-149] 82 | _ = x[MmMobileEquipmentErrorGprsInvalidMobileClass-150] 83 | _ = x[MmMobileEquipmentErrorGprsLastPdnDisconnectionNotAllowedLegacy-151] 84 | _ = x[MmMobileEquipmentErrorGprsLastPdnDisconnectionNotAllowed-171] 85 | _ = x[MmMobileEquipmentErrorGprsSemanticallyIncorrectMessage-172] 86 | _ = x[MmMobileEquipmentErrorGprsMandatoryIeError-173] 87 | _ = x[MmMobileEquipmentErrorGprsIeNotImplemented-174] 88 | _ = x[MmMobileEquipmentErrorGprsConditionalIeError-175] 89 | _ = x[MmMobileEquipmentErrorGprsUnspecifiedProtocolError-176] 90 | _ = x[MmMobileEquipmentErrorGprsOperatorDeterminedBarring-177] 91 | _ = x[MmMobileEquipmentErrorGprsMaximumNumberOfPdpContextsReached-178] 92 | _ = x[MmMobileEquipmentErrorGprsRequestedApnNotSupported-179] 93 | _ = x[MmMobileEquipmentErrorGprsRequestRejectedBcmViolation-180] 94 | } 95 | 96 | const _MMMobileEquipmentError_name = "MmMobileEquipmentErrorPhoneFailureMmMobileEquipmentErrorNoConnectionMmMobileEquipmentErrorLinkReservedMmMobileEquipmentErrorNotAllowedMmMobileEquipmentErrorNotSupportedMmMobileEquipmentErrorPhSimPinMmMobileEquipmentErrorPhFsimPinMmMobileEquipmentErrorPhFsimPukMmMobileEquipmentErrorSimNotInsertedMmMobileEquipmentErrorSimPinMmMobileEquipmentErrorSimPukMmMobileEquipmentErrorSimFailureMmMobileEquipmentErrorSimBusyMmMobileEquipmentErrorSimWrongMmMobileEquipmentErrorIncorrectPasswordMmMobileEquipmentErrorSimPin2MmMobileEquipmentErrorSimPuk2MmMobileEquipmentErrorMemoryFullMmMobileEquipmentErrorInvalidIndexMmMobileEquipmentErrorNotFoundMmMobileEquipmentErrorMemoryFailureMmMobileEquipmentErrorTextTooLongMmMobileEquipmentErrorInvalidCharsMmMobileEquipmentErrorDialStringTooLongMmMobileEquipmentErrorDialStringInvalidMmMobileEquipmentErrorNoNetworkMmMobileEquipmentErrorNetworkTimeoutMmMobileEquipmentErrorNetworkNotAllowedMmMobileEquipmentErrorNetworkPinMmMobileEquipmentErrorNetworkPukMmMobileEquipmentErrorNetworkSubsetPinMmMobileEquipmentErrorNetworkSubsetPukMmMobileEquipmentErrorServicePinMmMobileEquipmentErrorServicePukMmMobileEquipmentErrorCorpPinMmMobileEquipmentErrorCorpPukMmMobileEquipmentErrorHiddenKeyRequiredMmMobileEquipmentErrorEapMethodNotSupportedMmMobileEquipmentErrorIncorrectParametersMmMobileEquipmentErrorUnknownMmMobileEquipmentErrorGprsImsiUnknownInHlrMmMobileEquipmentErrorGprsIllegalMsMmMobileEquipmentErrorGprsImsiUnknownInVlrMmMobileEquipmentErrorGprsIllegalMeMmMobileEquipmentErrorGprsServiceNotAllowedMmMobileEquipmentErrorGprsAndNonGprsServicesNotAllowedMmMobileEquipmentErrorGprsPlmnNotAllowedMmMobileEquipmentErrorGprsLocationNotAllowedMmMobileEquipmentErrorGprsRoamingNotAllowedMmMobileEquipmentErrorGprsNoCellsInLocationAreaMmMobileEquipmentErrorGprsNetworkFailureMmMobileEquipmentErrorGprsCongestionMmMobileEquipmentErrorGprsNotAuthorizedForCsgMmMobileEquipmentErrorGprsInsufficientResourcesMmMobileEquipmentErrorGprsMissingOrUnknownApnMmMobileEquipmentErrorGprsUnknownPdpAddressOrTypeMmMobileEquipmentErrorGprsUserAuthenticationFailedMmMobileEquipmentErrorGprsActivationRejectedByGgsnOrGwMmMobileEquipmentErrorGprsActivationRejectedUnspecifiedMmMobileEquipmentErrorGprsServiceOptionNotSupportedMmMobileEquipmentErrorGprsServiceOptionNotSubscribedMmMobileEquipmentErrorGprsServiceOptionOutOfOrderMmMobileEquipmentErrorGprsFeatureNotSupportedMmMobileEquipmentErrorGprsSemanticErrorInTftOperationMmMobileEquipmentErrorGprsSyntacticalErrorInTftOperationMmMobileEquipmentErrorGprsUnknownPdpContextMmMobileEquipmentErrorGprsSemanticErrorsInPacketFilterMmMobileEquipmentErrorGprsSyntacticalErrorInPacketFilterMmMobileEquipmentErrorGprsPdpContextWithoutTftAlreadyActivatedMmMobileEquipmentErrorGprsUnknownMmMobileEquipmentErrorGprsPdpAuthFailureMmMobileEquipmentErrorGprsInvalidMobileClassMmMobileEquipmentErrorGprsLastPdnDisconnectionNotAllowedLegacyMmMobileEquipmentErrorGprsLastPdnDisconnectionNotAllowedMmMobileEquipmentErrorGprsSemanticallyIncorrectMessageMmMobileEquipmentErrorGprsMandatoryIeErrorMmMobileEquipmentErrorGprsIeNotImplementedMmMobileEquipmentErrorGprsConditionalIeErrorMmMobileEquipmentErrorGprsUnspecifiedProtocolErrorMmMobileEquipmentErrorGprsOperatorDeterminedBarringMmMobileEquipmentErrorGprsMaximumNumberOfPdpContextsReachedMmMobileEquipmentErrorGprsRequestedApnNotSupportedMmMobileEquipmentErrorGprsRequestRejectedBcmViolation" 97 | 98 | var _MMMobileEquipmentError_map = map[MMMobileEquipmentError]string{ 99 | 0: _MMMobileEquipmentError_name[0:34], 100 | 1: _MMMobileEquipmentError_name[34:68], 101 | 2: _MMMobileEquipmentError_name[68:102], 102 | 3: _MMMobileEquipmentError_name[102:134], 103 | 4: _MMMobileEquipmentError_name[134:168], 104 | 5: _MMMobileEquipmentError_name[168:198], 105 | 6: _MMMobileEquipmentError_name[198:229], 106 | 7: _MMMobileEquipmentError_name[229:260], 107 | 10: _MMMobileEquipmentError_name[260:296], 108 | 11: _MMMobileEquipmentError_name[296:324], 109 | 12: _MMMobileEquipmentError_name[324:352], 110 | 13: _MMMobileEquipmentError_name[352:384], 111 | 14: _MMMobileEquipmentError_name[384:413], 112 | 15: _MMMobileEquipmentError_name[413:443], 113 | 16: _MMMobileEquipmentError_name[443:482], 114 | 17: _MMMobileEquipmentError_name[482:511], 115 | 18: _MMMobileEquipmentError_name[511:540], 116 | 20: _MMMobileEquipmentError_name[540:572], 117 | 21: _MMMobileEquipmentError_name[572:606], 118 | 22: _MMMobileEquipmentError_name[606:636], 119 | 23: _MMMobileEquipmentError_name[636:671], 120 | 24: _MMMobileEquipmentError_name[671:704], 121 | 25: _MMMobileEquipmentError_name[704:738], 122 | 26: _MMMobileEquipmentError_name[738:777], 123 | 27: _MMMobileEquipmentError_name[777:816], 124 | 30: _MMMobileEquipmentError_name[816:847], 125 | 31: _MMMobileEquipmentError_name[847:883], 126 | 32: _MMMobileEquipmentError_name[883:922], 127 | 40: _MMMobileEquipmentError_name[922:954], 128 | 41: _MMMobileEquipmentError_name[954:986], 129 | 42: _MMMobileEquipmentError_name[986:1024], 130 | 43: _MMMobileEquipmentError_name[1024:1062], 131 | 44: _MMMobileEquipmentError_name[1062:1094], 132 | 45: _MMMobileEquipmentError_name[1094:1126], 133 | 46: _MMMobileEquipmentError_name[1126:1155], 134 | 47: _MMMobileEquipmentError_name[1155:1184], 135 | 48: _MMMobileEquipmentError_name[1184:1223], 136 | 49: _MMMobileEquipmentError_name[1223:1266], 137 | 50: _MMMobileEquipmentError_name[1266:1307], 138 | 100: _MMMobileEquipmentError_name[1307:1336], 139 | 102: _MMMobileEquipmentError_name[1336:1378], 140 | 103: _MMMobileEquipmentError_name[1378:1413], 141 | 104: _MMMobileEquipmentError_name[1413:1455], 142 | 106: _MMMobileEquipmentError_name[1455:1490], 143 | 107: _MMMobileEquipmentError_name[1490:1533], 144 | 108: _MMMobileEquipmentError_name[1533:1587], 145 | 111: _MMMobileEquipmentError_name[1587:1627], 146 | 112: _MMMobileEquipmentError_name[1627:1671], 147 | 113: _MMMobileEquipmentError_name[1671:1714], 148 | 115: _MMMobileEquipmentError_name[1714:1761], 149 | 117: _MMMobileEquipmentError_name[1761:1801], 150 | 122: _MMMobileEquipmentError_name[1801:1837], 151 | 125: _MMMobileEquipmentError_name[1837:1882], 152 | 126: _MMMobileEquipmentError_name[1882:1929], 153 | 127: _MMMobileEquipmentError_name[1929:1974], 154 | 128: _MMMobileEquipmentError_name[1974:2023], 155 | 129: _MMMobileEquipmentError_name[2023:2073], 156 | 130: _MMMobileEquipmentError_name[2073:2127], 157 | 131: _MMMobileEquipmentError_name[2127:2182], 158 | 132: _MMMobileEquipmentError_name[2182:2233], 159 | 133: _MMMobileEquipmentError_name[2233:2285], 160 | 134: _MMMobileEquipmentError_name[2285:2334], 161 | 140: _MMMobileEquipmentError_name[2334:2379], 162 | 141: _MMMobileEquipmentError_name[2379:2432], 163 | 142: _MMMobileEquipmentError_name[2432:2488], 164 | 143: _MMMobileEquipmentError_name[2488:2531], 165 | 144: _MMMobileEquipmentError_name[2531:2585], 166 | 145: _MMMobileEquipmentError_name[2585:2641], 167 | 146: _MMMobileEquipmentError_name[2641:2703], 168 | 148: _MMMobileEquipmentError_name[2703:2736], 169 | 149: _MMMobileEquipmentError_name[2736:2776], 170 | 150: _MMMobileEquipmentError_name[2776:2820], 171 | 151: _MMMobileEquipmentError_name[2820:2882], 172 | 171: _MMMobileEquipmentError_name[2882:2938], 173 | 172: _MMMobileEquipmentError_name[2938:2992], 174 | 173: _MMMobileEquipmentError_name[2992:3034], 175 | 174: _MMMobileEquipmentError_name[3034:3076], 176 | 175: _MMMobileEquipmentError_name[3076:3120], 177 | 176: _MMMobileEquipmentError_name[3120:3170], 178 | 177: _MMMobileEquipmentError_name[3170:3221], 179 | 178: _MMMobileEquipmentError_name[3221:3280], 180 | 179: _MMMobileEquipmentError_name[3280:3330], 181 | 180: _MMMobileEquipmentError_name[3330:3383], 182 | } 183 | 184 | func (i MMMobileEquipmentError) String() string { 185 | if str, ok := _MMMobileEquipmentError_map[i]; ok { 186 | return str 187 | } 188 | return "MMMobileEquipmentError(" + strconv.FormatInt(int64(i), 10) + ")" 189 | } 190 | -------------------------------------------------------------------------------- /mmmodem3gppepsuemodeoperation_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMModem3gppEpsUeModeOperation -trimprefix=MmModem3gppEpsUeModeOperation"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmModem3gppEpsUeModeOperationUnknown-0] 12 | _ = x[MmModem3gppEpsUeModeOperationPs1-1] 13 | _ = x[MmModem3gppEpsUeModeOperationPs2-2] 14 | _ = x[MmModem3gppEpsUeModeOperationCsps1-3] 15 | _ = x[MmModem3gppEpsUeModeOperationCsps2-4] 16 | } 17 | 18 | const _MMModem3gppEpsUeModeOperation_name = "UnknownPs1Ps2Csps1Csps2" 19 | 20 | var _MMModem3gppEpsUeModeOperation_index = [...]uint8{0, 7, 10, 13, 18, 23} 21 | 22 | func (i MMModem3gppEpsUeModeOperation) String() string { 23 | if i >= MMModem3gppEpsUeModeOperation(len(_MMModem3gppEpsUeModeOperation_index)-1) { 24 | return "MMModem3gppEpsUeModeOperation(" + strconv.FormatInt(int64(i), 10) + ")" 25 | } 26 | return _MMModem3gppEpsUeModeOperation_name[_MMModem3gppEpsUeModeOperation_index[i]:_MMModem3gppEpsUeModeOperation_index[i+1]] 27 | } 28 | -------------------------------------------------------------------------------- /mmmodem3gppfacility_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMModem3gppFacility -trimprefix=MmModem3gppFacility"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmModem3gppFacilityNone-0] 12 | _ = x[MmModem3gppFacilitySim-1] 13 | _ = x[MmModem3gppFacilityFixedDialing-2] 14 | _ = x[MmModem3gppFacilityPhSim-4] 15 | _ = x[MmModem3gppFacilityPhFsim-8] 16 | _ = x[MmModem3gppFacilityNetPers-16] 17 | _ = x[MmModem3gppFacilityNetSubPers-32] 18 | _ = x[MmModem3gppFacilityProviderPers-64] 19 | _ = x[MmModem3gppFacilityCorpPers-128] 20 | } 21 | 22 | const ( 23 | _MMModem3gppFacility_name_0 = "NoneSimFixedDialing" 24 | _MMModem3gppFacility_name_1 = "PhSim" 25 | _MMModem3gppFacility_name_2 = "PhFsim" 26 | _MMModem3gppFacility_name_3 = "NetPers" 27 | _MMModem3gppFacility_name_4 = "NetSubPers" 28 | _MMModem3gppFacility_name_5 = "ProviderPers" 29 | _MMModem3gppFacility_name_6 = "CorpPers" 30 | ) 31 | 32 | var ( 33 | _MMModem3gppFacility_index_0 = [...]uint8{0, 4, 7, 19} 34 | ) 35 | 36 | func (i MMModem3gppFacility) String() string { 37 | switch { 38 | case i <= 2: 39 | return _MMModem3gppFacility_name_0[_MMModem3gppFacility_index_0[i]:_MMModem3gppFacility_index_0[i+1]] 40 | case i == 4: 41 | return _MMModem3gppFacility_name_1 42 | case i == 8: 43 | return _MMModem3gppFacility_name_2 44 | case i == 16: 45 | return _MMModem3gppFacility_name_3 46 | case i == 32: 47 | return _MMModem3gppFacility_name_4 48 | case i == 64: 49 | return _MMModem3gppFacility_name_5 50 | case i == 128: 51 | return _MMModem3gppFacility_name_6 52 | default: 53 | return "MMModem3gppFacility(" + strconv.FormatInt(int64(i), 10) + ")" 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /mmmodem3gppnetworkavailability_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMModem3gppNetworkAvailability -trimprefix=MmModem3gppNetworkAvailability"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmModem3gppNetworkAvailabilityUnknown-0] 12 | _ = x[MmModem3gppNetworkAvailabilityAvailable-1] 13 | _ = x[MmModem3gppNetworkAvailabilityCurrent-2] 14 | _ = x[MmModem3gppNetworkAvailabilityForbidden-3] 15 | } 16 | 17 | const _MMModem3gppNetworkAvailability_name = "UnknownAvailableCurrentForbidden" 18 | 19 | var _MMModem3gppNetworkAvailability_index = [...]uint8{0, 7, 16, 23, 32} 20 | 21 | func (i MMModem3gppNetworkAvailability) String() string { 22 | if i >= MMModem3gppNetworkAvailability(len(_MMModem3gppNetworkAvailability_index)-1) { 23 | return "MMModem3gppNetworkAvailability(" + strconv.FormatInt(int64(i), 10) + ")" 24 | } 25 | return _MMModem3gppNetworkAvailability_name[_MMModem3gppNetworkAvailability_index[i]:_MMModem3gppNetworkAvailability_index[i+1]] 26 | } 27 | -------------------------------------------------------------------------------- /mmmodem3gppregistrationstate_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMModem3gppRegistrationState -trimprefix=MmModem3gppRegistrationState"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmModem3gppRegistrationStateIdle-0] 12 | _ = x[MmModem3gppRegistrationStateHome-1] 13 | _ = x[MmModem3gppRegistrationStateSearching-2] 14 | _ = x[MmModem3gppRegistrationStateDenied-3] 15 | _ = x[MmModem3gppRegistrationStateUnknown-4] 16 | _ = x[MmModem3gppRegistrationStateRoaming-5] 17 | _ = x[MmModem3gppRegistrationStateHomeSmsOnly-6] 18 | _ = x[MmModem3gppRegistrationStateRoamingSmsOnly-7] 19 | _ = x[MmModem3gppRegistrationStateEmergencyOnly-8] 20 | _ = x[MmModem3gppRegistrationStateHomeCsfbNotPreferred-9] 21 | _ = x[MmModem3gppRegistrationStateRoamingCsfbNotPreferred-10] 22 | } 23 | 24 | const _MMModem3gppRegistrationState_name = "IdleHomeSearchingDeniedUnknownRoamingHomeSmsOnlyRoamingSmsOnlyEmergencyOnlyHomeCsfbNotPreferredRoamingCsfbNotPreferred" 25 | 26 | var _MMModem3gppRegistrationState_index = [...]uint8{0, 4, 8, 17, 23, 30, 37, 48, 62, 75, 95, 118} 27 | 28 | func (i MMModem3gppRegistrationState) String() string { 29 | if i >= MMModem3gppRegistrationState(len(_MMModem3gppRegistrationState_index)-1) { 30 | return "MMModem3gppRegistrationState(" + strconv.FormatInt(int64(i), 10) + ")" 31 | } 32 | return _MMModem3gppRegistrationState_name[_MMModem3gppRegistrationState_index[i]:_MMModem3gppRegistrationState_index[i+1]] 33 | } 34 | -------------------------------------------------------------------------------- /mmmodem3gppsubscriptionstate_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMModem3gppSubscriptionState -trimprefix=MmModem3gppSubscriptionState"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmModem3gppSubscriptionStateUnknown-0] 12 | _ = x[MmModem3gppSubscriptionStateUnprovisioned-1] 13 | _ = x[MmModem3gppSubscriptionStateProvisioned-2] 14 | _ = x[MmModem3gppSubscriptionStateOutOfData-3] 15 | } 16 | 17 | const _MMModem3gppSubscriptionState_name = "UnknownUnprovisionedProvisionedOutOfData" 18 | 19 | var _MMModem3gppSubscriptionState_index = [...]uint8{0, 7, 20, 31, 40} 20 | 21 | func (i MMModem3gppSubscriptionState) String() string { 22 | if i >= MMModem3gppSubscriptionState(len(_MMModem3gppSubscriptionState_index)-1) { 23 | return "MMModem3gppSubscriptionState(" + strconv.FormatInt(int64(i), 10) + ")" 24 | } 25 | return _MMModem3gppSubscriptionState_name[_MMModem3gppSubscriptionState_index[i]:_MMModem3gppSubscriptionState_index[i+1]] 26 | } 27 | -------------------------------------------------------------------------------- /mmmodem3gppussdsessionstate_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMModem3gppUssdSessionState -trimprefix=MmModem3gppUssdSessionState"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmModem3gppUssdSessionStateUnknown-0] 12 | _ = x[MmModem3gppUssdSessionStateIdle-1] 13 | _ = x[MmModem3gppUssdSessionStateActive-2] 14 | _ = x[MmModem3gppUssdSessionStateUserResponse-3] 15 | } 16 | 17 | const _MMModem3gppUssdSessionState_name = "UnknownIdleActiveUserResponse" 18 | 19 | var _MMModem3gppUssdSessionState_index = [...]uint8{0, 7, 11, 17, 29} 20 | 21 | func (i MMModem3gppUssdSessionState) String() string { 22 | if i >= MMModem3gppUssdSessionState(len(_MMModem3gppUssdSessionState_index)-1) { 23 | return "MMModem3gppUssdSessionState(" + strconv.FormatInt(int64(i), 10) + ")" 24 | } 25 | return _MMModem3gppUssdSessionState_name[_MMModem3gppUssdSessionState_index[i]:_MMModem3gppUssdSessionState_index[i+1]] 26 | } 27 | -------------------------------------------------------------------------------- /mmmodemaccesstechnology_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMModemAccessTechnology -trimprefix=MmModemAccessTechnology"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmModemAccessTechnologyUnknown-0] 12 | _ = x[MmModemAccessTechnologyPots-1] 13 | _ = x[MmModemAccessTechnologyGsm-2] 14 | _ = x[MmModemAccessTechnologyGsmCompact-4] 15 | _ = x[MmModemAccessTechnologyGprs-8] 16 | _ = x[MmModemAccessTechnologyEdge-16] 17 | _ = x[MmModemAccessTechnologyUmts-32] 18 | _ = x[MmModemAccessTechnologyHsdpa-64] 19 | _ = x[MmModemAccessTechnologyHsupa-128] 20 | _ = x[MmModemAccessTechnologyHspa-256] 21 | _ = x[MmModemAccessTechnologyHspaPlus-512] 22 | _ = x[MmModemAccessTechnology1xrtt-1024] 23 | _ = x[MmModemAccessTechnologyEvdo0-2048] 24 | _ = x[MmModemAccessTechnologyEvdoa-4096] 25 | _ = x[MmModemAccessTechnologyEvdob-8192] 26 | _ = x[MmModemAccessTechnologyLte-16384] 27 | _ = x[MmModemAccessTechnologyAny-4294967295] 28 | } 29 | 30 | const _MMModemAccessTechnology_name = "UnknownPotsGsmGsmCompactGprsEdgeUmtsHsdpaHsupaHspaHspaPlus1xrttEvdo0EvdoaEvdobLteAny" 31 | 32 | var _MMModemAccessTechnology_map = map[MMModemAccessTechnology]string{ 33 | 0: _MMModemAccessTechnology_name[0:7], 34 | 1: _MMModemAccessTechnology_name[7:11], 35 | 2: _MMModemAccessTechnology_name[11:14], 36 | 4: _MMModemAccessTechnology_name[14:24], 37 | 8: _MMModemAccessTechnology_name[24:28], 38 | 16: _MMModemAccessTechnology_name[28:32], 39 | 32: _MMModemAccessTechnology_name[32:36], 40 | 64: _MMModemAccessTechnology_name[36:41], 41 | 128: _MMModemAccessTechnology_name[41:46], 42 | 256: _MMModemAccessTechnology_name[46:50], 43 | 512: _MMModemAccessTechnology_name[50:58], 44 | 1024: _MMModemAccessTechnology_name[58:63], 45 | 2048: _MMModemAccessTechnology_name[63:68], 46 | 4096: _MMModemAccessTechnology_name[68:73], 47 | 8192: _MMModemAccessTechnology_name[73:78], 48 | 16384: _MMModemAccessTechnology_name[78:81], 49 | 4294967295: _MMModemAccessTechnology_name[81:84], 50 | } 51 | 52 | func (i MMModemAccessTechnology) String() string { 53 | if str, ok := _MMModemAccessTechnology_map[i]; ok { 54 | return str 55 | } 56 | return "MMModemAccessTechnology(" + strconv.FormatInt(int64(i), 10) + ")" 57 | } 58 | -------------------------------------------------------------------------------- /mmmodemband_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMModemBand -trimprefix=MmModemBand"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmModemBandUnknown-0] 12 | _ = x[MmModemBandEgsm-1] 13 | _ = x[MmModemBandDcs-2] 14 | _ = x[MmModemBandPcs-3] 15 | _ = x[MmModemBandG850-4] 16 | _ = x[MmModemBandUtran1-5] 17 | _ = x[MmModemBandUtran3-6] 18 | _ = x[MmModemBandUtran4-7] 19 | _ = x[MmModemBandUtran6-8] 20 | _ = x[MmModemBandUtran5-9] 21 | _ = x[MmModemBandUtran8-10] 22 | _ = x[MmModemBandUtran9-11] 23 | _ = x[MmModemBandUtran2-12] 24 | _ = x[MmModemBandUtran7-13] 25 | _ = x[MmModemBandG450-14] 26 | _ = x[MmModemBandG480-15] 27 | _ = x[MmModemBandG750-16] 28 | _ = x[MmModemBandG380-17] 29 | _ = x[MmModemBandG410-18] 30 | _ = x[MmModemBandG710-19] 31 | _ = x[MmModemBandG810-20] 32 | _ = x[MmModemBandEutran1-31] 33 | _ = x[MmModemBandEutran2-32] 34 | _ = x[MmModemBandEutran3-33] 35 | _ = x[MmModemBandEutran4-34] 36 | _ = x[MmModemBandEutran5-35] 37 | _ = x[MmModemBandEutran6-36] 38 | _ = x[MmModemBandEutran7-37] 39 | _ = x[MmModemBandEutran8-38] 40 | _ = x[MmModemBandEutran9-39] 41 | _ = x[MmModemBandEutran10-40] 42 | _ = x[MmModemBandEutran11-41] 43 | _ = x[MmModemBandEutran12-42] 44 | _ = x[MmModemBandEutran13-43] 45 | _ = x[MmModemBandEutran14-44] 46 | _ = x[MmModemBandEutran17-47] 47 | _ = x[MmModemBandEutran18-48] 48 | _ = x[MmModemBandEutran19-49] 49 | _ = x[MmModemBandEutran20-50] 50 | _ = x[MmModemBandEutran21-51] 51 | _ = x[MmModemBandEutran22-52] 52 | _ = x[MmModemBandEutran23-53] 53 | _ = x[MmModemBandEutran24-54] 54 | _ = x[MmModemBandEutran25-55] 55 | _ = x[MmModemBandEutran26-56] 56 | _ = x[MmModemBandEutran27-57] 57 | _ = x[MmModemBandEutran28-58] 58 | _ = x[MmModemBandEutran29-59] 59 | _ = x[MmModemBandEutran30-60] 60 | _ = x[MmModemBandEutran31-61] 61 | _ = x[MmModemBandEutran32-62] 62 | _ = x[MmModemBandEutran33-63] 63 | _ = x[MmModemBandEutran34-64] 64 | _ = x[MmModemBandEutran35-65] 65 | _ = x[MmModemBandEutran36-66] 66 | _ = x[MmModemBandEutran37-67] 67 | _ = x[MmModemBandEutran38-68] 68 | _ = x[MmModemBandEutran39-69] 69 | _ = x[MmModemBandEutran40-70] 70 | _ = x[MmModemBandEutran41-71] 71 | _ = x[MmModemBandEutran42-72] 72 | _ = x[MmModemBandEutran43-73] 73 | _ = x[MmModemBandEutran44-74] 74 | _ = x[MmModemBandEutran45-75] 75 | _ = x[MmModemBandEutran46-76] 76 | _ = x[MmModemBandEutran47-77] 77 | _ = x[MmModemBandEutran48-78] 78 | _ = x[MmModemBandEutran49-79] 79 | _ = x[MmModemBandEutran50-80] 80 | _ = x[MmModemBandEutran51-81] 81 | _ = x[MmModemBandEutran52-82] 82 | _ = x[MmModemBandEutran53-83] 83 | _ = x[MmModemBandEutran54-84] 84 | _ = x[MmModemBandEutran55-85] 85 | _ = x[MmModemBandEutran56-86] 86 | _ = x[MmModemBandEutran57-87] 87 | _ = x[MmModemBandEutran58-88] 88 | _ = x[MmModemBandEutran59-89] 89 | _ = x[MmModemBandEutran60-90] 90 | _ = x[MmModemBandEutran61-91] 91 | _ = x[MmModemBandEutran62-92] 92 | _ = x[MmModemBandEutran63-93] 93 | _ = x[MmModemBandEutran64-94] 94 | _ = x[MmModemBandEutran65-95] 95 | _ = x[MmModemBandEutran66-96] 96 | _ = x[MmModemBandEutran67-97] 97 | _ = x[MmModemBandEutran68-98] 98 | _ = x[MmModemBandEutran69-99] 99 | _ = x[MmModemBandEutran70-100] 100 | _ = x[MmModemBandEutran71-101] 101 | _ = x[MmModemBandCdmaBc0-128] 102 | _ = x[MmModemBandCdmaBc1-129] 103 | _ = x[MmModemBandCdmaBc2-130] 104 | _ = x[MmModemBandCdmaBc3-131] 105 | _ = x[MmModemBandCdmaBc4-132] 106 | _ = x[MmModemBandCdmaBc5-134] 107 | _ = x[MmModemBandCdmaBc6-135] 108 | _ = x[MmModemBandCdmaBc7-136] 109 | _ = x[MmModemBandCdmaBc8-137] 110 | _ = x[MmModemBandCdmaBc9-138] 111 | _ = x[MmModemBandCdmaBc10-139] 112 | _ = x[MmModemBandCdmaBc11-140] 113 | _ = x[MmModemBandCdmaBc12-141] 114 | _ = x[MmModemBandCdmaBc13-142] 115 | _ = x[MmModemBandCdmaBc14-143] 116 | _ = x[MmModemBandCdmaBc15-144] 117 | _ = x[MmModemBandCdmaBc16-145] 118 | _ = x[MmModemBandCdmaBc17-146] 119 | _ = x[MmModemBandCdmaBc18-147] 120 | _ = x[MmModemBandCdmaBc19-148] 121 | _ = x[MmModemBandUtran10-210] 122 | _ = x[MmModemBandUtran11-211] 123 | _ = x[MmModemBandUtran12-212] 124 | _ = x[MmModemBandUtran13-213] 125 | _ = x[MmModemBandUtran14-214] 126 | _ = x[MmModemBandUtran19-219] 127 | _ = x[MmModemBandUtran20-220] 128 | _ = x[MmModemBandUtran21-221] 129 | _ = x[MmModemBandUtran22-222] 130 | _ = x[MmModemBandUtran25-225] 131 | _ = x[MmModemBandUtran26-226] 132 | _ = x[MmModemBandUtran32-232] 133 | _ = x[MmModemBandAny-256] 134 | } 135 | 136 | const ( 137 | _MMModemBand_name_0 = "UnknownEgsmDcsPcsG850Utran1Utran3Utran4Utran6Utran5Utran8Utran9Utran2Utran7G450G480G750G380G410G710G810" 138 | _MMModemBand_name_1 = "Eutran1Eutran2Eutran3Eutran4Eutran5Eutran6Eutran7Eutran8Eutran9Eutran10Eutran11Eutran12Eutran13Eutran14" 139 | _MMModemBand_name_2 = "Eutran17Eutran18Eutran19Eutran20Eutran21Eutran22Eutran23Eutran24Eutran25Eutran26Eutran27Eutran28Eutran29Eutran30Eutran31Eutran32Eutran33Eutran34Eutran35Eutran36Eutran37Eutran38Eutran39Eutran40Eutran41Eutran42Eutran43Eutran44Eutran45Eutran46Eutran47Eutran48Eutran49Eutran50Eutran51Eutran52Eutran53Eutran54Eutran55Eutran56Eutran57Eutran58Eutran59Eutran60Eutran61Eutran62Eutran63Eutran64Eutran65Eutran66Eutran67Eutran68Eutran69Eutran70Eutran71" 140 | _MMModemBand_name_3 = "CdmaBc0CdmaBc1CdmaBc2CdmaBc3CdmaBc4" 141 | _MMModemBand_name_4 = "CdmaBc5CdmaBc6CdmaBc7CdmaBc8CdmaBc9CdmaBc10CdmaBc11CdmaBc12CdmaBc13CdmaBc14CdmaBc15CdmaBc16CdmaBc17CdmaBc18CdmaBc19" 142 | _MMModemBand_name_5 = "Utran10Utran11Utran12Utran13Utran14" 143 | _MMModemBand_name_6 = "Utran19Utran20Utran21Utran22" 144 | _MMModemBand_name_7 = "Utran25Utran26" 145 | _MMModemBand_name_8 = "Utran32" 146 | _MMModemBand_name_9 = "Any" 147 | ) 148 | 149 | var ( 150 | _MMModemBand_index_0 = [...]uint8{0, 7, 11, 14, 17, 21, 27, 33, 39, 45, 51, 57, 63, 69, 75, 79, 83, 87, 91, 95, 99, 103} 151 | _MMModemBand_index_1 = [...]uint8{0, 7, 14, 21, 28, 35, 42, 49, 56, 63, 71, 79, 87, 95, 103} 152 | _MMModemBand_index_2 = [...]uint16{0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120, 128, 136, 144, 152, 160, 168, 176, 184, 192, 200, 208, 216, 224, 232, 240, 248, 256, 264, 272, 280, 288, 296, 304, 312, 320, 328, 336, 344, 352, 360, 368, 376, 384, 392, 400, 408, 416, 424, 432, 440} 153 | _MMModemBand_index_3 = [...]uint8{0, 7, 14, 21, 28, 35} 154 | _MMModemBand_index_4 = [...]uint8{0, 7, 14, 21, 28, 35, 43, 51, 59, 67, 75, 83, 91, 99, 107, 115} 155 | _MMModemBand_index_5 = [...]uint8{0, 7, 14, 21, 28, 35} 156 | _MMModemBand_index_6 = [...]uint8{0, 7, 14, 21, 28} 157 | _MMModemBand_index_7 = [...]uint8{0, 7, 14} 158 | ) 159 | 160 | func (i MMModemBand) String() string { 161 | switch { 162 | case i <= 20: 163 | return _MMModemBand_name_0[_MMModemBand_index_0[i]:_MMModemBand_index_0[i+1]] 164 | case 31 <= i && i <= 44: 165 | i -= 31 166 | return _MMModemBand_name_1[_MMModemBand_index_1[i]:_MMModemBand_index_1[i+1]] 167 | case 47 <= i && i <= 101: 168 | i -= 47 169 | return _MMModemBand_name_2[_MMModemBand_index_2[i]:_MMModemBand_index_2[i+1]] 170 | case 128 <= i && i <= 132: 171 | i -= 128 172 | return _MMModemBand_name_3[_MMModemBand_index_3[i]:_MMModemBand_index_3[i+1]] 173 | case 134 <= i && i <= 148: 174 | i -= 134 175 | return _MMModemBand_name_4[_MMModemBand_index_4[i]:_MMModemBand_index_4[i+1]] 176 | case 210 <= i && i <= 214: 177 | i -= 210 178 | return _MMModemBand_name_5[_MMModemBand_index_5[i]:_MMModemBand_index_5[i+1]] 179 | case 219 <= i && i <= 222: 180 | i -= 219 181 | return _MMModemBand_name_6[_MMModemBand_index_6[i]:_MMModemBand_index_6[i+1]] 182 | case 225 <= i && i <= 226: 183 | i -= 225 184 | return _MMModemBand_name_7[_MMModemBand_index_7[i]:_MMModemBand_index_7[i+1]] 185 | case i == 232: 186 | return _MMModemBand_name_8 187 | case i == 256: 188 | return _MMModemBand_name_9 189 | default: 190 | return "MMModemBand(" + strconv.FormatInt(int64(i), 10) + ")" 191 | } 192 | } 193 | -------------------------------------------------------------------------------- /mmmodemcapability_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMModemCapability -trimprefix=MmModemCapability"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmModemCapabilityNone-0] 12 | _ = x[MmModemCapabilityPots-1] 13 | _ = x[MmModemCapabilityCdmaEvdo-2] 14 | _ = x[MmModemCapabilityGsmUmts-4] 15 | _ = x[MmModemCapabilityLte-8] 16 | _ = x[MmModemCapabilityLteAdvanced-16] 17 | _ = x[MmModemCapabilityIridium-32] 18 | _ = x[MmModemCapabilityAny-4294967295] 19 | } 20 | 21 | const ( 22 | _MMModemCapability_name_0 = "NonePotsCdmaEvdo" 23 | _MMModemCapability_name_1 = "GsmUmts" 24 | _MMModemCapability_name_2 = "Lte" 25 | _MMModemCapability_name_3 = "LteAdvanced" 26 | _MMModemCapability_name_4 = "Iridium" 27 | _MMModemCapability_name_5 = "Any" 28 | ) 29 | 30 | var ( 31 | _MMModemCapability_index_0 = [...]uint8{0, 4, 8, 16} 32 | ) 33 | 34 | func (i MMModemCapability) String() string { 35 | switch { 36 | case i <= 2: 37 | return _MMModemCapability_name_0[_MMModemCapability_index_0[i]:_MMModemCapability_index_0[i+1]] 38 | case i == 4: 39 | return _MMModemCapability_name_1 40 | case i == 8: 41 | return _MMModemCapability_name_2 42 | case i == 16: 43 | return _MMModemCapability_name_3 44 | case i == 32: 45 | return _MMModemCapability_name_4 46 | case i == 4294967295: 47 | return _MMModemCapability_name_5 48 | default: 49 | return "MMModemCapability(" + strconv.FormatInt(int64(i), 10) + ")" 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /mmmodemcdmaactivationstate_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMModemCdmaActivationState -trimprefix=MmModemCdmaActivationState"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmModemCdmaActivationStateUnknown-0] 12 | _ = x[MmModemCdmaActivationStateNotActivated-1] 13 | _ = x[MmModemCdmaActivationStateActivating-2] 14 | _ = x[MmModemCdmaActivationStatePartiallyActivated-3] 15 | _ = x[MmModemCdmaActivationStateActivated-4] 16 | } 17 | 18 | const _MMModemCdmaActivationState_name = "UnknownNotActivatedActivatingPartiallyActivatedActivated" 19 | 20 | var _MMModemCdmaActivationState_index = [...]uint8{0, 7, 19, 29, 47, 56} 21 | 22 | func (i MMModemCdmaActivationState) String() string { 23 | if i >= MMModemCdmaActivationState(len(_MMModemCdmaActivationState_index)-1) { 24 | return "MMModemCdmaActivationState(" + strconv.FormatInt(int64(i), 10) + ")" 25 | } 26 | return _MMModemCdmaActivationState_name[_MMModemCdmaActivationState_index[i]:_MMModemCdmaActivationState_index[i+1]] 27 | } 28 | -------------------------------------------------------------------------------- /mmmodemcdmaregistrationstate_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMModemCdmaRegistrationState -trimprefix=MmModemCdmaRegistrationState"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmModemCdmaRegistrationStateUnknown-0] 12 | _ = x[MmModemCdmaRegistrationStateRegistered-1] 13 | _ = x[MmModemCdmaRegistrationStateHome-2] 14 | _ = x[MmModemCdmaRegistrationStateRoaming-3] 15 | } 16 | 17 | const _MMModemCdmaRegistrationState_name = "UnknownRegisteredHomeRoaming" 18 | 19 | var _MMModemCdmaRegistrationState_index = [...]uint8{0, 7, 17, 21, 28} 20 | 21 | func (i MMModemCdmaRegistrationState) String() string { 22 | if i >= MMModemCdmaRegistrationState(len(_MMModemCdmaRegistrationState_index)-1) { 23 | return "MMModemCdmaRegistrationState(" + strconv.FormatInt(int64(i), 10) + ")" 24 | } 25 | return _MMModemCdmaRegistrationState_name[_MMModemCdmaRegistrationState_index[i]:_MMModemCdmaRegistrationState_index[i+1]] 26 | } 27 | -------------------------------------------------------------------------------- /mmmodemcdmarmprotocol_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMModemCdmaRmProtocol -trimprefix=MmModemCdmaRmProtocol"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmModemCdmaRmProtocolUnknown-0] 12 | _ = x[MmModemCdmaRmProtocolAsync-1] 13 | _ = x[MmModemCdmaRmProtocolPacketRelay-2] 14 | _ = x[MmModemCdmaRmProtocolPacketNetworkPpp-3] 15 | _ = x[MmModemCdmaRmProtocolPacketNetworkSlip-4] 16 | _ = x[MmModemCdmaRmProtocolStuIii-5] 17 | } 18 | 19 | const _MMModemCdmaRmProtocol_name = "UnknownAsyncPacketRelayPacketNetworkPppPacketNetworkSlipStuIii" 20 | 21 | var _MMModemCdmaRmProtocol_index = [...]uint8{0, 7, 12, 23, 39, 56, 62} 22 | 23 | func (i MMModemCdmaRmProtocol) String() string { 24 | if i >= MMModemCdmaRmProtocol(len(_MMModemCdmaRmProtocol_index)-1) { 25 | return "MMModemCdmaRmProtocol(" + strconv.FormatInt(int64(i), 10) + ")" 26 | } 27 | return _MMModemCdmaRmProtocol_name[_MMModemCdmaRmProtocol_index[i]:_MMModemCdmaRmProtocol_index[i+1]] 28 | } 29 | -------------------------------------------------------------------------------- /mmmodemcontactsstorage_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMModemContactsStorage -trimprefix=MmModemContactsStorage"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmModemContactsStorageUnknown-0] 12 | _ = x[MmModemContactsStorageMe-1] 13 | _ = x[MmModemContactsStorageSm-2] 14 | _ = x[MmModemContactsStorageMt-3] 15 | } 16 | 17 | const _MMModemContactsStorage_name = "UnknownMeSmMt" 18 | 19 | var _MMModemContactsStorage_index = [...]uint8{0, 7, 9, 11, 13} 20 | 21 | func (i MMModemContactsStorage) String() string { 22 | if i >= MMModemContactsStorage(len(_MMModemContactsStorage_index)-1) { 23 | return "MMModemContactsStorage(" + strconv.FormatInt(int64(i), 10) + ")" 24 | } 25 | return _MMModemContactsStorage_name[_MMModemContactsStorage_index[i]:_MMModemContactsStorage_index[i+1]] 26 | } 27 | -------------------------------------------------------------------------------- /mmmodemfirmwareupdatemethod_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMModemFirmwareUpdateMethod -trimprefix=MmModemFirmwareUpdateMethod"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmModemFirmwareUpdateMethodNone-0] 12 | _ = x[MmModemFirmwareUpdateMethodFastboot-1] 13 | _ = x[MmModemFirmwareUpdateMethodQmiPdc-2] 14 | } 15 | 16 | const _MMModemFirmwareUpdateMethod_name = "NoneFastbootQmiPdc" 17 | 18 | var _MMModemFirmwareUpdateMethod_index = [...]uint8{0, 4, 12, 18} 19 | 20 | func (i MMModemFirmwareUpdateMethod) String() string { 21 | if i >= MMModemFirmwareUpdateMethod(len(_MMModemFirmwareUpdateMethod_index)-1) { 22 | return "MMModemFirmwareUpdateMethod(" + strconv.FormatInt(int64(i), 10) + ")" 23 | } 24 | return _MMModemFirmwareUpdateMethod_name[_MMModemFirmwareUpdateMethod_index[i]:_MMModemFirmwareUpdateMethod_index[i+1]] 25 | } 26 | -------------------------------------------------------------------------------- /mmmodemlocationassistancedatatype_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMModemLocationAssistanceDataType -trimprefix=MmModemLocationAssistanceDataType"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmModemLocationAssistanceDataTypeNone-0] 12 | _ = x[MmModemLocationAssistanceDataTypeXtra-1] 13 | } 14 | 15 | const _MMModemLocationAssistanceDataType_name = "NoneXtra" 16 | 17 | var _MMModemLocationAssistanceDataType_index = [...]uint8{0, 4, 8} 18 | 19 | func (i MMModemLocationAssistanceDataType) String() string { 20 | if i >= MMModemLocationAssistanceDataType(len(_MMModemLocationAssistanceDataType_index)-1) { 21 | return "MMModemLocationAssistanceDataType(" + strconv.FormatInt(int64(i), 10) + ")" 22 | } 23 | return _MMModemLocationAssistanceDataType_name[_MMModemLocationAssistanceDataType_index[i]:_MMModemLocationAssistanceDataType_index[i+1]] 24 | } 25 | -------------------------------------------------------------------------------- /mmmodemlocationsource_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMModemLocationSource -trimprefix=MmModemLocationSource"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmModemLocationSourceNone-0] 12 | _ = x[MmModemLocationSource3gppLacCi-1] 13 | _ = x[MmModemLocationSourceGpsRaw-2] 14 | _ = x[MmModemLocationSourceGpsNmea-4] 15 | _ = x[MmModemLocationSourceCdmaBs-8] 16 | _ = x[MmModemLocationSourceGpsUnmanaged-16] 17 | _ = x[MmModemLocationSourceAgpsMsa-32] 18 | _ = x[MmModemLocationSourceAgpsMsb-64] 19 | } 20 | 21 | const ( 22 | _MMModemLocationSource_name_0 = "None3gppLacCiGpsRaw" 23 | _MMModemLocationSource_name_1 = "GpsNmea" 24 | _MMModemLocationSource_name_2 = "CdmaBs" 25 | _MMModemLocationSource_name_3 = "GpsUnmanaged" 26 | _MMModemLocationSource_name_4 = "AgpsMsa" 27 | _MMModemLocationSource_name_5 = "AgpsMsb" 28 | ) 29 | 30 | var ( 31 | _MMModemLocationSource_index_0 = [...]uint8{0, 4, 13, 19} 32 | ) 33 | 34 | func (i MMModemLocationSource) String() string { 35 | switch { 36 | case i <= 2: 37 | return _MMModemLocationSource_name_0[_MMModemLocationSource_index_0[i]:_MMModemLocationSource_index_0[i+1]] 38 | case i == 4: 39 | return _MMModemLocationSource_name_1 40 | case i == 8: 41 | return _MMModemLocationSource_name_2 42 | case i == 16: 43 | return _MMModemLocationSource_name_3 44 | case i == 32: 45 | return _MMModemLocationSource_name_4 46 | case i == 64: 47 | return _MMModemLocationSource_name_5 48 | default: 49 | return "MMModemLocationSource(" + strconv.FormatInt(int64(i), 10) + ")" 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /mmmodemlock_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMModemLock -trimprefix=MmModemLock"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmModemLockUnknown-0] 12 | _ = x[MmModemLockNone-1] 13 | _ = x[MmModemLockSimPin-2] 14 | _ = x[MmModemLockSimPin2-3] 15 | _ = x[MmModemLockSimPuk-4] 16 | _ = x[MmModemLockSimPuk2-5] 17 | _ = x[MmModemLockPhSpPin-6] 18 | _ = x[MmModemLockPhSpPuk-7] 19 | _ = x[MmModemLockPhNetPin-8] 20 | _ = x[MmModemLockPhNetPuk-9] 21 | _ = x[MmModemLockPhSimPin-10] 22 | _ = x[MmModemLockPhCorpPin-11] 23 | _ = x[MmModemLockPhCorpPuk-12] 24 | _ = x[MmModemLockPhFsimPin-13] 25 | _ = x[MmModemLockPhFsimPuk-14] 26 | _ = x[MmModemLockPhNetsubPin-15] 27 | _ = x[MmModemLockPhNetsubPuk-16] 28 | } 29 | 30 | const _MMModemLock_name = "UnknownNoneSimPinSimPin2SimPukSimPuk2PhSpPinPhSpPukPhNetPinPhNetPukPhSimPinPhCorpPinPhCorpPukPhFsimPinPhFsimPukPhNetsubPinPhNetsubPuk" 31 | 32 | var _MMModemLock_index = [...]uint8{0, 7, 11, 17, 24, 30, 37, 44, 51, 59, 67, 75, 84, 93, 102, 111, 122, 133} 33 | 34 | func (i MMModemLock) String() string { 35 | if i >= MMModemLock(len(_MMModemLock_index)-1) { 36 | return "MMModemLock(" + strconv.FormatInt(int64(i), 10) + ")" 37 | } 38 | return _MMModemLock_name[_MMModemLock_index[i]:_MMModemLock_index[i+1]] 39 | } 40 | -------------------------------------------------------------------------------- /mmmodemmode_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMModemMode -trimprefix=MmModemMode"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmModemModeNone-0] 12 | _ = x[MmModemModeCs-1] 13 | _ = x[MmModemMode2g-2] 14 | _ = x[MmModemMode3g-4] 15 | _ = x[MmModemMode4g-8] 16 | _ = x[MmModemModeAny-4294967295] 17 | } 18 | 19 | const ( 20 | _MMModemMode_name_0 = "NoneCs2g" 21 | _MMModemMode_name_1 = "3g" 22 | _MMModemMode_name_2 = "4g" 23 | _MMModemMode_name_3 = "Any" 24 | ) 25 | 26 | var ( 27 | _MMModemMode_index_0 = [...]uint8{0, 4, 6, 8} 28 | ) 29 | 30 | func (i MMModemMode) String() string { 31 | switch { 32 | case i <= 2: 33 | return _MMModemMode_name_0[_MMModemMode_index_0[i]:_MMModemMode_index_0[i+1]] 34 | case i == 4: 35 | return _MMModemMode_name_1 36 | case i == 8: 37 | return _MMModemMode_name_2 38 | case i == 4294967295: 39 | return _MMModemMode_name_3 40 | default: 41 | return "MMModemMode(" + strconv.FormatInt(int64(i), 10) + ")" 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /mmmodemporttype_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMModemPortType -trimprefix=MmModemPortType"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmModemPortTypeUnknown-1] 12 | _ = x[MmModemPortTypeNet-2] 13 | _ = x[MmModemPortTypeAt-3] 14 | _ = x[MmModemPortTypeQcdm-4] 15 | _ = x[MmModemPortTypeGps-5] 16 | _ = x[MmModemPortTypeQmi-6] 17 | _ = x[MmModemPortTypeMbim-7] 18 | _ = x[MmModemPortTypeAudio-8] 19 | } 20 | 21 | const _MMModemPortType_name = "UnknownNetAtQcdmGpsQmiMbimAudio" 22 | 23 | var _MMModemPortType_index = [...]uint8{0, 7, 10, 12, 16, 19, 22, 26, 31} 24 | 25 | func (i MMModemPortType) String() string { 26 | i -= 1 27 | if i >= MMModemPortType(len(_MMModemPortType_index)-1) { 28 | return "MMModemPortType(" + strconv.FormatInt(int64(i+1), 10) + ")" 29 | } 30 | return _MMModemPortType_name[_MMModemPortType_index[i]:_MMModemPortType_index[i+1]] 31 | } 32 | -------------------------------------------------------------------------------- /mmmodempowerstate_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMModemPowerState -trimprefix=MmModemPowerState"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmModemPowerStateUnknown-0] 12 | _ = x[MmModemPowerStateOff-1] 13 | _ = x[MmModemPowerStateLow-2] 14 | _ = x[MmModemPowerStateOn-3] 15 | } 16 | 17 | const _MMModemPowerState_name = "UnknownOffLowOn" 18 | 19 | var _MMModemPowerState_index = [...]uint8{0, 7, 10, 13, 15} 20 | 21 | func (i MMModemPowerState) String() string { 22 | if i >= MMModemPowerState(len(_MMModemPowerState_index)-1) { 23 | return "MMModemPowerState(" + strconv.FormatInt(int64(i), 10) + ")" 24 | } 25 | return _MMModemPowerState_name[_MMModemPowerState_index[i]:_MMModemPowerState_index[i+1]] 26 | } 27 | -------------------------------------------------------------------------------- /mmmodemstate_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMModemState -trimprefix=MmModemState"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmModemStateFailed - -1] 12 | _ = x[MmModemStateUnknown-0] 13 | _ = x[MmModemStateInitializing-1] 14 | _ = x[MmModemStateLocked-2] 15 | _ = x[MmModemStateDisabled-3] 16 | _ = x[MmModemStateDisabling-4] 17 | _ = x[MmModemStateEnabling-5] 18 | _ = x[MmModemStateEnabled-6] 19 | _ = x[MmModemStateSearching-7] 20 | _ = x[MmModemStateRegistered-8] 21 | _ = x[MmModemStateDisconnecting-9] 22 | _ = x[MmModemStateConnecting-10] 23 | _ = x[MmModemStateConnected-11] 24 | } 25 | 26 | const _MMModemState_name = "FailedUnknownInitializingLockedDisabledDisablingEnablingEnabledSearchingRegisteredDisconnectingConnectingConnected" 27 | 28 | var _MMModemState_index = [...]uint8{0, 6, 13, 25, 31, 39, 48, 56, 63, 72, 82, 95, 105, 114} 29 | 30 | func (i MMModemState) String() string { 31 | i -= -1 32 | if i < 0 || i >= MMModemState(len(_MMModemState_index)-1) { 33 | return "MMModemState(" + strconv.FormatInt(int64(i+-1), 10) + ")" 34 | } 35 | return _MMModemState_name[_MMModemState_index[i]:_MMModemState_index[i+1]] 36 | } 37 | -------------------------------------------------------------------------------- /mmmodemstatechangereason_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMModemStateChangeReason -trimprefix=MmModemStateChangeReason"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmModemStateChangeReasonUnknown-0] 12 | _ = x[MmModemStateChangeReasonUserRequested-1] 13 | _ = x[MmModemStateChangeReasonSuspend-2] 14 | _ = x[MmModemStateChangeReasonFailure-3] 15 | } 16 | 17 | const _MMModemStateChangeReason_name = "UnknownUserRequestedSuspendFailure" 18 | 19 | var _MMModemStateChangeReason_index = [...]uint8{0, 7, 20, 27, 34} 20 | 21 | func (i MMModemStateChangeReason) String() string { 22 | if i >= MMModemStateChangeReason(len(_MMModemStateChangeReason_index)-1) { 23 | return "MMModemStateChangeReason(" + strconv.FormatInt(int64(i), 10) + ")" 24 | } 25 | return _MMModemStateChangeReason_name[_MMModemStateChangeReason_index[i]:_MMModemStateChangeReason_index[i+1]] 26 | } 27 | -------------------------------------------------------------------------------- /mmmodemstatefailedreason_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMModemStateFailedReason -trimprefix=MmModemStateFailedReason"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmModemStateFailedReasonNone-0] 12 | _ = x[MmModemStateFailedReasonUnknown-1] 13 | _ = x[MmModemStateFailedReasonSimMissing-2] 14 | _ = x[MmModemStateFailedReasonSimError-3] 15 | _ = x[MmModemStateFailedReasonUnknownCapabilities-4] 16 | _ = x[MmModemStateFailedReasonEsimWithoutProfiles-5] 17 | } 18 | 19 | const _MMModemStateFailedReason_name = "NoneUnknownSimMissingSimErrorUnknownCapabilitiesEsimWithoutProfiles" 20 | 21 | var _MMModemStateFailedReason_index = [...]uint8{0, 4, 11, 21, 29, 48, 67} 22 | 23 | func (i MMModemStateFailedReason) String() string { 24 | if i >= MMModemStateFailedReason(len(_MMModemStateFailedReason_index)-1) { 25 | return "MMModemStateFailedReason(" + strconv.FormatInt(int64(i), 10) + ")" 26 | } 27 | return _MMModemStateFailedReason_name[_MMModemStateFailedReason_index[i]:_MMModemStateFailedReason_index[i+1]] 28 | } 29 | -------------------------------------------------------------------------------- /mmomafeature_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMOmaFeature -trimprefix=MmOmaFeature"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmOmaFeatureNone-0] 12 | _ = x[MmOmaFeatureDeviceProvisioning-1] 13 | _ = x[MmOmaFeaturePrlUpdate-2] 14 | _ = x[MmOmaFeatureHandsFreeActivation-4] 15 | } 16 | 17 | const ( 18 | _MMOmaFeature_name_0 = "NoneDeviceProvisioningPrlUpdate" 19 | _MMOmaFeature_name_1 = "HandsFreeActivation" 20 | ) 21 | 22 | var ( 23 | _MMOmaFeature_index_0 = [...]uint8{0, 4, 22, 31} 24 | ) 25 | 26 | func (i MMOmaFeature) String() string { 27 | switch { 28 | case i <= 2: 29 | return _MMOmaFeature_name_0[_MMOmaFeature_index_0[i]:_MMOmaFeature_index_0[i+1]] 30 | case i == 4: 31 | return _MMOmaFeature_name_1 32 | default: 33 | return "MMOmaFeature(" + strconv.FormatInt(int64(i), 10) + ")" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /mmomasessionstate_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMOmaSessionState -trimprefix=MmOmaSessionState"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmOmaSessionStateFailed - -1] 12 | _ = x[MmOmaSessionStateUnknown-0] 13 | _ = x[MmOmaSessionStateStarted-1] 14 | _ = x[MmOmaSessionStateRetrying-2] 15 | _ = x[MmOmaSessionStateConnecting-3] 16 | _ = x[MmOmaSessionStateConnected-4] 17 | _ = x[MmOmaSessionStateAuthenticated-5] 18 | _ = x[MmOmaSessionStateMdnDownloaded-10] 19 | _ = x[MmOmaSessionStateMsidDownloaded-11] 20 | _ = x[MmOmaSessionStatePrlDownloaded-12] 21 | _ = x[MmOmaSessionStateMipProfileDownloaded-13] 22 | _ = x[MmOmaSessionStateCompleted-20] 23 | } 24 | 25 | const ( 26 | _MMOmaSessionState_name_0 = "FailedUnknownStartedRetryingConnectingConnectedAuthenticated" 27 | _MMOmaSessionState_name_1 = "MdnDownloadedMsidDownloadedPrlDownloadedMipProfileDownloaded" 28 | _MMOmaSessionState_name_2 = "Completed" 29 | ) 30 | 31 | var ( 32 | _MMOmaSessionState_index_0 = [...]uint8{0, 6, 13, 20, 28, 38, 47, 60} 33 | _MMOmaSessionState_index_1 = [...]uint8{0, 13, 27, 40, 60} 34 | ) 35 | 36 | func (i MMOmaSessionState) String() string { 37 | switch { 38 | case -1 <= i && i <= 5: 39 | i -= -1 40 | return _MMOmaSessionState_name_0[_MMOmaSessionState_index_0[i]:_MMOmaSessionState_index_0[i+1]] 41 | case 10 <= i && i <= 13: 42 | i -= 10 43 | return _MMOmaSessionState_name_1[_MMOmaSessionState_index_1[i]:_MMOmaSessionState_index_1[i+1]] 44 | case i == 20: 45 | return _MMOmaSessionState_name_2 46 | default: 47 | return "MMOmaSessionState(" + strconv.FormatInt(int64(i), 10) + ")" 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /mmomasessionstatefailedreason_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMOmaSessionStateFailedReason -trimprefix=MmOmaSessionStateFailedReason"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmOmaSessionStateFailedReasonUnknown-0] 12 | _ = x[MmOmaSessionStateFailedReasonNetworkUnavailable-1] 13 | _ = x[MmOmaSessionStateFailedReasonServerUnavailable-2] 14 | _ = x[MmOmaSessionStateFailedReasonAuthenticationFailed-3] 15 | _ = x[MmOmaSessionStateFailedReasonMaxRetryExceeded-4] 16 | _ = x[MmOmaSessionStateFailedReasonSessionCancelled-5] 17 | } 18 | 19 | const _MMOmaSessionStateFailedReason_name = "UnknownNetworkUnavailableServerUnavailableAuthenticationFailedMaxRetryExceededSessionCancelled" 20 | 21 | var _MMOmaSessionStateFailedReason_index = [...]uint8{0, 7, 25, 42, 62, 78, 94} 22 | 23 | func (i MMOmaSessionStateFailedReason) String() string { 24 | if i >= MMOmaSessionStateFailedReason(len(_MMOmaSessionStateFailedReason_index)-1) { 25 | return "MMOmaSessionStateFailedReason(" + strconv.FormatInt(int64(i), 10) + ")" 26 | } 27 | return _MMOmaSessionStateFailedReason_name[_MMOmaSessionStateFailedReason_index[i]:_MMOmaSessionStateFailedReason_index[i+1]] 28 | } 29 | -------------------------------------------------------------------------------- /mmomasessiontype_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMOmaSessionType -trimprefix=MmOmaSessionType"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmOmaSessionTypeUnknown-0] 12 | _ = x[MmOmaSessionTypeClientInitiatedDeviceConfigure-10] 13 | _ = x[MmOmaSessionTypeClientInitiatedPrlUpdate-11] 14 | _ = x[MmOmaSessionTypeClientInitiatedHandsFreeActivation-12] 15 | _ = x[MmOmaSessionTypeNetworkInitiatedDeviceConfigure-20] 16 | _ = x[MmOmaSessionTypeNetworkInitiatedPrlUpdate-21] 17 | _ = x[MmOmaSessionTypeDeviceInitiatedPrlUpdate-30] 18 | _ = x[MmOmaSessionTypeDeviceInitiatedHandsFreeActivation-31] 19 | } 20 | 21 | const ( 22 | _MMOmaSessionType_name_0 = "Unknown" 23 | _MMOmaSessionType_name_1 = "ClientInitiatedDeviceConfigureClientInitiatedPrlUpdateClientInitiatedHandsFreeActivation" 24 | _MMOmaSessionType_name_2 = "NetworkInitiatedDeviceConfigureNetworkInitiatedPrlUpdate" 25 | _MMOmaSessionType_name_3 = "DeviceInitiatedPrlUpdateDeviceInitiatedHandsFreeActivation" 26 | ) 27 | 28 | var ( 29 | _MMOmaSessionType_index_1 = [...]uint8{0, 30, 54, 88} 30 | _MMOmaSessionType_index_2 = [...]uint8{0, 31, 56} 31 | _MMOmaSessionType_index_3 = [...]uint8{0, 24, 58} 32 | ) 33 | 34 | func (i MMOmaSessionType) String() string { 35 | switch { 36 | case i == 0: 37 | return _MMOmaSessionType_name_0 38 | case 10 <= i && i <= 12: 39 | i -= 10 40 | return _MMOmaSessionType_name_1[_MMOmaSessionType_index_1[i]:_MMOmaSessionType_index_1[i+1]] 41 | case 20 <= i && i <= 21: 42 | i -= 20 43 | return _MMOmaSessionType_name_2[_MMOmaSessionType_index_2[i]:_MMOmaSessionType_index_2[i+1]] 44 | case 30 <= i && i <= 31: 45 | i -= 30 46 | return _MMOmaSessionType_name_3[_MMOmaSessionType_index_3[i]:_MMOmaSessionType_index_3[i+1]] 47 | default: 48 | return "MMOmaSessionType(" + strconv.FormatInt(int64(i), 10) + ")" 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /mmserialerror_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMSerialError -trimprefix=MMSerialError"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmSerialErrorUnknown-0] 12 | _ = x[MmSerialErrorOpenFailed-1] 13 | _ = x[MmSerialErrorSendFailed-2] 14 | _ = x[MmSerialErrorResponseTimeout-3] 15 | _ = x[MmSerialErrorOpenFailedNoDevice-4] 16 | _ = x[MmSerialErrorFlashFailed-5] 17 | _ = x[MmSerialErrorNotOpen-6] 18 | _ = x[MmSerialErrorParseFailed-7] 19 | _ = x[MmSerialErrorFrameNotFound-8] 20 | } 21 | 22 | const _MMSerialError_name = "MmSerialErrorUnknownMmSerialErrorOpenFailedMmSerialErrorSendFailedMmSerialErrorResponseTimeoutMmSerialErrorOpenFailedNoDeviceMmSerialErrorFlashFailedMmSerialErrorNotOpenMmSerialErrorParseFailedMmSerialErrorFrameNotFound" 23 | 24 | var _MMSerialError_index = [...]uint8{0, 20, 43, 66, 94, 125, 149, 169, 193, 219} 25 | 26 | func (i MMSerialError) String() string { 27 | if i >= MMSerialError(len(_MMSerialError_index)-1) { 28 | return "MMSerialError(" + strconv.FormatInt(int64(i), 10) + ")" 29 | } 30 | return _MMSerialError_name[_MMSerialError_index[i]:_MMSerialError_index[i+1]] 31 | } 32 | -------------------------------------------------------------------------------- /mmsignalpropertytype_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMSignalPropertyType -trimprefix=MMSignalPropertyType"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MMSignalPropertyTypeCdma-0] 12 | _ = x[MMSignalPropertyTypeEvdo-1] 13 | _ = x[MMSignalPropertyTypeGsm-2] 14 | _ = x[MMSignalPropertyTypeUmts-3] 15 | _ = x[MMSignalPropertyTypeLte-4] 16 | } 17 | 18 | const _MMSignalPropertyType_name = "CdmaEvdoGsmUmtsLte" 19 | 20 | var _MMSignalPropertyType_index = [...]uint8{0, 4, 8, 11, 15, 18} 21 | 22 | func (i MMSignalPropertyType) String() string { 23 | if i >= MMSignalPropertyType(len(_MMSignalPropertyType_index)-1) { 24 | return "MMSignalPropertyType(" + strconv.FormatInt(int64(i), 10) + ")" 25 | } 26 | return _MMSignalPropertyType_name[_MMSignalPropertyType_index[i]:_MMSignalPropertyType_index[i+1]] 27 | } 28 | -------------------------------------------------------------------------------- /mmsmscdmaservicecategory_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMSmsCdmaServiceCategory -trimprefix=MmSmsCdmaServiceCategory"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmSmsCdmaServiceCategoryUnknown-0] 12 | _ = x[MmSmsCdmaServiceCategoryEmergencyBroadcast-1] 13 | _ = x[MmSmsCdmaServiceCategoryAdministrative-2] 14 | _ = x[MmSmsCdmaServiceCategoryMaintenance-3] 15 | _ = x[MmSmsCdmaServiceCategoryGeneralNewsLocal-4] 16 | _ = x[MmSmsCdmaServiceCategoryGeneralNewsRegional-5] 17 | _ = x[MmSmsCdmaServiceCategoryGeneralNewsNational-6] 18 | _ = x[MmSmsCdmaServiceCategoryGeneralNewsInternational-7] 19 | _ = x[MmSmsCdmaServiceCategoryBusinessNewsLocal-8] 20 | _ = x[MmSmsCdmaServiceCategoryBusinessNewsRegional-9] 21 | _ = x[MmSmsCdmaServiceCategoryBusinessNewsNational-10] 22 | _ = x[MmSmsCdmaServiceCategoryBusinessNewsInternational-11] 23 | _ = x[MmSmsCdmaServiceCategorySportsNewsLocal-12] 24 | _ = x[MmSmsCdmaServiceCategorySportsNewsRegional-13] 25 | _ = x[MmSmsCdmaServiceCategorySportsNewsNational-14] 26 | _ = x[MmSmsCdmaServiceCategorySportsNewsInternational-15] 27 | _ = x[MmSmsCdmaServiceCategoryEntertainmentNewsLocal-16] 28 | _ = x[MmSmsCdmaServiceCategoryEntertainmentNewsRegional-17] 29 | _ = x[MmSmsCdmaServiceCategoryEntertainmentNewsNational-18] 30 | _ = x[MmSmsCdmaServiceCategoryEntertainmentNewsInternational-19] 31 | _ = x[MmSmsCdmaServiceCategoryLocalWeather-20] 32 | _ = x[MmSmsCdmaServiceCategoryTrafficReport-21] 33 | _ = x[MmSmsCdmaServiceCategoryFlightSchedules-22] 34 | _ = x[MmSmsCdmaServiceCategoryRestaurants-23] 35 | _ = x[MmSmsCdmaServiceCategoryLodgings-24] 36 | _ = x[MmSmsCdmaServiceCategoryRetailDirectory-25] 37 | _ = x[MmSmsCdmaServiceCategoryAdvertisements-26] 38 | _ = x[MmSmsCdmaServiceCategoryStockQuotes-27] 39 | _ = x[MmSmsCdmaServiceCategoryEmployment-28] 40 | _ = x[MmSmsCdmaServiceCategoryHospitals-29] 41 | _ = x[MmSmsCdmaServiceCategoryTechnologyNews-30] 42 | _ = x[MmSmsCdmaServiceCategoryMulticategory-31] 43 | _ = x[MmSmsCdmaServiceCategoryCmasPresidentialAlert-4096] 44 | _ = x[MmSmsCdmaServiceCategoryCmasExtremeThreat-4097] 45 | _ = x[MmSmsCdmaServiceCategoryCmasSevereThreat-4098] 46 | _ = x[MmSmsCdmaServiceCategoryCmasChildAbductionEmergency-4099] 47 | _ = x[MmSmsCdmaServiceCategoryCmasTest-4100] 48 | } 49 | 50 | const ( 51 | _MMSmsCdmaServiceCategory_name_0 = "UnknownEmergencyBroadcastAdministrativeMaintenanceGeneralNewsLocalGeneralNewsRegionalGeneralNewsNationalGeneralNewsInternationalBusinessNewsLocalBusinessNewsRegionalBusinessNewsNationalBusinessNewsInternationalSportsNewsLocalSportsNewsRegionalSportsNewsNationalSportsNewsInternationalEntertainmentNewsLocalEntertainmentNewsRegionalEntertainmentNewsNationalEntertainmentNewsInternationalLocalWeatherTrafficReportFlightSchedulesRestaurantsLodgingsRetailDirectoryAdvertisementsStockQuotesEmploymentHospitalsTechnologyNewsMulticategory" 52 | _MMSmsCdmaServiceCategory_name_1 = "CmasPresidentialAlertCmasExtremeThreatCmasSevereThreatCmasChildAbductionEmergencyCmasTest" 53 | ) 54 | 55 | var ( 56 | _MMSmsCdmaServiceCategory_index_0 = [...]uint16{0, 7, 25, 39, 50, 66, 85, 104, 128, 145, 165, 185, 210, 225, 243, 261, 284, 306, 331, 356, 386, 398, 411, 426, 437, 445, 460, 474, 485, 495, 504, 518, 531} 57 | _MMSmsCdmaServiceCategory_index_1 = [...]uint8{0, 21, 38, 54, 81, 89} 58 | ) 59 | 60 | func (i MMSmsCdmaServiceCategory) String() string { 61 | switch { 62 | case i <= 31: 63 | return _MMSmsCdmaServiceCategory_name_0[_MMSmsCdmaServiceCategory_index_0[i]:_MMSmsCdmaServiceCategory_index_0[i+1]] 64 | case 4096 <= i && i <= 4100: 65 | i -= 4096 66 | return _MMSmsCdmaServiceCategory_name_1[_MMSmsCdmaServiceCategory_index_1[i]:_MMSmsCdmaServiceCategory_index_1[i+1]] 67 | default: 68 | return "MMSmsCdmaServiceCategory(" + strconv.FormatInt(int64(i), 10) + ")" 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /mmsmscdmateleserviceid_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMSmsCdmaTeleserviceId -trimprefix=MmSmsCdmaTeleserviceId"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmSmsCdmaTeleserviceIdUnknown-0] 12 | _ = x[MmSmsCdmaTeleserviceIdCmt91-4096] 13 | _ = x[MmSmsCdmaTeleserviceIdWpt-4097] 14 | _ = x[MmSmsCdmaTeleserviceIdWmt-4098] 15 | _ = x[MmSmsCdmaTeleserviceIdVmn-4099] 16 | _ = x[MmSmsCdmaTeleserviceIdWap-4100] 17 | _ = x[MmSmsCdmaTeleserviceIdWemt-4101] 18 | _ = x[MmSmsCdmaTeleserviceIdScpt-4102] 19 | _ = x[MmSmsCdmaTeleserviceIdCatpt-4103] 20 | } 21 | 22 | const ( 23 | _MMSmsCdmaTeleserviceId_name_0 = "Unknown" 24 | _MMSmsCdmaTeleserviceId_name_1 = "Cmt91WptWmtVmnWapWemtScptCatpt" 25 | ) 26 | 27 | var ( 28 | _MMSmsCdmaTeleserviceId_index_1 = [...]uint8{0, 5, 8, 11, 14, 17, 21, 25, 30} 29 | ) 30 | 31 | func (i MMSmsCdmaTeleserviceId) String() string { 32 | switch { 33 | case i == 0: 34 | return _MMSmsCdmaTeleserviceId_name_0 35 | case 4096 <= i && i <= 4103: 36 | i -= 4096 37 | return _MMSmsCdmaTeleserviceId_name_1[_MMSmsCdmaTeleserviceId_index_1[i]:_MMSmsCdmaTeleserviceId_index_1[i+1]] 38 | default: 39 | return "MMSmsCdmaTeleserviceId(" + strconv.FormatInt(int64(i), 10) + ")" 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /mmsmsdeliverystate_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMSmsDeliveryState -trimprefix=MmSmsDeliveryState"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmSmsDeliveryStateCompletedReceived-0] 12 | _ = x[MmSmsDeliveryStateCompletedForwardedUnconfirmed-1] 13 | _ = x[MmSmsDeliveryStateCompletedReplacedBySc-2] 14 | _ = x[MmSmsDeliveryStateTemporaryErrorCongestion-32] 15 | _ = x[MmSmsDeliveryStateTemporaryErrorSmeBusy-33] 16 | _ = x[MmSmsDeliveryStateTemporaryErrorNoResponseFromSme-34] 17 | _ = x[MmSmsDeliveryStateTemporaryErrorServiceRejected-35] 18 | _ = x[MmSmsDeliveryStateTemporaryErrorQosNotAvailable-36] 19 | _ = x[MmSmsDeliveryStateTemporaryErrorInSme-37] 20 | _ = x[MmSmsDeliveryStateErrorRemoteProcedure-64] 21 | _ = x[MmSmsDeliveryStateErrorIncompatibleDestination-65] 22 | _ = x[MmSmsDeliveryStateErrorConnectionRejected-66] 23 | _ = x[MmSmsDeliveryStateErrorNotObtainable-67] 24 | _ = x[MmSmsDeliveryStateErrorQosNotAvailable-68] 25 | _ = x[MmSmsDeliveryStateErrorNoInterworkingAvailable-69] 26 | _ = x[MmSmsDeliveryStateErrorValidityPeriodExpired-70] 27 | _ = x[MmSmsDeliveryStateErrorDeletedByOriginatingSme-71] 28 | _ = x[MmSmsDeliveryStateErrorDeletedByScAdministration-72] 29 | _ = x[MmSmsDeliveryStateErrorMessageDoesNotExist-73] 30 | _ = x[MmSmsDeliveryStateTemporaryFatalErrorCongestion-96] 31 | _ = x[MmSmsDeliveryStateTemporaryFatalErrorSmeBusy-97] 32 | _ = x[MmSmsDeliveryStateTemporaryFatalErrorNoResponseFromSme-98] 33 | _ = x[MmSmsDeliveryStateTemporaryFatalErrorServiceRejected-99] 34 | _ = x[MmSmsDeliveryStateTemporaryFatalErrorQosNotAvailable-100] 35 | _ = x[MmSmsDeliveryStateTemporaryFatalErrorInSme-101] 36 | _ = x[MmSmsDeliveryStateUnknown-256] 37 | _ = x[MmSmsDeliveryStateNetworkProblemAddressVacant-512] 38 | _ = x[MmSmsDeliveryStateNetworkProblemAddressTranslationFailure-513] 39 | _ = x[MmSmsDeliveryStateNetworkProblemNetworkResourceOutage-514] 40 | _ = x[MmSmsDeliveryStateNetworkProblemNetworkFailure-515] 41 | _ = x[MmSmsDeliveryStateNetworkProblemInvalidTeleserviceId-516] 42 | _ = x[MmSmsDeliveryStateNetworkProblemOther-517] 43 | _ = x[MmSmsDeliveryStateTerminalProblemNoPageResponse-544] 44 | _ = x[MmSmsDeliveryStateTerminalProblemDestinationBusy-545] 45 | _ = x[MmSmsDeliveryStateTerminalProblemNoAcknowledgment-546] 46 | _ = x[MmSmsDeliveryStateTerminalProblemDestinationResourceShortage-547] 47 | _ = x[MmSmsDeliveryStateTerminalProblemSmsDeliveryPostponed-548] 48 | _ = x[MmSmsDeliveryStateTerminalProblemDestinationOutOfService-549] 49 | _ = x[MmSmsDeliveryStateTerminalProblemDestinationNoLongerAtThisAddress-550] 50 | _ = x[MmSmsDeliveryStateTerminalProblemOther-551] 51 | _ = x[MmSmsDeliveryStateRadioInterfaceProblemResourceShortage-576] 52 | _ = x[MmSmsDeliveryStateRadioInterfaceProblemIncompatibility-577] 53 | _ = x[MmSmsDeliveryStateRadioInterfaceProblemOther-578] 54 | _ = x[MmSmsDeliveryStateGeneralProblemEncoding-608] 55 | _ = x[MmSmsDeliveryStateGeneralProblemSmsOriginationDenied-609] 56 | _ = x[MmSmsDeliveryStateGeneralProblemSmsTerminationDenied-610] 57 | _ = x[MmSmsDeliveryStateGeneralProblemSupplementaryServiceNotSupported-611] 58 | _ = x[MmSmsDeliveryStateGeneralProblemSmsNotSupported-612] 59 | _ = x[MmSmsDeliveryStateGeneralProblemMissingExpectedParameter-614] 60 | _ = x[MmSmsDeliveryStateGeneralProblemMissingMandatoryParameter-615] 61 | _ = x[MmSmsDeliveryStateGeneralProblemUnrecognizedParameterValue-616] 62 | _ = x[MmSmsDeliveryStateGeneralProblemUnexpectedParameterValue-617] 63 | _ = x[MmSmsDeliveryStateGeneralProblemUserDataSizeError-618] 64 | _ = x[MmSmsDeliveryStateGeneralProblemOther-619] 65 | _ = x[MmSmsDeliveryStateTemporaryNetworkProblemAddressVacant-768] 66 | _ = x[MmSmsDeliveryStateTemporaryNetworkProblemAddressTranslationFailure-769] 67 | _ = x[MmSmsDeliveryStateTemporaryNetworkProblemNetworkResourceOutage-770] 68 | _ = x[MmSmsDeliveryStateTemporaryNetworkProblemNetworkFailure-771] 69 | _ = x[MmSmsDeliveryStateTemporaryNetworkProblemInvalidTeleserviceId-772] 70 | _ = x[MmSmsDeliveryStateTemporaryNetworkProblemOther-773] 71 | _ = x[MmSmsDeliveryStateTemporaryTerminalProblemNoPageResponse-800] 72 | _ = x[MmSmsDeliveryStateTemporaryTerminalProblemDestinationBusy-801] 73 | _ = x[MmSmsDeliveryStateTemporaryTerminalProblemNoAcknowledgment-802] 74 | _ = x[MmSmsDeliveryStateTemporaryTerminalProblemDestinationResourceShortage-803] 75 | _ = x[MmSmsDeliveryStateTemporaryTerminalProblemSmsDeliveryPostponed-804] 76 | _ = x[MmSmsDeliveryStateTemporaryTerminalProblemDestinationOutOfService-805] 77 | _ = x[MmSmsDeliveryStateTemporaryTerminalProblemDestinationNoLongerAtThisAddress-806] 78 | _ = x[MmSmsDeliveryStateTemporaryTerminalProblemOther-807] 79 | _ = x[MmSmsDeliveryStateTemporaryRadioInterfaceProblemResourceShortage-832] 80 | _ = x[MmSmsDeliveryStateTemporaryRadioInterfaceProblemIncompatibility-833] 81 | _ = x[MmSmsDeliveryStateTemporaryRadioInterfaceProblemOther-834] 82 | _ = x[MmSmsDeliveryStateTemporaryGeneralProblemEncoding-864] 83 | _ = x[MmSmsDeliveryStateTemporaryGeneralProblemSmsOriginationDenied-865] 84 | _ = x[MmSmsDeliveryStateTemporaryGeneralProblemSmsTerminationDenied-866] 85 | _ = x[MmSmsDeliveryStateTemporaryGeneralProblemSupplementaryServiceNotSupported-867] 86 | _ = x[MmSmsDeliveryStateTemporaryGeneralProblemSmsNotSupported-868] 87 | _ = x[MmSmsDeliveryStateTemporaryGeneralProblemMissingExpectedParameter-870] 88 | _ = x[MmSmsDeliveryStateTemporaryGeneralProblemMissingMandatoryParameter-871] 89 | _ = x[MmSmsDeliveryStateTemporaryGeneralProblemUnrecognizedParameterValue-872] 90 | _ = x[MmSmsDeliveryStateTemporaryGeneralProblemUnexpectedParameterValue-873] 91 | _ = x[MmSmsDeliveryStateTemporaryGeneralProblemUserDataSizeError-874] 92 | _ = x[MmSmsDeliveryStateTemporaryGeneralProblemOther-875] 93 | } 94 | 95 | const _MMSmsDeliveryState_name = "CompletedReceivedCompletedForwardedUnconfirmedCompletedReplacedByScTemporaryErrorCongestionTemporaryErrorSmeBusyTemporaryErrorNoResponseFromSmeTemporaryErrorServiceRejectedTemporaryErrorQosNotAvailableTemporaryErrorInSmeErrorRemoteProcedureErrorIncompatibleDestinationErrorConnectionRejectedErrorNotObtainableErrorQosNotAvailableErrorNoInterworkingAvailableErrorValidityPeriodExpiredErrorDeletedByOriginatingSmeErrorDeletedByScAdministrationErrorMessageDoesNotExistTemporaryFatalErrorCongestionTemporaryFatalErrorSmeBusyTemporaryFatalErrorNoResponseFromSmeTemporaryFatalErrorServiceRejectedTemporaryFatalErrorQosNotAvailableTemporaryFatalErrorInSmeUnknownNetworkProblemAddressVacantNetworkProblemAddressTranslationFailureNetworkProblemNetworkResourceOutageNetworkProblemNetworkFailureNetworkProblemInvalidTeleserviceIdNetworkProblemOtherTerminalProblemNoPageResponseTerminalProblemDestinationBusyTerminalProblemNoAcknowledgmentTerminalProblemDestinationResourceShortageTerminalProblemSmsDeliveryPostponedTerminalProblemDestinationOutOfServiceTerminalProblemDestinationNoLongerAtThisAddressTerminalProblemOtherRadioInterfaceProblemResourceShortageRadioInterfaceProblemIncompatibilityRadioInterfaceProblemOtherGeneralProblemEncodingGeneralProblemSmsOriginationDeniedGeneralProblemSmsTerminationDeniedGeneralProblemSupplementaryServiceNotSupportedGeneralProblemSmsNotSupportedGeneralProblemMissingExpectedParameterGeneralProblemMissingMandatoryParameterGeneralProblemUnrecognizedParameterValueGeneralProblemUnexpectedParameterValueGeneralProblemUserDataSizeErrorGeneralProblemOtherTemporaryNetworkProblemAddressVacantTemporaryNetworkProblemAddressTranslationFailureTemporaryNetworkProblemNetworkResourceOutageTemporaryNetworkProblemNetworkFailureTemporaryNetworkProblemInvalidTeleserviceIdTemporaryNetworkProblemOtherTemporaryTerminalProblemNoPageResponseTemporaryTerminalProblemDestinationBusyTemporaryTerminalProblemNoAcknowledgmentTemporaryTerminalProblemDestinationResourceShortageTemporaryTerminalProblemSmsDeliveryPostponedTemporaryTerminalProblemDestinationOutOfServiceTemporaryTerminalProblemDestinationNoLongerAtThisAddressTemporaryTerminalProblemOtherTemporaryRadioInterfaceProblemResourceShortageTemporaryRadioInterfaceProblemIncompatibilityTemporaryRadioInterfaceProblemOtherTemporaryGeneralProblemEncodingTemporaryGeneralProblemSmsOriginationDeniedTemporaryGeneralProblemSmsTerminationDeniedTemporaryGeneralProblemSupplementaryServiceNotSupportedTemporaryGeneralProblemSmsNotSupportedTemporaryGeneralProblemMissingExpectedParameterTemporaryGeneralProblemMissingMandatoryParameterTemporaryGeneralProblemUnrecognizedParameterValueTemporaryGeneralProblemUnexpectedParameterValueTemporaryGeneralProblemUserDataSizeErrorTemporaryGeneralProblemOther" 96 | 97 | var _MMSmsDeliveryState_map = map[MMSmsDeliveryState]string{ 98 | 0: _MMSmsDeliveryState_name[0:17], 99 | 1: _MMSmsDeliveryState_name[17:46], 100 | 2: _MMSmsDeliveryState_name[46:67], 101 | 32: _MMSmsDeliveryState_name[67:91], 102 | 33: _MMSmsDeliveryState_name[91:112], 103 | 34: _MMSmsDeliveryState_name[112:143], 104 | 35: _MMSmsDeliveryState_name[143:172], 105 | 36: _MMSmsDeliveryState_name[172:201], 106 | 37: _MMSmsDeliveryState_name[201:220], 107 | 64: _MMSmsDeliveryState_name[220:240], 108 | 65: _MMSmsDeliveryState_name[240:268], 109 | 66: _MMSmsDeliveryState_name[268:291], 110 | 67: _MMSmsDeliveryState_name[291:309], 111 | 68: _MMSmsDeliveryState_name[309:329], 112 | 69: _MMSmsDeliveryState_name[329:357], 113 | 70: _MMSmsDeliveryState_name[357:383], 114 | 71: _MMSmsDeliveryState_name[383:411], 115 | 72: _MMSmsDeliveryState_name[411:441], 116 | 73: _MMSmsDeliveryState_name[441:465], 117 | 96: _MMSmsDeliveryState_name[465:494], 118 | 97: _MMSmsDeliveryState_name[494:520], 119 | 98: _MMSmsDeliveryState_name[520:556], 120 | 99: _MMSmsDeliveryState_name[556:590], 121 | 100: _MMSmsDeliveryState_name[590:624], 122 | 101: _MMSmsDeliveryState_name[624:648], 123 | 256: _MMSmsDeliveryState_name[648:655], 124 | 512: _MMSmsDeliveryState_name[655:682], 125 | 513: _MMSmsDeliveryState_name[682:721], 126 | 514: _MMSmsDeliveryState_name[721:756], 127 | 515: _MMSmsDeliveryState_name[756:784], 128 | 516: _MMSmsDeliveryState_name[784:818], 129 | 517: _MMSmsDeliveryState_name[818:837], 130 | 544: _MMSmsDeliveryState_name[837:866], 131 | 545: _MMSmsDeliveryState_name[866:896], 132 | 546: _MMSmsDeliveryState_name[896:927], 133 | 547: _MMSmsDeliveryState_name[927:969], 134 | 548: _MMSmsDeliveryState_name[969:1004], 135 | 549: _MMSmsDeliveryState_name[1004:1042], 136 | 550: _MMSmsDeliveryState_name[1042:1089], 137 | 551: _MMSmsDeliveryState_name[1089:1109], 138 | 576: _MMSmsDeliveryState_name[1109:1146], 139 | 577: _MMSmsDeliveryState_name[1146:1182], 140 | 578: _MMSmsDeliveryState_name[1182:1208], 141 | 608: _MMSmsDeliveryState_name[1208:1230], 142 | 609: _MMSmsDeliveryState_name[1230:1264], 143 | 610: _MMSmsDeliveryState_name[1264:1298], 144 | 611: _MMSmsDeliveryState_name[1298:1344], 145 | 612: _MMSmsDeliveryState_name[1344:1373], 146 | 614: _MMSmsDeliveryState_name[1373:1411], 147 | 615: _MMSmsDeliveryState_name[1411:1450], 148 | 616: _MMSmsDeliveryState_name[1450:1490], 149 | 617: _MMSmsDeliveryState_name[1490:1528], 150 | 618: _MMSmsDeliveryState_name[1528:1559], 151 | 619: _MMSmsDeliveryState_name[1559:1578], 152 | 768: _MMSmsDeliveryState_name[1578:1614], 153 | 769: _MMSmsDeliveryState_name[1614:1662], 154 | 770: _MMSmsDeliveryState_name[1662:1706], 155 | 771: _MMSmsDeliveryState_name[1706:1743], 156 | 772: _MMSmsDeliveryState_name[1743:1786], 157 | 773: _MMSmsDeliveryState_name[1786:1814], 158 | 800: _MMSmsDeliveryState_name[1814:1852], 159 | 801: _MMSmsDeliveryState_name[1852:1891], 160 | 802: _MMSmsDeliveryState_name[1891:1931], 161 | 803: _MMSmsDeliveryState_name[1931:1982], 162 | 804: _MMSmsDeliveryState_name[1982:2026], 163 | 805: _MMSmsDeliveryState_name[2026:2073], 164 | 806: _MMSmsDeliveryState_name[2073:2129], 165 | 807: _MMSmsDeliveryState_name[2129:2158], 166 | 832: _MMSmsDeliveryState_name[2158:2204], 167 | 833: _MMSmsDeliveryState_name[2204:2249], 168 | 834: _MMSmsDeliveryState_name[2249:2284], 169 | 864: _MMSmsDeliveryState_name[2284:2315], 170 | 865: _MMSmsDeliveryState_name[2315:2358], 171 | 866: _MMSmsDeliveryState_name[2358:2401], 172 | 867: _MMSmsDeliveryState_name[2401:2456], 173 | 868: _MMSmsDeliveryState_name[2456:2494], 174 | 870: _MMSmsDeliveryState_name[2494:2541], 175 | 871: _MMSmsDeliveryState_name[2541:2589], 176 | 872: _MMSmsDeliveryState_name[2589:2638], 177 | 873: _MMSmsDeliveryState_name[2638:2685], 178 | 874: _MMSmsDeliveryState_name[2685:2725], 179 | 875: _MMSmsDeliveryState_name[2725:2753], 180 | } 181 | 182 | func (i MMSmsDeliveryState) String() string { 183 | if str, ok := _MMSmsDeliveryState_map[i]; ok { 184 | return str 185 | } 186 | return "MMSmsDeliveryState(" + strconv.FormatInt(int64(i), 10) + ")" 187 | } 188 | -------------------------------------------------------------------------------- /mmsmspdutype_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMSmsPduType -trimprefix=MmSmsPduType"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmSmsPduTypeUnknown-0] 12 | _ = x[MmSmsPduTypeDeliver-1] 13 | _ = x[MmSmsPduTypeSubmit-2] 14 | _ = x[MmSmsPduTypeStatusReport-3] 15 | _ = x[MmSmsPduTypeCdmaDeliver-32] 16 | _ = x[MmSmsPduTypeCdmaSubmit-33] 17 | _ = x[MmSmsPduTypeCdmaCancellation-34] 18 | _ = x[MmSmsPduTypeCdmaDeliveryAcknowledgement-35] 19 | _ = x[MmSmsPduTypeCdmaUserAcknowledgement-36] 20 | _ = x[MmSmsPduTypeCdmaReadAcknowledgement-37] 21 | } 22 | 23 | const ( 24 | _MMSmsPduType_name_0 = "UnknownDeliverSubmitStatusReport" 25 | _MMSmsPduType_name_1 = "CdmaDeliverCdmaSubmitCdmaCancellationCdmaDeliveryAcknowledgementCdmaUserAcknowledgementCdmaReadAcknowledgement" 26 | ) 27 | 28 | var ( 29 | _MMSmsPduType_index_0 = [...]uint8{0, 7, 14, 20, 32} 30 | _MMSmsPduType_index_1 = [...]uint8{0, 11, 21, 37, 64, 87, 110} 31 | ) 32 | 33 | func (i MMSmsPduType) String() string { 34 | switch { 35 | case i <= 3: 36 | return _MMSmsPduType_name_0[_MMSmsPduType_index_0[i]:_MMSmsPduType_index_0[i+1]] 37 | case 32 <= i && i <= 37: 38 | i -= 32 39 | return _MMSmsPduType_name_1[_MMSmsPduType_index_1[i]:_MMSmsPduType_index_1[i+1]] 40 | default: 41 | return "MMSmsPduType(" + strconv.FormatInt(int64(i), 10) + ")" 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /mmsmsstate_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMSmsState -trimprefix=MmSmsState"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmSmsStateUnknown-0] 12 | _ = x[MmSmsStateStored-1] 13 | _ = x[MmSmsStateReceiving-2] 14 | _ = x[MmSmsStateReceived-3] 15 | _ = x[MmSmsStateSending-4] 16 | _ = x[MmSmsStateSent-5] 17 | } 18 | 19 | const _MMSmsState_name = "UnknownStoredReceivingReceivedSendingSent" 20 | 21 | var _MMSmsState_index = [...]uint8{0, 7, 13, 22, 30, 37, 41} 22 | 23 | func (i MMSmsState) String() string { 24 | if i >= MMSmsState(len(_MMSmsState_index)-1) { 25 | return "MMSmsState(" + strconv.FormatInt(int64(i), 10) + ")" 26 | } 27 | return _MMSmsState_name[_MMSmsState_index[i]:_MMSmsState_index[i+1]] 28 | } 29 | -------------------------------------------------------------------------------- /mmsmsstorage_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMSmsStorage -trimprefix=MmSmsStorage"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmSmsStorageUnknown-0] 12 | _ = x[MmSmsStorageSm-1] 13 | _ = x[MmSmsStorageMe-2] 14 | _ = x[MmSmsStorageMt-3] 15 | _ = x[MmSmsStorageSr-4] 16 | _ = x[MmSmsStorageBm-5] 17 | _ = x[MmSmsStorageTa-6] 18 | } 19 | 20 | const _MMSmsStorage_name = "UnknownSmMeMtSrBmTa" 21 | 22 | var _MMSmsStorage_index = [...]uint8{0, 7, 9, 11, 13, 15, 17, 19} 23 | 24 | func (i MMSmsStorage) String() string { 25 | if i >= MMSmsStorage(len(_MMSmsStorage_index)-1) { 26 | return "MMSmsStorage(" + strconv.FormatInt(int64(i), 10) + ")" 27 | } 28 | return _MMSmsStorage_name[_MMSmsStorage_index[i]:_MMSmsStorage_index[i+1]] 29 | } 30 | -------------------------------------------------------------------------------- /mmsmsvaliditytype_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=MMSmsValidityType -trimprefix=MmSmsValidityType"; DO NOT EDIT. 2 | 3 | package modemmanager 4 | 5 | import "strconv" 6 | 7 | func _() { 8 | // An "invalid array index" compiler error signifies that the constant values have changed. 9 | // Re-run the stringer command to generate them again. 10 | var x [1]struct{} 11 | _ = x[MmSmsValidityTypeUnknown-0] 12 | _ = x[MmSmsValidityTypeRelative-1] 13 | _ = x[MmSmsValidityTypeAbsolute-2] 14 | _ = x[MmSmsValidityTypeEnhanced-3] 15 | } 16 | 17 | const _MMSmsValidityType_name = "UnknownRelativeAbsoluteEnhanced" 18 | 19 | var _MMSmsValidityType_index = [...]uint8{0, 7, 15, 23, 31} 20 | 21 | func (i MMSmsValidityType) String() string { 22 | if i >= MMSmsValidityType(len(_MMSmsValidityType_index)-1) { 23 | return "MMSmsValidityType(" + strconv.FormatInt(int64(i), 10) + ")" 24 | } 25 | return _MMSmsValidityType_name[_MMSmsValidityType_index[i]:_MMSmsValidityType_index[i+1]] 26 | } 27 | --------------------------------------------------------------------------------