Пример #1
0
  @Override
  public int ParseFromByteArrayAndProcess(byte[] BA, int Idx, int Size) throws Exception {
    short Descriptor = TDataConverter.ConvertLEByteArrayToInt16(BA, Idx);
    Idx += DescriptorSize;
    switch (Descriptor) {
      case TimestampTag:
        double Timestamp = TDataConverter.ConvertLEByteArrayToDouble(BA, Idx);
        Idx += 8; // . SizeOf(Double)
        if (OnTimestampHandler != null) OnTimestampHandler.DoOnValue(Timestamp);
        break; // . >

      case TemperatureTag:
        double Temperature = TDataConverter.ConvertLEByteArrayToDouble(BA, Idx);
        Idx += 8; // . SizeOf(Double)
        if (OnTemperatureHandler != null) OnTemperatureHandler.DoOnValue(Temperature);
        break; // . >

      case PressureTag:
        double Pressure = TDataConverter.ConvertLEByteArrayToDouble(BA, Idx);
        Idx += 8; // . SizeOf(Double)
        if (OnPressureHandler != null) OnPressureHandler.DoOnValue(Pressure);
        break; // . >

      case HumidityTag:
        double Humidity = TDataConverter.ConvertLEByteArrayToDouble(BA, Idx);
        Idx += 8; // . SizeOf(Double)
        if (OnHumidityHandler != null) OnHumidityHandler.DoOnValue(Humidity);
        break; // . >
    }
    return Idx;
  }
Пример #2
0
 public int FromByteArray(byte[] BA, int Idx) throws IOException {
   Level = TDataConverter.ConvertLEByteArrayToInt16(BA, Idx);
   Idx += 2;
   // .
   InfoComponent_Type = TDataConverter.ConvertLEByteArrayToInt16(BA, Idx);
   Idx += 2;
   InfoComponent_ID = TDataConverter.ConvertLEByteArrayToInt32(BA, Idx);
   Idx += 8; // . Int64
   // .
   BindingPointX = TDataConverter.ConvertLEByteArrayToDouble(BA, Idx);
   Idx += 8;
   BindingPointY = TDataConverter.ConvertLEByteArrayToDouble(BA, Idx);
   Idx += 8;
   BaseSquare = TDataConverter.ConvertLEByteArrayToDouble(BA, Idx);
   Idx += 8;
   // .
   InfoImageDATAFileID = TDataConverter.ConvertLEByteArrayToInt32(BA, Idx);
   Idx += 8; // . Int64
   byte SS = BA[Idx];
   Idx++;
   if (SS > 0) {
     InfoString = new String(BA, Idx, SS, "windows-1251");
     Idx += SS;
   } else InfoString = "";
   InfoStringFontColor = TDataConverter.ConvertLEByteArrayToInt32(BA, Idx);
   Idx += 4;
   InfoStringFontSize = BA[Idx];
   Idx++;
   SS = BA[Idx];
   Idx++;
   if (SS > 0) {
     InfoStringFontName = new String(BA, Idx, SS, "windows-1251");
     Idx += SS;
   } else InfoStringFontName = "";
   // .
   Typeface tf = Typeface.create(InfoStringFontName, Typeface.NORMAL);
   paint.setTypeface(tf);
   paint.setAntiAlias(true);
   paint.setTextSize(InfoStringFontSize * metrics.density * 2.0F);
   byte R = (byte) (InfoStringFontColor & 255);
   byte G = (byte) ((InfoStringFontColor >> 8) & 255);
   byte B = (byte) ((InfoStringFontColor >> 16) & 255);
   paint.setColor(Color.argb(255, R, G, B));
   // .
   return Idx;
 }
 public int FromByteArray(byte[] BA, int Idx) throws IOException {
   id = TDataConverter.ConvertLEByteArrayToInt32(BA, Idx);
   Idx += 4;
   DivX = TDataConverter.ConvertLEByteArrayToInt32(BA, Idx);
   Idx += 4;
   DivY = TDataConverter.ConvertLEByteArrayToInt32(BA, Idx);
   Idx += 4;
   SegmentWidth = TDataConverter.ConvertLEByteArrayToDouble(BA, Idx);
   Idx += 8;
   SegmentHeight = TDataConverter.ConvertLEByteArrayToDouble(BA, Idx);
   Idx += 8;
   VisibleMinScale = TDataConverter.ConvertLEByteArrayToDouble(BA, Idx);
   Idx += 8;
   VisibleMaxScale = TDataConverter.ConvertLEByteArrayToDouble(BA, Idx);
   Idx += 8;
   return Idx;
 }