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