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.CRNTI; |
| 4 | import org.onosproject.xran.codecs.api.ECGI; |
| 5 | import org.onosproject.xran.codecs.pdu.*; |
| 6 | import org.openmuc.jasn1.ber.types.string.BerUTF8String; |
| 7 | |
| 8 | import java.io.UnsupportedEncodingException; |
| 9 | |
| 10 | public 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 | } |