|
| 1 | +import ..protocol as protocol |
| 2 | + |
| 3 | +// Auto generated class for protocol message |
| 4 | +class SIMsettings extends protocol.Data: |
| 5 | + |
| 6 | + static MT := 33 |
| 7 | + static MT_NAME := "SIMsettings" |
| 8 | + |
| 9 | + static ACTIVE-SIM := 1 |
| 10 | + static ACTIVE-SIM_SIM1 := 0 |
| 11 | + static ACTIVE-SIM_SIM2 := 1 |
| 12 | + |
| 13 | + static ACTIVE-SIM_STRINGS := { |
| 14 | + 0: "SIM1", |
| 15 | + 1: "SIM2", |
| 16 | + } |
| 17 | + |
| 18 | + static active-sim-from-int value/int -> string: |
| 19 | + return ACTIVE-SIM_STRINGS.get value --if-absent=(: "unknown") |
| 20 | + |
| 21 | + static SIM2-APN := 2 |
| 22 | + static SIM2-APN-USERNAME := 3 |
| 23 | + static SIM2-APN-PASSWORD := 4 |
| 24 | + static SIM2-ICCID := 8 |
| 25 | + |
| 26 | + constructor: |
| 27 | + super |
| 28 | + |
| 29 | + constructor.from-data data/protocol.Data: |
| 30 | + super.from-data data |
| 31 | + |
| 32 | + /** |
| 33 | + * Creates a protocol.Data object with all available fields for this message type. |
| 34 | + * |
| 35 | + * This is a comprehensive helper that accepts all possible fields. |
| 36 | + * For method-specific usage, consider using the dedicated request/response methods. |
| 37 | + * |
| 38 | + * Returns: A protocol.Data object with the specified field values |
| 39 | + */ |
| 40 | + static data --active-sim/int?=null --sim2-apn/string?=null --sim2-apn-username/string?=null --sim2-apn-password/string?=null --sim2-iccid/string?=null --base-data/protocol.Data?=protocol.Data -> protocol.Data: |
| 41 | + data := base-data |
| 42 | + if active-sim != null: data.add-data-uint ACTIVE-SIM active-sim |
| 43 | + if sim2-apn != null: data.add-data-ascii SIM2-APN sim2-apn |
| 44 | + if sim2-apn-username != null: data.add-data-ascii SIM2-APN-USERNAME sim2-apn-username |
| 45 | + if sim2-apn-password != null: data.add-data-ascii SIM2-APN-PASSWORD sim2-apn-password |
| 46 | + if sim2-iccid != null: data.add-data-ascii SIM2-ICCID sim2-iccid |
| 47 | + return data |
| 48 | + |
| 49 | + /** |
| 50 | + * Creates a GET Request message for SIM settings. |
| 51 | + * |
| 52 | + * Returns: A Message ready to be sent |
| 53 | + */ |
| 54 | + static get-msg --base-data/protocol.Data?=protocol.Data -> protocol.Message: |
| 55 | + return protocol.Message.with-method MT protocol.Header.METHOD-GET base-data |
| 56 | + |
| 57 | + /** |
| 58 | + * Creates a SET Request message for SIM settings. |
| 59 | + * |
| 60 | + * Returns: A Message ready to be sent |
| 61 | + */ |
| 62 | + static set-msg --base-data/protocol.Data?=protocol.Data -> protocol.Message: |
| 63 | + return protocol.Message.with-method MT protocol.Header.METHOD-SET base-data |
| 64 | + |
| 65 | + /** |
| 66 | + * Activate the specified SIM |
| 67 | + * If SIM2 is selected, sending the APN settings is required |
| 68 | + * |
| 69 | + * |
| 70 | + * Valid values: |
| 71 | + * - ACTIVE-SIM_SIM1 (0): SIM1 |
| 72 | + * - ACTIVE-SIM_SIM2 (1): SIM2 |
| 73 | + */ |
| 74 | + active-sim -> int: |
| 75 | + return get-data-uint ACTIVE-SIM |
| 76 | + |
| 77 | + /** |
| 78 | + * SIM2 APN |
| 79 | + */ |
| 80 | + sim2-apn -> string: |
| 81 | + return get-data-ascii SIM2-APN |
| 82 | + |
| 83 | + /** |
| 84 | + * SIM2 APN Username |
| 85 | + */ |
| 86 | + sim2-apn-username -> string: |
| 87 | + return get-data-ascii SIM2-APN-USERNAME |
| 88 | + |
| 89 | + /** |
| 90 | + * SIM2 APN Password |
| 91 | + */ |
| 92 | + sim2-apn-password -> string: |
| 93 | + return get-data-ascii SIM2-APN-PASSWORD |
| 94 | + |
| 95 | + /** |
| 96 | + * SIM2 ICCID if known, read-only |
| 97 | + */ |
| 98 | + sim2-iccid -> string: |
| 99 | + return get-data-ascii SIM2-ICCID |
| 100 | + |
| 101 | + stringify -> string: |
| 102 | + return { |
| 103 | + "Active SIM": active-sim, |
| 104 | + "SIM2 APN": sim2-apn, |
| 105 | + "SIM2 APN Username": sim2-apn-username, |
| 106 | + "SIM2 APN Password": sim2-apn-password, |
| 107 | + "SIM2 ICCID": sim2-iccid, |
| 108 | + }.stringify |
0 commit comments