# Path: beeswarm/shared/socket_enum.py
# class SocketNames(Enum):
#     #### Sockets used on server ####
#     # All data received from drones will be published on this socket
#     DRONE_DATA = 'inproc://droneData'
#     # After sessions has been classified they will get retransmitted on this socket.
#     # TODO: Does not actually happen yet
#     PROCESSED_SESSIONS = 'inproc://processedSessionPublisher'
#     # Request / Reply to config actor
#     CONFIG_COMMANDS = 'inproc://configCommands'
#     # Data sent on this socket will be retransmitted to the correct drone, the data must be prefixed with
#     # the id of the drone.
#     DRONE_COMMANDS = 'inproc://droneCommands'
# 
# 
#     # Requests to and from the databsae
#     DATABASE_REQUESTS = 'inproc://databaseRequests'
# 
#     #### Sockets used on drones ####
#     # Drone commands received from the server will be retransmitted  on this socket.
#     SERVER_COMMANDS = 'inproc://serverCommands'
#     # All messages transmitted on this socket will get retransmitted to the server
#     SERVER_RELAY = 'inproc://serverRelay'


import logging
import zmq.green as zmq
import beeswarm
from gevent import Greenlet
from beeswarm.shared.socket_enum import SocketNames
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.





logger = logging.getLogger(__name__)


class BaseLogger(Greenlet):
    def __init__(self, options):
        Greenlet.__init__(self)
        self.enabled = True
        self.options = options

    def _run(self):
        context = beeswarm.shared.zmq_context
        processed_sessions_socket = context.socket(zmq.SUB)
        processed_sessions_socket.connect(SocketNames.PROCESSED_SESSIONS.value)
        processed_sessions_socket.setsockopt(zmq.SUBSCRIBE, '')

        live_sessions_socket = context.socket(zmq.SUB)

# Path: beeswarm/shared/socket_enum.py
# class SocketNames(Enum):
#     #### Sockets used on server ####
#     # All data received from drones will be published on this socket
#     DRONE_DATA = 'inproc://droneData'
#     # After sessions has been classified they will get retransmitted on this socket.
#     # TODO: Does not actually happen yet
#     PROCESSED_SESSIONS = 'inproc://processedSessionPublisher'
#     # Request / Reply to config actor
#     CONFIG_COMMANDS = 'inproc://configCommands'
#     # Data sent on this socket will be retransmitted to the correct drone, the data must be prefixed with
#     # the id of the drone.
#     DRONE_COMMANDS = 'inproc://droneCommands'
# 
# 
#     # Requests to and from the databsae
#     DATABASE_REQUESTS = 'inproc://databaseRequests'
# 
#     #### Sockets used on drones ####
#     # Drone commands received from the server will be retransmitted  on this socket.
#     SERVER_COMMANDS = 'inproc://serverCommands'
#     # All messages transmitted on this socket will get retransmitted to the server
#     SERVER_RELAY = 'inproc://serverRelay'


# Path: beeswarm/server/reporting/base_logger.py
import logging
import zmq.green as zmq
import beeswarm
from gevent import Greenlet
from beeswarm.shared.socket_enum import SocketNames

# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.





logger = logging.getLogger(__name__)


class BaseLogger(Greenlet):
    def __init__(self, options):
        Greenlet.__init__(self)
        self.enabled = True
        self.options = options

    def _run(self):
        context = beeswarm.shared.zmq_context
        processed_sessions_socket = context.socket(zmq.SUB)
        processed_sessions_socket.connect(SocketNames.PROCESSED_SESSIONS.value)
        processed_sessions_socket.setsockopt(zmq.SUBSCRIBE, '')

        live_sessions_socket = context.socket(zmq.SUB)

        live_sessions_socket.connect(SocketNames.DRONE_DATA.value)