Ejemplo n.º 1
0
        ResponsePackage GetBendStretchData(byte[] buffer, int offset)
        {
            ResponsePackage responsePackage = new ResponsePackage();
            responsePackage.Code = ResponseCodes.BendStretchData;

            responsePackage.BendStretchAngle = (float)BitConverter.ToInt16(buffer , offset)  / 10;
            responsePackage.BendStretchForce = (float)BitConverter.ToInt16(buffer, offset + 2);
            responsePackage.BendStretchSpeed = (float)BitConverter.ToInt16(buffer, offset + 4) / 10;
            //responsePackage.BendStretchVoltage = Convert.ToSingle(Convert.ToInt32(buffer[offset + 6])<128?Convert.ToInt32(buffer[offset + 6]):(256-Convert.ToInt32(buffer[offset + 6])) * -1) / 10;
            unchecked
            {
                responsePackage.BendStretchVoltage = (SByte)buffer[offset + 6];
            }
            return responsePackage;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 过程控制
 /// </summary>
 /// <param name="responsePackage"></param>
 public virtual void Control(ResponsePackage responsePackage) { }
Ejemplo n.º 3
0
        ResponsePackage GetVersion(byte[] buffer, int offset)
        {
            ResponsePackage responsePackage = new ResponsePackage();
            responsePackage.Code = ResponseCodes.Version;
            responsePackage.Version1 = Convert.ToInt32(buffer[offset]);
            responsePackage.Version2 = Convert.ToInt32(buffer[offset + 1]);
            responsePackage.Version3 = Convert.ToInt32(buffer[offset + 2]);

            return responsePackage;
        }
Ejemplo n.º 4
0
 ResponsePackage GetAlarm(byte[] buffer, int offset)
 {
     ResponsePackage responsePackage = new ResponsePackage();
     responsePackage.Code = ResponseCodes.Alarm;
     responsePackage.Alarm = Convert.ToInt32(buffer[offset]);
     return responsePackage;
 }
Ejemplo n.º 5
0
        ResponsePackage GetOtherData(byte[] buffer, int offset)
        {
            ResponsePackage responsePackage = new ResponsePackage();
            responsePackage.Code = ResponseCodes.OtherData;

            //推杆角度
            unchecked
            {
                responsePackage.PushRodAngle = (SByte)buffer[offset];
                responsePackage.HomingAngle = (SByte)buffer[offset + 1];
            }
            //限位开关
            responsePackage.LimitSwitch = BitConverter.ToInt32(new byte[] { buffer[offset + 4], buffer[offset + 3], buffer[offset + 2], 0 }, 0);

            return responsePackage;
        }
 public PositionArgs(ResponsePackage package)
 {
     this.package = package;
 }