blob: 1ea246fd6717701abaf648232c7917316474480b [file] [log] [blame]
slowr13fa5b02017-08-08 16:32:31 -07001package org.onosproject.xran.samplemessages;
2
3import org.onosproject.xran.codecs.api.CRNTI;
4import org.onosproject.xran.codecs.api.ECGI;
5import org.onosproject.xran.codecs.pdu.*;
6import org.openmuc.jasn1.ber.types.string.BerUTF8String;
7
8import java.io.UnsupportedEncodingException;
9
10public class UECapabilityEnq {
11
12 public static XrancPdu constructPacket(ECGI ecgi, CRNTI crnti) {
13 UECapabilityEnquiry capabilityEnquiry = new UECapabilityEnquiry();
14 capabilityEnquiry.setCrnti(crnti);
15 capabilityEnquiry.setEcgi(ecgi);
16
17 XrancPduBody body = new XrancPduBody();
18 body.setUECapabilityEnquiry(capabilityEnquiry);
19
20 BerUTF8String ver = null;
21 try {
22 ver = new BerUTF8String("4");
23 } catch (UnsupportedEncodingException e) {
24 e.printStackTrace();
25 }
26 XrancApiID apiID = new XrancApiID(12);
27 XrancPduHdr hdr = new XrancPduHdr();
28 hdr.setVer(ver);
29 hdr.setApiId(apiID);
30
31 XrancPdu pdu = new XrancPdu();
32 pdu.setHdr(hdr);
33 pdu.setBody(body);
34
35 return pdu;
36 }
37
38 public XrancPdu setPacketProperties(XrancPdu mainDecoder) {
39 CRNTI crnti = mainDecoder.getBody().getUECapabilityEnquiry().getCrnti();
40
41 //TODO: ECGI Value has to be read as CELL ID.
42 ECGI ecgi = mainDecoder.getBody().getUECapabilityEnquiry().getEcgi();
43
44 UECapabilityEnquiry capabilityEnquiry = new UECapabilityEnquiry();
45 capabilityEnquiry.setCrnti(crnti);
46 capabilityEnquiry.setEcgi(ecgi);
47
48 XrancPduBody body = new XrancPduBody();
49 body.setUECapabilityEnquiry(capabilityEnquiry);
50
51 BerUTF8String ver = null;
52 try {
53 ver = new BerUTF8String("4");
54 } catch (UnsupportedEncodingException e) {
55 e.printStackTrace();
56 }
57 XrancApiID apiID = new XrancApiID(12);
58 XrancPduHdr hdr = new XrancPduHdr();
59 hdr.setVer(ver);
60 hdr.setApiId(apiID);
61
62 XrancPdu pdu = new XrancPdu();
63 pdu.setHdr(hdr);
64 pdu.setBody(body);
65
66 return pdu;
67 }
68}