Beispiel #1
0
        @Override
        public void addrValueNotic(Vector<Byte> nStatusValue) {
          if (nStatusValue != null) {
            if (info.getnAddress() != null) {
              Vector<Short> mIData = new Vector<Short>();
              boolean result = PlcRegCmnStcTools.bytesToShorts(nStatusValue, mIData);
              if (result) {
                int value = mIData.get(0);
                int temp = info.getnAddress().nAddrValue + value;
                if (temp < 0) {
                  SKPlcNoticThread.getInstance().destoryCallback(valueCall, sceneId);
                  showValue = "";
                  SKSceneManage.getInstance().onRefresh(items);
                  return;
                }
                if (info.getmOffSetAddress() == null) {
                  AddrProp addrProp = new AddrProp();
                  addrProp.eAddrRWprop = info.getnAddress().eAddrRWprop;
                  addrProp.eConnectType = info.getnAddress().eConnectType;
                  addrProp.nAddrId = info.getnAddress().nAddrId;
                  addrProp.nAddrLen = info.getnAddress().nAddrLen;
                  addrProp.nAddrValue = temp;
                  addrProp.nPlcStationIndex = info.getnAddress().nPlcStationIndex;
                  addrProp.nRegIndex = info.getnAddress().nRegIndex;
                  addrProp.nUserPlcId = info.getnAddress().nUserPlcId;
                  addrProp.sPlcProtocol = info.getnAddress().sPlcProtocol;
                  info.setmOffSetAddress(addrProp);
                } else {
                  info.getmOffSetAddress().nAddrValue = temp;
                }

                SKPlcNoticThread.getInstance().destoryCallback(valueCall, sceneId);
                SKPlcNoticThread.getInstance()
                    .addNoticProp(info.getmOffSetAddress(), valueCall, false, sceneId, true);

                if (info.getnAddress().eConnectType > 1) {
                  SKSceneManage.getInstance()
                      .updateSceneReadAddrs(sceneId, info.getmOffSetAddress());
                }
              }
            }
          }
        }