public void MergeFrom(ArduinoAction other)
    {
        if (other == null)
        {
            return;
        }
        switch (other.MessageCase)
        {
        case MessageOneofCase.ArduinoJoin:
            if (ArduinoJoin == null)
            {
                ArduinoJoin = new global::ArduinoJoin();
            }
            ArduinoJoin.MergeFrom(other.ArduinoJoin);
            break;

        case MessageOneofCase.ArduinoWorkoutAction:
            if (ArduinoWorkoutAction == null)
            {
                ArduinoWorkoutAction = new global::ArduinoWorkoutAction();
            }
            ArduinoWorkoutAction.MergeFrom(other.ArduinoWorkoutAction);
            break;
        }

        _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
    }
        private void AddArduinoToRoom(ArduinoJoin arduinoActionArduinoJoin, IWebSocketConnection connection)
        {
            var response = new ServerMessage();

            var repository = _lifetimeScope.Resolve <IRepository>();

            if (repository.GetAll <ArduinoDevice>()
                .Any(arduino => arduino.ArduinoDeviceId == arduinoActionArduinoJoin.ArduinoId))
            {
                response.ArduinoConnectedMessage = new ArduinoConnected
                {
                    Fail = true
                };
            }
            else
            {
                var room = _socketRooms
                           .FirstOrDefault(x => x.ConnectedClients
                                           .Any(client => client.RfIdCardNumber == arduinoActionArduinoJoin.RfIdCard));

                if (room == null)
                {
                    room = new SocketRoom();
                }

                var newClient = new ArduinoSocketClient(room, connection, arduinoActionArduinoJoin.RfIdCard);
                room.AddClient(newClient);

                _joinedClients.TryAdd(connection, newClient);
            }

            connection.Send(response.ToByteArray());
        }
    public override int GetHashCode()
    {
        int hash = 1;

        if (messageCase_ == MessageOneofCase.ArduinoJoin)
        {
            hash ^= ArduinoJoin.GetHashCode();
        }
        if (messageCase_ == MessageOneofCase.ArduinoWorkoutAction)
        {
            hash ^= ArduinoWorkoutAction.GetHashCode();
        }
        hash ^= (int)messageCase_;
        if (_unknownFields != null)
        {
            hash ^= _unknownFields.GetHashCode();
        }
        return(hash);
    }