slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 1 | /** |
| 2 | * This class file was automatically generated by jASN1 v1.8.0 (http://www.openmuc.org) |
| 3 | */ |
| 4 | package org.onosproject.xran.codecs.pdu; |
| 5 | |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 6 | import com.fasterxml.jackson.annotation.JsonIgnore; |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 7 | import org.onosproject.xran.codecs.api.CRNTI; |
| 8 | import org.onosproject.xran.codecs.api.ECGI; |
| 9 | import org.onosproject.xran.codecs.api.PCIARFCN; |
| 10 | import org.onosproject.xran.codecs.api.XICICPA; |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 11 | import org.onosproject.xran.codecs.ber.BerByteArrayOutputStream; |
| 12 | import org.onosproject.xran.codecs.ber.BerLength; |
| 13 | import org.onosproject.xran.codecs.ber.BerTag; |
| 14 | import org.onosproject.xran.codecs.ber.types.BerBitString; |
| 15 | import org.onosproject.xran.codecs.ber.types.BerInteger; |
| 16 | import org.onosproject.xran.codecs.ber.types.string.BerUTF8String; |
slowr | 8ddc2b1 | 2017-08-14 14:13:38 -0700 | [diff] [blame] | 17 | |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 18 | import java.io.IOException; |
| 19 | import java.io.InputStream; |
| 20 | import java.io.Serializable; |
slowr | 8ddc2b1 | 2017-08-14 14:13:38 -0700 | [diff] [blame] | 21 | import java.io.UnsupportedEncodingException; |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 22 | |
| 23 | public class XICICConfig implements Serializable { |
| 24 | |
| 25 | private static final long serialVersionUID = 1L; |
| 26 | |
| 27 | public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16); |
| 28 | |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 29 | @JsonIgnore |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 30 | public byte[] code = null; |
| 31 | private ECGI ecgi = null; |
| 32 | private PCIARFCN pciArfcn = null; |
| 33 | private CRNTI crnti = null; |
| 34 | private XICICPA pa = null; |
| 35 | private BerInteger startPrbDl = null; |
| 36 | private BerInteger endPrbDl = null; |
| 37 | private BerBitString subframeBitmaskDl = null; |
| 38 | private BerInteger p0UePusch = null; |
| 39 | private BerInteger startPrbUl = null; |
| 40 | private BerInteger endPrbUl = null; |
| 41 | private BerBitString subframeBitmaskUl = null; |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 42 | |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 43 | public XICICConfig() { |
| 44 | } |
| 45 | |
| 46 | public XICICConfig(byte[] code) { |
| 47 | this.code = code; |
| 48 | } |
| 49 | |
| 50 | public void setEcgi(ECGI ecgi) { |
| 51 | this.ecgi = ecgi; |
| 52 | } |
| 53 | |
| 54 | public ECGI getEcgi() { |
| 55 | return ecgi; |
| 56 | } |
| 57 | |
| 58 | public void setPciArfcn(PCIARFCN pciArfcn) { |
| 59 | this.pciArfcn = pciArfcn; |
| 60 | } |
| 61 | |
| 62 | public PCIARFCN getPciArfcn() { |
| 63 | return pciArfcn; |
| 64 | } |
| 65 | |
| 66 | public void setCrnti(CRNTI crnti) { |
| 67 | this.crnti = crnti; |
| 68 | } |
| 69 | |
| 70 | public CRNTI getCrnti() { |
| 71 | return crnti; |
| 72 | } |
| 73 | |
| 74 | public void setPa(XICICPA pa) { |
| 75 | this.pa = pa; |
| 76 | } |
| 77 | |
| 78 | public XICICPA getPa() { |
| 79 | return pa; |
| 80 | } |
| 81 | |
| 82 | public void setStartPrbDl(BerInteger startPrbDl) { |
| 83 | this.startPrbDl = startPrbDl; |
| 84 | } |
| 85 | |
| 86 | public BerInteger getStartPrbDl() { |
| 87 | return startPrbDl; |
| 88 | } |
| 89 | |
| 90 | public void setEndPrbDl(BerInteger endPrbDl) { |
| 91 | this.endPrbDl = endPrbDl; |
| 92 | } |
| 93 | |
| 94 | public BerInteger getEndPrbDl() { |
| 95 | return endPrbDl; |
| 96 | } |
| 97 | |
| 98 | public void setSubframeBitmaskDl(BerBitString subframeBitmaskDl) { |
| 99 | this.subframeBitmaskDl = subframeBitmaskDl; |
| 100 | } |
| 101 | |
| 102 | public BerBitString getSubframeBitmaskDl() { |
| 103 | return subframeBitmaskDl; |
| 104 | } |
| 105 | |
| 106 | public void setP0UePusch(BerInteger p0UePusch) { |
| 107 | this.p0UePusch = p0UePusch; |
| 108 | } |
| 109 | |
| 110 | public BerInteger getP0UePusch() { |
| 111 | return p0UePusch; |
| 112 | } |
| 113 | |
| 114 | public void setStartPrbUl(BerInteger startPrbUl) { |
| 115 | this.startPrbUl = startPrbUl; |
| 116 | } |
| 117 | |
| 118 | public BerInteger getStartPrbUl() { |
| 119 | return startPrbUl; |
| 120 | } |
| 121 | |
| 122 | public void setEndPrbUl(BerInteger endPrbUl) { |
| 123 | this.endPrbUl = endPrbUl; |
| 124 | } |
| 125 | |
| 126 | public BerInteger getEndPrbUl() { |
| 127 | return endPrbUl; |
| 128 | } |
| 129 | |
| 130 | public void setSubframeBitmaskUl(BerBitString subframeBitmaskUl) { |
| 131 | this.subframeBitmaskUl = subframeBitmaskUl; |
| 132 | } |
| 133 | |
| 134 | public BerBitString getSubframeBitmaskUl() { |
| 135 | return subframeBitmaskUl; |
| 136 | } |
| 137 | |
| 138 | public int encode(BerByteArrayOutputStream os) throws IOException { |
| 139 | return encode(os, true); |
| 140 | } |
| 141 | |
| 142 | public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException { |
| 143 | |
| 144 | if (code != null) { |
| 145 | for (int i = code.length - 1; i >= 0; i--) { |
| 146 | os.write(code[i]); |
| 147 | } |
| 148 | if (withTag) { |
| 149 | return tag.encode(os) + code.length; |
| 150 | } |
| 151 | return code.length; |
| 152 | } |
| 153 | |
| 154 | int codeLength = 0; |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 155 | if (subframeBitmaskUl != null) { |
| 156 | codeLength += subframeBitmaskUl.encode(os, false); |
| 157 | // write tag: CONTEXT_CLASS, PRIMITIVE, 10 |
| 158 | os.write(0x8A); |
| 159 | codeLength += 1; |
| 160 | } |
| 161 | |
| 162 | if (endPrbUl != null) { |
| 163 | codeLength += endPrbUl.encode(os, false); |
| 164 | // write tag: CONTEXT_CLASS, PRIMITIVE, 9 |
| 165 | os.write(0x89); |
| 166 | codeLength += 1; |
| 167 | } |
| 168 | |
| 169 | if (startPrbUl != null) { |
| 170 | codeLength += startPrbUl.encode(os, false); |
| 171 | // write tag: CONTEXT_CLASS, PRIMITIVE, 8 |
| 172 | os.write(0x88); |
| 173 | codeLength += 1; |
| 174 | } |
| 175 | |
| 176 | if (p0UePusch != null) { |
| 177 | codeLength += p0UePusch.encode(os, false); |
| 178 | // write tag: CONTEXT_CLASS, PRIMITIVE, 7 |
| 179 | os.write(0x87); |
| 180 | codeLength += 1; |
| 181 | } |
| 182 | |
| 183 | if (subframeBitmaskDl != null) { |
| 184 | codeLength += subframeBitmaskDl.encode(os, false); |
| 185 | // write tag: CONTEXT_CLASS, PRIMITIVE, 6 |
| 186 | os.write(0x86); |
| 187 | codeLength += 1; |
| 188 | } |
| 189 | |
| 190 | if (endPrbDl != null) { |
| 191 | codeLength += endPrbDl.encode(os, false); |
| 192 | // write tag: CONTEXT_CLASS, PRIMITIVE, 5 |
| 193 | os.write(0x85); |
| 194 | codeLength += 1; |
| 195 | } |
| 196 | |
| 197 | if (startPrbDl != null) { |
| 198 | codeLength += startPrbDl.encode(os, false); |
| 199 | // write tag: CONTEXT_CLASS, PRIMITIVE, 4 |
| 200 | os.write(0x84); |
| 201 | codeLength += 1; |
| 202 | } |
| 203 | |
| 204 | if (pa != null) { |
| 205 | codeLength += pa.encode(os, false); |
| 206 | // write tag: CONTEXT_CLASS, PRIMITIVE, 3 |
| 207 | os.write(0x83); |
| 208 | codeLength += 1; |
| 209 | } |
| 210 | |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 211 | codeLength += crnti.encode(os, false); |
| 212 | // write tag: CONTEXT_CLASS, PRIMITIVE, 2 |
| 213 | os.write(0x82); |
| 214 | codeLength += 1; |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 215 | |
| 216 | if (pciArfcn != null) { |
| 217 | codeLength += pciArfcn.encode(os, false); |
| 218 | // write tag: CONTEXT_CLASS, CONSTRUCTED, 1 |
| 219 | os.write(0xA1); |
| 220 | codeLength += 1; |
| 221 | } |
| 222 | |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 223 | codeLength += ecgi.encode(os, false); |
| 224 | // write tag: CONTEXT_CLASS, CONSTRUCTED, 0 |
| 225 | os.write(0xA0); |
| 226 | codeLength += 1; |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 227 | |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 228 | codeLength += BerLength.encodeLength(os, codeLength); |
| 229 | |
| 230 | if (withTag) { |
| 231 | codeLength += tag.encode(os); |
| 232 | } |
| 233 | |
| 234 | return codeLength; |
| 235 | |
| 236 | } |
| 237 | |
| 238 | public int decode(InputStream is) throws IOException { |
| 239 | return decode(is, true); |
| 240 | } |
| 241 | |
| 242 | public int decode(InputStream is, boolean withTag) throws IOException { |
| 243 | int codeLength = 0; |
| 244 | int subCodeLength = 0; |
| 245 | BerTag berTag = new BerTag(); |
| 246 | |
| 247 | if (withTag) { |
| 248 | codeLength += tag.decodeAndCheck(is); |
| 249 | } |
| 250 | |
| 251 | BerLength length = new BerLength(); |
| 252 | codeLength += length.decode(is); |
| 253 | |
| 254 | int totalLength = length.val; |
| 255 | codeLength += totalLength; |
| 256 | |
| 257 | subCodeLength += berTag.decode(is); |
| 258 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) { |
| 259 | ecgi = new ECGI(); |
| 260 | subCodeLength += ecgi.decode(is, false); |
| 261 | subCodeLength += berTag.decode(is); |
| 262 | } |
| 263 | else { |
| 264 | throw new IOException("Tag does not match the mandatory sequence element tag."); |
| 265 | } |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 266 | |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 267 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) { |
| 268 | pciArfcn = new PCIARFCN(); |
| 269 | subCodeLength += pciArfcn.decode(is, false); |
| 270 | subCodeLength += berTag.decode(is); |
| 271 | } |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 272 | |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 273 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) { |
| 274 | crnti = new CRNTI(); |
| 275 | subCodeLength += crnti.decode(is, false); |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 276 | if (subCodeLength == totalLength) { |
| 277 | return codeLength; |
| 278 | } |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 279 | subCodeLength += berTag.decode(is); |
| 280 | } |
| 281 | else { |
| 282 | throw new IOException("Tag does not match the mandatory sequence element tag."); |
| 283 | } |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 284 | |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 285 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 3)) { |
| 286 | pa = new XICICPA(); |
| 287 | subCodeLength += pa.decode(is, false); |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 288 | if (subCodeLength == totalLength) { |
| 289 | return codeLength; |
| 290 | } |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 291 | subCodeLength += berTag.decode(is); |
| 292 | } |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 293 | |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 294 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 4)) { |
| 295 | startPrbDl = new BerInteger(); |
| 296 | subCodeLength += startPrbDl.decode(is, false); |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 297 | if (subCodeLength == totalLength) { |
| 298 | return codeLength; |
| 299 | } |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 300 | subCodeLength += berTag.decode(is); |
| 301 | } |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 302 | |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 303 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 5)) { |
| 304 | endPrbDl = new BerInteger(); |
| 305 | subCodeLength += endPrbDl.decode(is, false); |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 306 | if (subCodeLength == totalLength) { |
| 307 | return codeLength; |
| 308 | } |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 309 | subCodeLength += berTag.decode(is); |
| 310 | } |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 311 | |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 312 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 6)) { |
| 313 | subframeBitmaskDl = new BerBitString(); |
| 314 | subCodeLength += subframeBitmaskDl.decode(is, false); |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 315 | if (subCodeLength == totalLength) { |
| 316 | return codeLength; |
| 317 | } |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 318 | subCodeLength += berTag.decode(is); |
| 319 | } |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 320 | |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 321 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 7)) { |
| 322 | p0UePusch = new BerInteger(); |
| 323 | subCodeLength += p0UePusch.decode(is, false); |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 324 | if (subCodeLength == totalLength) { |
| 325 | return codeLength; |
| 326 | } |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 327 | subCodeLength += berTag.decode(is); |
| 328 | } |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 329 | |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 330 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 8)) { |
| 331 | startPrbUl = new BerInteger(); |
| 332 | subCodeLength += startPrbUl.decode(is, false); |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 333 | if (subCodeLength == totalLength) { |
| 334 | return codeLength; |
| 335 | } |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 336 | subCodeLength += berTag.decode(is); |
| 337 | } |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 338 | |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 339 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 9)) { |
| 340 | endPrbUl = new BerInteger(); |
| 341 | subCodeLength += endPrbUl.decode(is, false); |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 342 | if (subCodeLength == totalLength) { |
| 343 | return codeLength; |
| 344 | } |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 345 | subCodeLength += berTag.decode(is); |
| 346 | } |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 347 | |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 348 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 10)) { |
| 349 | subframeBitmaskUl = new BerBitString(); |
| 350 | subCodeLength += subframeBitmaskUl.decode(is, false); |
| 351 | if (subCodeLength == totalLength) { |
| 352 | return codeLength; |
| 353 | } |
| 354 | } |
| 355 | throw new IOException("Unexpected end of sequence, length tag: " + totalLength + ", actual sequence length: " + subCodeLength); |
| 356 | |
slowr | 89c2ac1 | 2017-08-15 16:20:06 -0700 | [diff] [blame] | 357 | |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 358 | } |
| 359 | |
| 360 | public void encodeAndSave(int encodingSizeGuess) throws IOException { |
| 361 | BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess); |
| 362 | encode(os, false); |
| 363 | code = os.getArray(); |
| 364 | } |
| 365 | |
| 366 | public String toString() { |
| 367 | StringBuilder sb = new StringBuilder(); |
| 368 | appendAsString(sb, 0); |
| 369 | return sb.toString(); |
| 370 | } |
| 371 | |
| 372 | public void appendAsString(StringBuilder sb, int indentLevel) { |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 373 | sb.append("{"); |
| 374 | sb.append("\n"); |
| 375 | for (int i = 0; i < indentLevel + 1; i++) { |
| 376 | sb.append("\t"); |
| 377 | } |
| 378 | if (ecgi != null) { |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 379 | sb.append("ecgi: "); |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 380 | ecgi.appendAsString(sb, indentLevel + 1); |
| 381 | } |
slowr | 8d9a4c4 | 2017-08-15 16:21:12 -0700 | [diff] [blame] | 382 | |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 383 | if (pciArfcn != null) { |
slowr | 8d9a4c4 | 2017-08-15 16:21:12 -0700 | [diff] [blame] | 384 | sb.append(",\n"); |
| 385 | for (int i = 0; i < indentLevel + 1; i++) { |
| 386 | sb.append("\t"); |
| 387 | } |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 388 | sb.append("pciArfcn: "); |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 389 | pciArfcn.appendAsString(sb, indentLevel + 1); |
| 390 | } |
slowr | 8d9a4c4 | 2017-08-15 16:21:12 -0700 | [diff] [blame] | 391 | |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 392 | sb.append(",\n"); |
| 393 | for (int i = 0; i < indentLevel + 1; i++) { |
| 394 | sb.append("\t"); |
| 395 | } |
| 396 | if (crnti != null) { |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 397 | sb.append("crnti: ").append(crnti); |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 398 | } |
slowr | 8d9a4c4 | 2017-08-15 16:21:12 -0700 | [diff] [blame] | 399 | |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 400 | if (pa != null) { |
slowr | 8d9a4c4 | 2017-08-15 16:21:12 -0700 | [diff] [blame] | 401 | sb.append(",\n"); |
| 402 | for (int i = 0; i < indentLevel + 1; i++) { |
| 403 | sb.append("\t"); |
| 404 | } |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 405 | sb.append("pa: ").append(pa); |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 406 | } |
slowr | 8d9a4c4 | 2017-08-15 16:21:12 -0700 | [diff] [blame] | 407 | |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 408 | if (startPrbDl != null) { |
slowr | 8d9a4c4 | 2017-08-15 16:21:12 -0700 | [diff] [blame] | 409 | sb.append(",\n"); |
| 410 | for (int i = 0; i < indentLevel + 1; i++) { |
| 411 | sb.append("\t"); |
| 412 | } |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 413 | sb.append("startPrbDl: ").append(startPrbDl); |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 414 | } |
slowr | 8d9a4c4 | 2017-08-15 16:21:12 -0700 | [diff] [blame] | 415 | |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 416 | if (endPrbDl != null) { |
slowr | 8d9a4c4 | 2017-08-15 16:21:12 -0700 | [diff] [blame] | 417 | sb.append(",\n"); |
| 418 | for (int i = 0; i < indentLevel + 1; i++) { |
| 419 | sb.append("\t"); |
| 420 | } |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 421 | sb.append("endPrbDl: ").append(endPrbDl); |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 422 | } |
slowr | 8d9a4c4 | 2017-08-15 16:21:12 -0700 | [diff] [blame] | 423 | |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 424 | if (subframeBitmaskDl != null) { |
slowr | 8d9a4c4 | 2017-08-15 16:21:12 -0700 | [diff] [blame] | 425 | sb.append(",\n"); |
| 426 | for (int i = 0; i < indentLevel + 1; i++) { |
| 427 | sb.append("\t"); |
| 428 | } |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 429 | sb.append("subframeBitmaskDl: ").append(subframeBitmaskDl); |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 430 | } |
slowr | 8d9a4c4 | 2017-08-15 16:21:12 -0700 | [diff] [blame] | 431 | |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 432 | if (p0UePusch != null) { |
slowr | 8d9a4c4 | 2017-08-15 16:21:12 -0700 | [diff] [blame] | 433 | sb.append(",\n"); |
| 434 | for (int i = 0; i < indentLevel + 1; i++) { |
| 435 | sb.append("\t"); |
| 436 | } |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 437 | sb.append("p0UePusch: ").append(p0UePusch); |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 438 | } |
slowr | 8d9a4c4 | 2017-08-15 16:21:12 -0700 | [diff] [blame] | 439 | |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 440 | if (startPrbUl != null) { |
slowr | 8d9a4c4 | 2017-08-15 16:21:12 -0700 | [diff] [blame] | 441 | sb.append(",\n"); |
| 442 | for (int i = 0; i < indentLevel + 1; i++) { |
| 443 | sb.append("\t"); |
| 444 | } |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 445 | sb.append("startPrbUl: ").append(startPrbUl); |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 446 | } |
slowr | 8d9a4c4 | 2017-08-15 16:21:12 -0700 | [diff] [blame] | 447 | |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 448 | if (endPrbUl != null) { |
slowr | 8d9a4c4 | 2017-08-15 16:21:12 -0700 | [diff] [blame] | 449 | sb.append(",\n"); |
| 450 | for (int i = 0; i < indentLevel + 1; i++) { |
| 451 | sb.append("\t"); |
| 452 | } |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 453 | sb.append("endPrbUl: ").append(endPrbUl); |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 454 | } |
slowr | 8d9a4c4 | 2017-08-15 16:21:12 -0700 | [diff] [blame] | 455 | |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 456 | if (subframeBitmaskUl != null) { |
slowr | 8d9a4c4 | 2017-08-15 16:21:12 -0700 | [diff] [blame] | 457 | sb.append(",\n"); |
| 458 | for (int i = 0; i < indentLevel + 1; i++) { |
| 459 | sb.append("\t"); |
| 460 | } |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 461 | sb.append("subframeBitmaskUl: ").append(subframeBitmaskUl); |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 462 | } |
slowr | 8d9a4c4 | 2017-08-15 16:21:12 -0700 | [diff] [blame] | 463 | |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 464 | sb.append("\n"); |
| 465 | for (int i = 0; i < indentLevel; i++) { |
| 466 | sb.append("\t"); |
| 467 | } |
| 468 | sb.append("}"); |
| 469 | } |
| 470 | |
slowr | 8ddc2b1 | 2017-08-14 14:13:38 -0700 | [diff] [blame] | 471 | public static XrancPdu constructPacket(RRMConfig config) { |
| 472 | XrancPduBody body = new XrancPduBody(); |
slowr | 7c0e167 | 2017-08-15 17:09:14 -0700 | [diff] [blame] | 473 | |
| 474 | XICICConfig xicicConfig = new XICICConfig(); |
| 475 | |
| 476 | xicicConfig.setCrnti(config.getCrnti().getCRNTI().get(0)); |
| 477 | xicicConfig.setEcgi(config.getEcgi()); |
| 478 | |
| 479 | try { |
| 480 | xicicConfig.setEndPrbDl(config.getEndPrbDl().getSeqOf().get(0)); |
| 481 | } catch (Exception ignored) {} |
| 482 | |
| 483 | try { |
| 484 | xicicConfig.setEndPrbUl(config.getEndPrbUl().getSeqOf().get(0)); |
| 485 | } catch (Exception ignored) {} |
| 486 | |
| 487 | try { |
| 488 | xicicConfig.setStartPrbDl(config.getStartPrbDl().getSeqOf().get(0)); |
| 489 | } catch (Exception ignored) {} |
| 490 | |
| 491 | try { |
| 492 | xicicConfig.setEndPrbUl(config.getStartPrbUl().getSeqOf().get(0)); |
| 493 | } catch (Exception ignored) {} |
| 494 | |
| 495 | body.setXICICConfig(xicicConfig); |
slowr | 8ddc2b1 | 2017-08-14 14:13:38 -0700 | [diff] [blame] | 496 | |
| 497 | BerUTF8String ver = null; |
| 498 | try { |
| 499 | ver = new BerUTF8String("3"); |
| 500 | } catch (UnsupportedEncodingException e) { |
| 501 | e.printStackTrace(); |
| 502 | } |
| 503 | |
| 504 | XrancApiID apiID = new XrancApiID(23); |
| 505 | XrancPduHdr hdr = new XrancPduHdr(); |
| 506 | hdr.setVer(ver); |
| 507 | hdr.setApiId(apiID); |
| 508 | |
| 509 | XrancPdu pdu = new XrancPdu(); |
| 510 | pdu.setHdr(hdr); |
| 511 | pdu.setBody(body); |
| 512 | return pdu; |
| 513 | } |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 514 | } |
| 515 | |