示例#1
0
  /** 注册地址值 */
  private void registAddr() {
    // TODO Auto-generated method stub
    if (null != info.getnAddress()) {
      SKPlcNoticThread.getInstance().addNoticProp(info.getnAddress(), valueCall, false, sceneId);
    }

    if (null != info.getmOffSetAddr()) {
      SKPlcNoticThread.getInstance().addNoticProp(info.getmOffSetAddr(), addOffSet, false, sceneId);
    }

    // 注册触控地址值
    if (touchByAddr && null != info.getmTouchinInfo().getTouchAddrProp()) {
      ADDRTYPE addrType = info.getmTouchinInfo().geteCtlAddrType();
      if (addrType == ADDRTYPE.BITADDR) {
        SKPlcNoticThread.getInstance()
            .addNoticProp(info.getmTouchinInfo().getTouchAddrProp(), touchCall, true, sceneId);
      } else {
        SKPlcNoticThread.getInstance()
            .addNoticProp(info.getmTouchinInfo().getTouchAddrProp(), touchCall, false, sceneId);
      }
    }

    // 注册显现地址值
    if (showByAddr && null != info.getmShowInfo().getShowAddrProp()) {
      ADDRTYPE addrType = info.getmShowInfo().geteAddrType();
      if (addrType == ADDRTYPE.BITADDR) {
        SKPlcNoticThread.getInstance()
            .addNoticProp(info.getmShowInfo().getShowAddrProp(), showCall, true, sceneId);
      } else {
        SKPlcNoticThread.getInstance()
            .addNoticProp(info.getmShowInfo().getShowAddrProp(), showCall, false, sceneId);
      }
    }
    // 位控制键盘是否弹出
    if (null != info.getsBitAddress()) {
      SKPlcNoticThread.getInstance()
          .addNoticProp(info.getsBitAddress(), bitKeyBoard, true, sceneId);
    }
  }
示例#2
0
  public SKASCIIDisplay(Context context, int itemId, int sceneId, AcillInputInfo info) {
    mContext = context;
    isOnclick = false;
    isTouchFlag = true;
    isShowFlag = true;
    showByUser = false;
    touchByUser = false;
    showByAddr = false;
    touchByAddr = false;
    // keyIsShow = true;
    this.sceneId = sceneId;
    this.itemId = itemId;
    showValue = "";
    mPaint = new Paint();
    items = new SKItems();
    this.info = info;
    notTouchOpenKey = false;

    if (info != null) {
      mRect = new Rect();
      mRect.left = info.getnStartX();
      mRect.right = info.getnStartX() + info.getnWidth();
      mRect.top = info.getnStartY();
      mRect.bottom = info.getnStartY() + info.getnHeight();

      text = new StaticTextModel();
      text.setM_backColorPadding(info.getnBackColor());
      text.setM_eTextAlign(info.getnShowStyle());
      text.setM_nFontColor(info.getnFontColor());
      text.setM_nFontSize(info.getnFontsize());
      text.setM_sFontFamly(info.getsFontStyle());
      text.setM_textLanguageId(1);
      text.setM_textPro((short) (info.geteFontCss()));
      text.setStartX(info.getnTextStartX());
      text.setStartY(info.getnTextStartY());
      text.setRectHeight(info.getnTextHeight());
      text.setRectWidth(info.getnTextWidth());
      text.setM_alphaPadding(info.getnTransparent()); // 设置透明度
      //			if (info.getnTransparent() == 0) {
      //				text.setBorderAlpha(255);
      //				text.setLineColor(Color.BLACK);
      //				text.setLineWidth(1);
      //			}

      textItem = new TextItem(text);
      textItem.initTextPaint();
      textItem.initRectBoderPaint();
      textItem.initRectPaint();

      items.itemId = this.itemId;
      items.nCollidindId = info.getnCollidindId();
      items.nZvalue = info.getnZvalue();
      items.sceneId = sceneId;
      items.rect = mRect;
      items.mGraphics = this;

      if (null != info.getmTouchinInfo()) {
        if (-1 != info.getmTouchinInfo().getnAddrId() && info.getmTouchinInfo().isbTouchByAddr()) {
          touchByAddr = true;
        }
        if (info.getmTouchinInfo().isbTouchByUser()) {
          touchByUser = true;
        }
      }
      if (null != info.getmShowInfo()) {
        if (-1 != info.getmShowInfo().getnAddrId() && info.getmShowInfo().isbShowByAddr()) {
          showByAddr = true;
        }
        if (info.getmShowInfo().isbShowByUser()) {
          showByUser = true;
        }
      }

      // 注册地址值
      registAddr();
    }
  }
示例#3
0
  /**
   * 将值写入地址
   *
   * @param inputKeyString
   */
  private void writeToAddr(String inputKeyString) {
    // 输入完成后,执行通知操作通知
    noticeAddr(info.getmTouchinInfo(), true);
    // 进行输入完成后 执行宏指令
    // 若启用宏指令
    if (true == info.isbIsStartStatement()) {
      // 请求执行控件宏指令
      MacroManager.getInstance(null).Request(MSERV.CALLCM, (short) info.getnScriptId());
    }
    // 将输入的值进行数据类型进行转换
    byte[] by = converCodeWrite(inputKeyString);
    // 将输入转换后的数组写入地址
    Vector<Byte> dataList = new Vector<Byte>();

    if (0 != by.length) {
      if ((AcillCode.UNICODE & info.getnCode()) == AcillCode.UNICODE) {
        for (int i = 2; i < by.length; i++) {
          dataList.add(by[i]);
        }
      } else {
        for (int i = 0; i < by.length; i++) {
          dataList.add(by[i]);
        }
      }
    }
    SEND_DATA_STRUCT mSendData = new SEND_DATA_STRUCT();
    mSendData.eDataType = DATA_TYPE.ASCII_STRING;
    mSendData.eReadWriteCtlType = READ_WRITE_COM_TYPE.GLOBAL_LOOP_W;
    if (null != info.getnAddress()) {
      if (info.getmOffSetAddress() != null) {
        int nAddrLeng = info.getmOffSetAddress().nAddrLen;
        if (nAddrLeng * 2 > dataList.size()) {
          for (int i = dataList.size(); i < nAddrLeng * 2; i++) {
            dataList.add((byte) 0x00);
          }
        }

        if (info.isInputIsShow()) // 输入地址跟显示地址一样
        {
          PlcRegCmnStcTools.setRegAsciiData(info.getmOffSetAddress(), dataList, mSendData);
        } else {
          // 输入地址跟显示地址不一样,写入地址时,传入输入地址
          PlcRegCmnStcTools.setRegAsciiData(info.getInputAddr(), dataList, mSendData);
        }

      } else {
        int nAddrLeng = info.getnAddress().nAddrLen;
        if (nAddrLeng * 2 > dataList.size()) {
          for (int i = dataList.size(); i < nAddrLeng * 2; i++) {
            dataList.add((byte) 0x00);
          }
        }
        if (info.isInputIsShow()) // 输入地址跟显示地址一样
        {
          PlcRegCmnStcTools.setRegAsciiData(info.getnAddress(), dataList, mSendData);
        } else {
          PlcRegCmnStcTools.setRegAsciiData(info.getInputAddr(), dataList, mSendData);
        }
      }
    }
  }
示例#4
0
 private void asciiIsTouch() {
   if (touchByAddr || touchByUser) {
     isTouchFlag = popedomIsTouch(info.getmTouchinInfo());
   }
 }
示例#5
0
  @Override
  public boolean onTouchEvent(MotionEvent event) {
    // TODO Auto-generated method stub
    // 允许输入
    SKSceneManage.getInstance().time = 0;
    boolean touch = false;
    int x = (int) event.getX();
    int y = (int) event.getY();
    if (null == info) {
      return false;
    }

    if (info.geteInputTypeId() == INPUT_TYPE.BIT) {
      return false;
    }
    if (x < info.getnStartX()
        || x > info.getnStartX() + info.getnWidth()
        || y < info.getnStartY()
        || y > info.getnStartY() + info.getnHeight()) {
      return false;
    } else {
      if (!info.isbIsinput()) { // 不允许输入 直接返回
        return false;

      } else {
        if (!isTouchFlag || !isShowFlag) {

          if (!isTouchFlag && info != null) {
            if (info.getmTouchinInfo() != null) {
              if (event.getAction() == MotionEvent.ACTION_DOWN) {
                if (info.getmTouchinInfo().isbTouchByUser()) {
                  SKSceneManage.getInstance().turnToLoginPop();
                }
              }
            }
          }

          return false;
        }

        if (event.getAction() == MotionEvent.ACTION_DOWN) {

          isOnclick = true;
          if (info.getmTouchinInfo() == null) {
            doTouch(notTouchOpenKey);
          } else {
            if (info.getmTouchinInfo().isbTimeoutCancel() == true
                && info.getmTouchinInfo().getnPressTime() > 0) {
              if (null == hand) {
                hand = new myMainHandler(Looper.getMainLooper());
              }
              hand.sendEmptyMessageDelayed(
                  TOUCHHANDER, info.getmTouchinInfo().getnPressTime() * 100);
            } else {
              doTouch(notTouchOpenKey);
            }
          }
          touch = true;
        } else if (event.getAction() == MotionEvent.ACTION_MOVE) {
          return true;
        } else if (MotionEvent.ACTION_UP == event.getAction()
            || MotionEvent.ACTION_CANCEL == event.getAction()) {
          isOnclick = false;
          touch = true;
        }
      }
    }

    return touch;
  }