code: public DevState state(final DeviceProxy deviceProxy, final boolean src) throws DevFailed {
  
          build_connection(deviceProxy);
  
          if (deviceProxy.url.protocol == TANGO) {
              DevState state = DevState.UNKNOWN;
              final int retries = deviceProxy.transparent_reconnection ? 2 : 1;
              boolean done = false;
              for (int i = 0; i < retries && !done; i++) {
                  try {
                      //noinspection PointlessBooleanExpression
                      if (src == ApiDefs.FROM_ATTR) {
                          state = deviceProxy.device.state();
                      } else {
                      final DeviceData argout = deviceProxy.command_inout("State");
                      state = argout.extractDevState();
                      }
                      done = true;
                  } catch (final Exception e) {
                      manageExceptionReconnection(deviceProxy,
                              retries, i, e, this.getClass() + ".state");
                  }
              }
              return state;
          } else {
              final DeviceData argout = command_inout(deviceProxy, "DevState");
              final short state = argout.extractShort();
              return T2Ttypes.tangoState(state);
          }
      }
docs: ===========================================================