slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 1 | package org.onosproject.xran.samplemessages; |
| 2 | |
| 3 | import org.onosproject.xran.codecs.api.*; |
| 4 | import org.onosproject.xran.codecs.pdu.*; |
| 5 | import org.openmuc.jasn1.ber.types.string.BerUTF8String; |
| 6 | |
| 7 | import java.io.UnsupportedEncodingException; |
| 8 | |
| 9 | public class SignalMeasConfig { |
| 10 | public static XrancPdu constructPacket(ECGI ecgi, CRNTI crnti, RXSigMeasConfig.MeasCells measCells, int interval) { |
| 11 | RXSigRepQty rxSigRepQty = new RXSigRepQty(2); |
| 12 | RXSigMeasRepInterval repInterval = new RXSigMeasRepInterval(interval); |
| 13 | |
| 14 | RXSigMeasConfig sigMeasConfig = new RXSigMeasConfig(); |
| 15 | sigMeasConfig.setCrnti(crnti); |
| 16 | sigMeasConfig.setEcgi(ecgi); |
| 17 | sigMeasConfig.setReportQty(rxSigRepQty); |
| 18 | sigMeasConfig.setMeasCells(measCells); |
| 19 | sigMeasConfig.setReportInterval(repInterval); |
| 20 | |
| 21 | XrancPduBody body = new XrancPduBody(); |
| 22 | body.setRXSigMeasConfig(sigMeasConfig); |
| 23 | |
| 24 | BerUTF8String ver = null; |
| 25 | try { |
| 26 | ver = new BerUTF8String("4"); |
| 27 | } catch (UnsupportedEncodingException e) { |
| 28 | e.printStackTrace(); |
| 29 | } |
| 30 | XrancApiID apiID = new XrancApiID(17); |
| 31 | XrancPduHdr hdr = new XrancPduHdr(); |
| 32 | hdr.setVer(ver); |
| 33 | hdr.setApiId(apiID); |
| 34 | |
| 35 | XrancPdu pdu = new XrancPdu(); |
| 36 | pdu.setHdr(hdr); |
| 37 | pdu.setBody(body); |
| 38 | |
| 39 | return pdu; |
| 40 | } |
| 41 | |
| 42 | public XrancPdu setPacketProperties() { |
| 43 | CRNTI crnti = new CRNTI(new byte[]{(byte) 0x44, (byte) 0x44}); |
| 44 | |
| 45 | PLMNIdentity plmnIdentity = new PLMNIdentity(new byte[]{(byte) 0xFC, (byte) 0xFF, (byte) 0x3F}); |
| 46 | EUTRANCellIdentifier eutranCellIdentifier = new EUTRANCellIdentifier(new byte[]{ |
| 47 | (byte) 0xCF, (byte) 0xFE, (byte) 0x7C, (byte) 0xF0 |
| 48 | }, 28); |
| 49 | |
| 50 | ECGI ecgi = new ECGI(); |
| 51 | ecgi.setPLMNIdentity(plmnIdentity); |
| 52 | ecgi.setEUTRANcellIdentifier(eutranCellIdentifier); |
| 53 | |
| 54 | RXSigRepQty rxSigRepQty = new RXSigRepQty(2); |
| 55 | PCIARFCN pciarfcn = new PCIARFCN(); |
| 56 | pciarfcn.setPci(new PhysCellId(500)); |
| 57 | pciarfcn.setEarfcnDl(new ARFCNValue(2100)); |
| 58 | RXSigMeasConfig.MeasCells measCells = new RXSigMeasConfig.MeasCells(); |
| 59 | measCells.setPCIARFCN(pciarfcn); |
| 60 | RXSigMeasRepInterval repInterval = new RXSigMeasRepInterval(1); |
| 61 | |
| 62 | |
| 63 | RXSigMeasConfig sigMeasConfig = new RXSigMeasConfig(); |
| 64 | sigMeasConfig.setCrnti(crnti); |
| 65 | sigMeasConfig.setEcgi(ecgi); |
| 66 | sigMeasConfig.setReportQty(rxSigRepQty); |
| 67 | sigMeasConfig.setMeasCells(measCells); |
| 68 | sigMeasConfig.setReportInterval(repInterval); |
| 69 | |
| 70 | |
| 71 | XrancPduBody body = new XrancPduBody(); |
| 72 | body.setRXSigMeasConfig(sigMeasConfig); |
| 73 | |
| 74 | BerUTF8String ver = null; |
| 75 | try { |
| 76 | ver = new BerUTF8String("4"); |
| 77 | } catch (UnsupportedEncodingException e) { |
| 78 | e.printStackTrace(); |
| 79 | } |
| 80 | XrancApiID apiID = new XrancApiID(17); |
| 81 | XrancPduHdr hdr = new XrancPduHdr(); |
| 82 | hdr.setVer(ver); |
| 83 | hdr.setApiId(apiID); |
| 84 | |
| 85 | XrancPdu pdu = new XrancPdu(); |
| 86 | pdu.setHdr(hdr); |
| 87 | pdu.setBody(body); |
| 88 | |
| 89 | return pdu; |
| 90 | } |
| 91 | |
| 92 | |
| 93 | } |