code: private synchronized void setState(int state) {
          mState = state;
  
          // Give the new state to the Handler so the UI Activity can update
          mHandler.obtainMessage(ISOBlueDemo.MESSAGE_STATE_CHANGE, state, -1)
                  .sendToTarget();
      }
docs: Set the current state of the chat connection
  
  @param state
  An integer defining the current connection state