slowr | c86750e | 2017-08-22 17:26:47 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015-present Open Networking Foundation |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package org.onosproject.xran.identifiers; |
| 18 | |
| 19 | import org.onosproject.xran.codecs.pdu.HOComplete; |
| 20 | import org.onosproject.xran.codecs.pdu.UEAdmissionStatus; |
| 21 | import org.onosproject.xran.codecs.pdu.UEContextUpdate; |
| 22 | |
slowr | 577f322 | 2017-08-28 10:49:08 -0700 | [diff] [blame^] | 23 | /** |
| 24 | * Class to handle UE Context Update packet. |
| 25 | */ |
| 26 | public class ContextUpdateHandler { |
slowr | c86750e | 2017-08-22 17:26:47 -0700 | [diff] [blame] | 27 | private UEContextUpdate contextUpdate; |
| 28 | private UEAdmissionStatus admissionStatus; |
| 29 | private HOComplete hoComplete; |
| 30 | |
slowr | 577f322 | 2017-08-28 10:49:08 -0700 | [diff] [blame^] | 31 | /** |
| 32 | * Get Context Update. |
| 33 | * @return UEContextUpdate |
| 34 | */ |
slowr | c86750e | 2017-08-22 17:26:47 -0700 | [diff] [blame] | 35 | public UEContextUpdate getContextUpdate() { |
| 36 | return contextUpdate; |
| 37 | } |
| 38 | |
slowr | 577f322 | 2017-08-28 10:49:08 -0700 | [diff] [blame^] | 39 | /** |
| 40 | * Set Context Update. |
| 41 | * @param contextUpdate UEContextUpdate |
| 42 | * @return boolean to check context update was for admissionStatus packet or HOComplete packet |
| 43 | */ |
slowr | c86750e | 2017-08-22 17:26:47 -0700 | [diff] [blame] | 44 | public boolean setContextUpdate(UEContextUpdate contextUpdate) { |
| 45 | this.contextUpdate = contextUpdate; |
| 46 | |
| 47 | return admissionStatus != null || hoComplete != null; |
| 48 | |
| 49 | } |
| 50 | |
slowr | 577f322 | 2017-08-28 10:49:08 -0700 | [diff] [blame^] | 51 | /** |
| 52 | * Get UEAdmissionStatus. |
| 53 | * @return UEAdmissionStatus |
| 54 | */ |
slowr | c86750e | 2017-08-22 17:26:47 -0700 | [diff] [blame] | 55 | public UEAdmissionStatus getAdmissionStatus() { |
| 56 | return admissionStatus; |
| 57 | } |
| 58 | |
slowr | 577f322 | 2017-08-28 10:49:08 -0700 | [diff] [blame^] | 59 | /** |
| 60 | * Set UEAdmissionStatus. |
| 61 | * @param admissionStatus UEAdmissionStatus |
| 62 | * @return boolean contextUpdate exists or not |
| 63 | */ |
slowr | c86750e | 2017-08-22 17:26:47 -0700 | [diff] [blame] | 64 | public boolean setAdmissionStatus(UEAdmissionStatus admissionStatus) { |
| 65 | this.admissionStatus = admissionStatus; |
| 66 | |
| 67 | return contextUpdate != null; |
| 68 | } |
| 69 | |
slowr | 577f322 | 2017-08-28 10:49:08 -0700 | [diff] [blame^] | 70 | /** |
| 71 | * Get HOComplete. |
| 72 | * @return HOComplete |
| 73 | */ |
slowr | c86750e | 2017-08-22 17:26:47 -0700 | [diff] [blame] | 74 | public HOComplete getHoComplete() { |
| 75 | return hoComplete; |
| 76 | } |
| 77 | |
slowr | 577f322 | 2017-08-28 10:49:08 -0700 | [diff] [blame^] | 78 | /** |
| 79 | * Set HOComplete. |
| 80 | * @param hoComplete HOComplete |
| 81 | * @return boolean contextUpdate exists or not |
| 82 | */ |
slowr | c86750e | 2017-08-22 17:26:47 -0700 | [diff] [blame] | 83 | public boolean setHoComplete(HOComplete hoComplete) { |
| 84 | this.hoComplete = hoComplete; |
| 85 | |
| 86 | return contextUpdate != null; |
| 87 | } |
| 88 | |
| 89 | @Override |
| 90 | public String toString() { |
slowr | 577f322 | 2017-08-28 10:49:08 -0700 | [diff] [blame^] | 91 | return "ContextUpdateHandler{" + |
slowr | c86750e | 2017-08-22 17:26:47 -0700 | [diff] [blame] | 92 | "contextUpdate=" + (contextUpdate != null) + |
| 93 | ", admissionStatus=" + (admissionStatus != null) + |
| 94 | ", hoComplete=" + (hoComplete != null) + |
| 95 | '}'; |
| 96 | } |
| 97 | } |