E2AP Abstraction Changes
[ric-app/hw.git] / src / xapp-asn / e2sm / e2sm_control.hpp
index 4d8d687..a93064e 100644 (file)
 /*
-  ==================================================================================
+==================================================================================
 
-  Copyright (c) 2019-2020 AT&T Intellectual Property.
+        Copyright (c) 2019-2020 AT&T Intellectual Property.
 
-  Licensed under the Apache License, Version 2.0 (the "License");
-  you may not use this file except in compliance with the License.
-  You may obtain a copy of the License at
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
 
-  http://www.apache.org/licenses/LICENSE-2.0
+       http://www.apache.org/licenses/LICENSE-2.0
 
-  Unless required by applicable law or agreed to in writing, softwares
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
-  ==================================================================================
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================================
 */
 /*
- * e2sm_control.hpp
+ * e2sm_indication.hpp
  *
  *  Created on: Apr, 2020
  *      Author: Shraboni Jana
  */
+
 /* Classes to handle E2 service model based on e2sm-HelloWorld-v001.asn */
 #ifndef SRC_XAPP_ASN_E2SM_E2SM_CONTROL_HPP_
 #define SRC_XAPP_ASN_E2SM_E2SM_CONTROL_HPP_
 
-
 #include <sstream>
-#include <e2sm_helpers.hpp>
 #include <mdclog/mdclog.h>
 #include <vector>
-
+#include <string>
 #include <E2SM-HelloWorld-ControlHeader.h>
 #include <E2SM-HelloWorld-ControlMessage.h>
 #include <E2SM-HelloWorld-ControlHeader-Format1.h>
 #include <E2SM-HelloWorld-ControlMessage-Format1.h>
 #include <HW-Header.h>
 #include <HW-Message.h>
-class e2sm_control {
+
+class HWControlHeader {
 public:
-       e2sm_control(void);
-  ~e2sm_control(void);
+       HWControlHeader(void);
+       HWControlHeader(unsigned char*, size_t *, bool&);
+  ~HWControlHeader(void);
+   std::string  get_error (void) const {return _error_string ;};
 
-  bool set_fields(E2SM_HelloWorld_ControlHeader_t *, e2sm_control_helper &);
-  bool set_fields(E2SM_HelloWorld_ControlMessage_t *, e2sm_control_helper &);
+  long int get_hw_header(){return this->_hw_header;};
 
-  bool get_fields(E2SM_HelloWorld_ControlHeader_t *, e2sm_control_helper &);
-  bool get_fields(E2SM_HelloWorld_ControlMessage_t *, e2sm_control_helper &);
+  HWControlHeader& set_ricControlHeader(int param_header){
+                               _hw_header = param_header; return *this;
+                       }
 
-  bool encode_control_header(unsigned char *, size_t *, e2sm_control_helper &);
-  bool encode_control_message(unsigned char*, size_t *, e2sm_control_helper &);
 
+  bool decode(unsigned char*, size_t *);
+  bool encode(unsigned char*, size_t *);
 
-  std::string  get_error (void) const {return error_string ;};
 
 private:
 
-  E2SM_HelloWorld_ControlHeader_t * control_head; // used for encoding
-  E2SM_HelloWorld_ControlMessage_t* control_msg;
-  E2SM_HelloWorld_ControlHeader_Format1_t head_fmt1;
-  E2SM_HelloWorld_ControlMessage_Format1_t msg_fmt1;
+  long int _hw_header;
+  E2SM_HelloWorld_ControlHeader_t * _header; // used for encoding
+  E2SM_HelloWorld_ControlHeader_Format1_t _header_fmt1;
 
+  bool setfields(E2SM_HelloWorld_ControlHeader_t *);
 
-  size_t errbuf_len;
-  char errbuf[128];
-  std::string error_string;
+  size_t _errbuf_len = 128;
+  char _errbuf[128];
+  std::string _error_string;
 };
 
 
+class HWControlMessage {
+public:
+       HWControlMessage(void);
+       HWControlMessage(unsigned char*, size_t *, bool&);
+  ~HWControlMessage(void);
+
+  std::string  get_error (void) const {return _error_string ;};
+  bool decode(unsigned char*, size_t *);
+  bool encode(unsigned char*, size_t *);
+
+
+  size_t get_hw_message_size(){return this->_hw_msg_size;};
+  unsigned char* get_hw_message(){return this->_hw_msg;};
+
+  HWControlMessage& set_ricControlMessage(std::string msg){
+                               _hw_msg_size = strlen(msg.c_str());
+                               strncpy((char*)_hw_msg,msg.c_str(),_hw_msg_size);
+                               return *this;
+                       };
+
+private:
+
+  size_t _hw_msg_size;
+  unsigned char _hw_msg[128];
+
+  E2SM_HelloWorld_ControlMessage_t* _message;
+  E2SM_HelloWorld_ControlMessage_Format1_t _message_fmt1;
+
+  bool setfields(E2SM_HelloWorld_ControlMessage_t *);
+
+  size_t _errbuf_len = 128;
+  char _errbuf[128];
+  std::string _error_string;
+};
 
-#endif /* SRC_XAPP_ASN_E2SM_E2SM_CONTROL_HPP_ */
+#endif /* SRC_XAPP_ASN_E2SM_E2SM_INDICATION_HPP_ */