/**
   * Starts the session with the remote controllable device
   *
   * @param eventsListener
   */
  public void startSession(DeviceEventsListener eventsListener) throws ControlPanelException {
    if (eventsListener == null) {
      throw new ControlPanelException("Events listener can't be NULL");
    }

    deviceEventsListener = eventsListener;

    if (sessionId != null) {
      String msg =
          "The device is already in session: '" + deviceId + "', sessionId: '" + sessionId + "'";
      Log.d(TAG, msg);
      deviceEventsListener.sessionEstablished(this, getControlPanelCollections());
      return;
    }

    connMgr.registerEventListener(ConnManagerEventType.SESSION_JOINED, this);
    connMgr.registerEventListener(ConnManagerEventType.SESSION_LOST, this);
    connMgr.registerEventListener(ConnManagerEventType.SESSION_JOIN_FAIL, this);

    Log.d(TAG, "Device: '" + deviceId + "' starting session with sender: '" + sender + "'");
    Status status = connMgr.joinSession(sender, deviceId);

    if (status != Status.OK) {
      String statusName = status.name();
      Log.e(TAG, "Failed to join session: '" + statusName + "'");
      deviceEventsListener.errorOccurred(this, statusName);
      return;
    }
  } // startSession