Restructure O1 module to run as a thread in O-DU High binary [Issue-Id: ODUHIGH-297]
[o-du/l2.git] / src / o1 / O1App.hpp
similarity index 67%
rename from src/o1/o1_client/GlobalDefs.h
rename to src/o1/O1App.hpp
index 6323819..b1653d3 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
 ################################################################################
-#   Copyright (c) [2020] [HCL Technologies Ltd.]                               #
+#   Copyright (c) [2020-2021] [HCL Technologies Ltd.]                          #
 #                                                                              #
 #   Licensed under the Apache License, Version 2.0 (the "License");            #
 #   you may not use this file except in compliance with the License.           #
 ################################################################################
 *******************************************************************************/
 
-/* Class for global defines and constants for O1 interface */
+/* This file contains the O1App class which is responsible for running/starting
+   all the O1 modules in a thread. It inherits the Thread class and Singleton
+   class.
+*/
 
-#ifndef __GLOBAL_DEFS_H__
-#define __GLOBAL_DEFS_H__
+#ifndef __O1_APP_HPP__
+#define __O1_APP_HPP__
 
-#include <syslog.h>
+#include "Singleton.hpp"
+#include "Thread.hpp"
+#include "UnixSocketServer.hpp"
 
-#define O1_LOG(...) ({\
-               printf(__VA_ARGS__);\
-               syslog(LOG_DEBUG,__VA_ARGS__);\
-               })
 
-#define TCP_PORT           8282
-#define TCP_SERVER_IP      "127.0.0.1"
-#define CELL_UP_ALARM_ID   1009
-#define CELL_DOWN_ALARM_ID 1010
+class O1App : public Singleton<O1App>, public Thread 
+{
+   friend Singleton<O1App>;
+   
+   private:
+   bool mStartupStatus;
+   UnixSocketServer mUxSocketServer;
 
-#endif
+   protected:
+   bool run();
+
+   public:
+   O1App();
+   ~O1App();
+   bool getStartupStatus()const;
+   void cleanUp(void);
+};
 
-/**********************************************************************
-         End of file
-**********************************************************************/
+
+#endif