// PAGE new public PDU Decode(BACPacket cm) { cm.getNextByte(); invokerId = cm.getNextByte(); rej_reason = (BACNET_Reject_Reason)cm.getNextByte(); return(this); }
new public PDU Decode(BACPacket cm) { System.Console.Write("Decoding PDUComplexAck"); byte a = cm.getNextByte(); segMessage = DecodeSegMessage(a); moreFollows = DecodeMoreFollows(a); orgInvokeID = cm.getNextByte(); // If the optional parameter are present if (segMessage) { sequenceNumber = cm.getNextByte(); proposedWindowSize = cm.getNextByte(); } serviceACKchoice = (ConfirmedServiceChoice)cm.getNextByte(); switch (serviceACKchoice) { case ConfirmedServiceChoice.READPROPERTY: apduService = new APDUReadProperty(); apduService.Decode(cm); break; } return(this); }
public Boolean Decode(BACPacket cm) { if (0 == cm.getNextByte().CompareTo(0x81)) { function = (BVLL_IP_Fnct)cm.getNextByte(); length = cm.getNextByte(); length = (UInt16)(length << 4); length += cm.getNextByte(); cm.setLength(length); switch (function) { case BVLL_IP_Fnct.ORIGINAL_UNICAST_NPDU: NPCI pic = new NPCI(); pic.Decode(cm); inner = pic.ToString(); System.Console.WriteLine(ToString()); break; case BVLL_IP_Fnct.ORIGINAL_BROADCAST_NPDU: NPCI pic1 = new NPCI(); pic1.Decode(cm); inner = pic1.ToString(); System.Console.WriteLine(ToString()); break; default: break; } return(true); } return(false); }
public override NSDU Decode(BACPacket cm) { nlm = (Network_Layer_Message)cm.getNextByte(); while (cm.hasMore() == true) { nNumbers.Add(new networkNumberID().Decode(cm)); } return(this); }
public networkNumberID Decode(BACPacket cm) { networkNumber = new byte[2]; for (int x = 0; x < 2; x++) { networkNumber[x] = cm.getNextByte(); } return(this); }
// PAGE new public PDU Decode(BACPacket cm) { cm.getNextByte(); invokerId = cm.getNextByte(); serviceChoseError = (BACNET_ServiceChoice_Error)cm.getNextByte(); Bv1 = new BACVnetVar().Decode(cm); Bv2 = new BACVnetVar().Decode(cm); return(this); }
public BACVnetVar Decode(BACPacket cm, byte length) { stringValue[0] = cm.getNextByte(); for (int x = 1; x < length; x++) { stringValue[x] = cm.getNextByte(); } return(this); }
public BACVnetVar Decode(BACPacket cm, int length) { numericValue = new byte[length]; numericValue[0] = cm.getNextByte(); for (int x = 1; x < length; x++) { numericValue[x] = cm.getNextByte(); } return(this); }
public override NSDU Decode(BACPacket cm) { nlm = (Network_Layer_Message)cm.getNextByte(); Ports = cm.getNextByte(); rd = new RoutingData[Ports]; for (int x = 0; x < Ports; x++) { rd[x] = new RoutingData().Decoder(cm); } return(this); }
public override APDUService Decode(BACPacket cm) { if (cm.hasMore() == true) { ObjId = (BACVnetObjectIdentifier) new BACVnetObjectIdentifier().Decode(cm, BACVnetVar.CONTEXT_TAG.OBJECT); } else { MissReqPar = true; return(this); } if (cm.hasMore() == true) { PropId = new BACVnetPropertyId().Decode(cm, BACVnetVar.CONTEXT_TAG.ENUM); } else { MissReqPar = true; return(this); } // Index of the desired property to read (if requesting the data) // If omitted with an array value; returns the entire array list if (cm.hasMore() == true) { if (cm.GetAction() == BACPacket.Action_Type.REQUEST) { switch (ObjId.getObjectType()) { case BACVnetObjectIdentifier.BACnetObjectType.ANALOG_INPUT: case BACVnetObjectIdentifier.BACnetObjectType.ANALOG_OUTPUT: case BACVnetObjectIdentifier.BACnetObjectType.ANALOG_VALUE: AnyVar = new BACVnetVar().Decode(cm, BACVnetVar.CONTEXT_TAG.REAL); break; case BACVnetObjectIdentifier.BACnetObjectType.BINARY_INPUT: case BACVnetObjectIdentifier.BACnetObjectType.BINARY_OUTPUT: case BACVnetObjectIdentifier.BACnetObjectType.BINARY_VALUE: AnyVar = new BACVnetVar().Decode(cm, BACVnetVar.CONTEXT_TAG.BSTRING); break; default: break; } } else { AnyVar = new BACVnetVar().Decode(cm); } } return(this); }
new public PDU Decode(BACPacket cm) { cm.getNextByte(); srvChoise = (BACnetUnconfirmedServiceChoice)cm.getNextByte(); switch (srvChoise) { case BACnetUnconfirmedServiceChoice.I_AM: //a = new I_AM_Srv_Struct(); while (cm.hasMore() == true) { bv.Add(new BACVnetVar().Decode(cm)); } break; case BACnetUnconfirmedServiceChoice.I_HAVE: while (cm.hasMore() == true) { bv.Add(new BACVnetVar().Decode(cm)); } break; case BACnetUnconfirmedServiceChoice.WHO_HAS: while (cm.hasMore() == true) { bv.Add(new BACVnetVar().Decode(cm)); } break; case BACnetUnconfirmedServiceChoice.WHO_IS: while (cm.hasMore() == true) { bv.Add(new BACVnetVar().Decode(cm, BACVnetVar.CONTEXT_TAG.UINT)); } break; case BACnetUnconfirmedServiceChoice.TIMESYNCHRONIZATION: while (cm.hasMore() == true) { bv.Add(new BACVnetVar().Decode(cm)); } break; default: while (cm.hasMore() == true) { bv.Add(new BACVnetVar().Decode(cm)); } break; } return(this); }
public override NSDU Decode(BACPacket cm) { nlm = (Network_Layer_Message)cm.getNextByte(); if (cm.hasMore() == true) { networkNumber = new byte[2]; for (int x = 0; x < 2; x++) { networkNumber[x] = cm.getNextByte(); } } return(this); }
public override BACVnetVar Decode(BACPacket cm) { byte tag = cm.getNextByte(); int length = tag & 0x07; stringValue = new byte[length]; stringValue[0] = cm.getNextByte(); for (int x = 1; x < length; x++) { stringValue[x] = cm.getNextByte(); } return(this); }
public virtual BACVnetVar Decode(BACPacket cm, CONTEXT_TAG ct) { byte a = cm.getNextByte(); classType = DecodeClass(a); length = DecodeLenValType(a); switch (ct) { case CONTEXT_TAG.NULL: return(new BACVnetNull().Decode(cm)); case CONTEXT_TAG.BOOLEAN: return(new BACVnetBoolean().Decode(cm)); case CONTEXT_TAG.INT: return(new BACVnetInt().Decode(cm, length)); case CONTEXT_TAG.UINT: return(new BACVnetUInt().Decode(cm, length)); case CONTEXT_TAG.REAL: return(new BACVnetReal().Decode(cm, length)); case CONTEXT_TAG.DOUBLE: return(new BACVnetDouble().Decode(cm, length)); case CONTEXT_TAG.BSTRING: return(new BACVnetBString().Decode(cm, length)); case CONTEXT_TAG.CSTRING: return(new BACVnetCString().Decode(cm, length)); case CONTEXT_TAG.OSTRING: return(new BACVnetOString().Decode(cm, length)); case CONTEXT_TAG.DATE: return(new BACVnetDate().Decode(cm, length)); case CONTEXT_TAG.TIME: return(new BACVnetTime().Decode(cm, length)); case CONTEXT_TAG.ENUM: // 20.2.11 Encoding of an Enumerated Value; pg 1496 return(new BACVnetEnum().Decode(cm, length)); case CONTEXT_TAG.OBJECT: return(new BACVnetObjectIdentifier().Decode(cm, length)); } return(this); }
public RoutingData Decoder(BACPacket cm) { for (int x = 0; x < 2; x++) { ConnectedDNET[x] = cm.getNextByte(); } PortId = cm.getNextByte(); PortInfLng = cm.getNextByte(); PortInf = new byte[PortInfLng]; for (int x = 0; x < PortInfLng; x++) { PortInf[x] = cm.getNextByte(); } return(this); }
public void Decode(BACPacket cm) { p = PRESENCES.EXIST; netNumber = cm.getNextByte(); netNumber *= 0x0100; netNumber += cm.getNextByte(); adrLen = cm.getNextByte(); adr = new byte[0]; for (int x = 0; x < adrLen; x++) { adr = adr.Concat(new byte[1] { cm.getNextByte() }).ToArray(); } }
public BACVnetVar Decode(BACPacket cm, int length) { // This is not right and needs to be removed later if (length == 0) { length = 1; } numericValue = new byte[length]; numericValue[0] = cm.getNextByte(); for (int x = 1; x < length; x++) { numericValue[x] = cm.getNextByte(); } return(this); }
UInt32 instanceNumber; // A 22-bit object instance number public BACVnetVar Decode(BACPacket cm, byte length) { if (length != 4) { return(null); } UInt32 val = cm.getNextByte(); for (int x = 0; x < 3; x++) { val *= 0x0100; val += cm.getNextByte(); } ((BACVnetObjectIdentifier)this).Decode(val); return(this); }
public Boolean Decode(BACPacket cm) { pciVersion = cm.getNextByte(); // PIC Version is allways 0x01 if (pciVersion != 0x01) { return(false); } byte picByt = cm.getNextByte(); messageType = this.DecodeMType(picByt); destPresent = this.DecodeDestonation(picByt); srcPresent = this.DecodeSource(picByt); expectingReply = this.DecodeExpectingReply(picByt); priority = this.DecodePriority(picByt); //IF it contains the destonation addr get it if (destPresent == PRESENCES.EXIST) { destAddr.Decode(cm); } //IF it contains the source addr get it if (srcPresent == PRESENCES.EXIST) { srcAddr.Decode(cm); } //IF it contains the destonation don't forget the hop count if (destPresent == PRESENCES.EXIST) { hopCnt = cm.getNextByte(); } if (messageType == MTYPE.APPICATION) { pdu = pdu.Decode(cm); } else { nsdu = nsdu.Decode(cm); } return(true); }
public virtual BACVnetVar Decode(BACPacket cm) { byte tag = cm.getByte(); switch (DecodeClass(tag)) { case CLASS.APPLICATION: CONTEXT_TAG ct = (CONTEXT_TAG)(cm.getByte() >> 4); return(Decode(cm, ct)); case CLASS.CONTEXT: // IF this is an Openning Tag if ((tag & 0x0F) == 0x0E) { BACVnetConstructed constr = new BACVnetConstructed(); cm.getNextByte(); while (cm.hasMore() == true) { tag = cm.getByte(); // IF this is the closing Tag if ((tag & 0x0F) == 0x0F) { cm.getNextByte(); break; } BACVnetVar vn = new BACVnetVar().Decode(cm); constr.AddVar(vn); //constr.AddVar(cm.getNextByte()); } return(constr); } else { // This would be an error ?? CONTEXT_TAG ct1 = (CONTEXT_TAG)(cm.getByte() >> 4); return(Decode(cm, ct1)); } default: break; } return(this); }
public PDU Decode(BACPacket cm) { pduType = (BACnetPDU)(cm.getByte() >> 4); switch (pduType) { case BACnetPDU.PDU_CONFIRMED_REQUEST: pduType = BACnetPDU.PDU_CONFIRMED_REQUEST; cm.SetAction(BACPacket.Action_Type.REQUEST); return(new PDUConfirmedService().Decode(cm)); case BACnetPDU.PDU_UNCONFIRMED_SERVICE_REQUEST: pduType = BACnetPDU.PDU_UNCONFIRMED_SERVICE_REQUEST; cm.SetAction(BACPacket.Action_Type.REQUEST); return(new PDUUnConfirmedService().Decode(cm)); case BACnetPDU.PDU_SIMPLEACK: pduType = BACnetPDU.PDU_SEGMENTACK; cm.SetAction(BACPacket.Action_Type.RESPONSE); return(new PDUSimpleAck().Decode(cm)); case BACnetPDU.PDU_COMPLEXACK: pduType = BACnetPDU.PDU_COMPLEXACK; cm.SetAction(BACPacket.Action_Type.RESPONSE); return(new PDUComplexAck().Decode(cm)); case BACnetPDU.PDU_SEGMENTACK: case BACnetPDU.PDU_ERROR: pduType = BACnetPDU.PDU_ERROR; cm.SetAction(BACPacket.Action_Type.RESPONSE); return(new PDUError().Decode(cm)); case BACnetPDU.PDU_REJECT: pduType = BACnetPDU.PDU_REJECT; cm.SetAction(BACPacket.Action_Type.RESPONSE); return(new PDUReject().Decode(cm)); case BACnetPDU.PDU_ABORT: return(this); } return(this); }
new public PDU Decode(BACPacket cm) { System.Console.Write("Decoding PDUComplexAck"); byte a = cm.getNextByte(); segMessage = DecodeSegMessage(a); moreFollows = DecodeMoreFollows(a); segResponseAccp = DecodeSegResponse(a); if (segResponseAccp == true) { maxSegmentsAccepted = (MAX_SEGMENTS_ACCEPTED)cm.getByte(); } maxAPDUlengthAccepted = DecodeMaxAPDUlengthAccp(cm.getNextByte()); invokeID = cm.getNextByte(); // If the optional parameter are present if (segMessage) { sequenceNumber = cm.getNextByte(); proposedWindowSize = cm.getNextByte(); } serviceChoice = (ConfirmedServiceChoice)cm.getNextByte(); switch (serviceChoice) { case ConfirmedServiceChoice.READPROPERTY: apduService = new APDUReadProperty(); apduService.Decode(cm); break; } return(this); }
new public PDU Decode(BACPacket cm) { cm.getNextByte(); return(this); }
void TestThrBasics() { cm1 = new BACPacket(s5); cm2 = new BACPacket(s6); }
public override BACVnetVar Decode(BACPacket cm) { booleanValue = (cm.getNextByte() & 0x01) == 0x01? true : false; return(this); }
public virtual NSDU Decode(BACPacket cm) { nlm = (Network_Layer_Message)cm.getByte(); switch (nlm) { case Network_Layer_Message.WHO_IS_ROUTER_TO_NETWORK: return(new NSDU_Who_Is_Router_To_Network().Decode(cm)); case Network_Layer_Message.I_AM_ROUTER_TO_NETWORK: return(new NSDU_I_Am_Router_To_Network().Decode(cm)); case Network_Layer_Message.I_COULD_BE_ROUTER_TO_NETWORK: return(new NSDU_I_Could_be_Router_To_Network().Decode(cm)); case Network_Layer_Message.REJECT_MESSAGE_TO_NETWORK: return(new NSDU_Reject_Message_To_Network().Decode(cm)); case Network_Layer_Message.ROUTER_BUSY_TO_NETWORK: return(new NSDU_Router_Busy_To_Network().Decode(cm)); case Network_Layer_Message.INITIALIZE_ROUTING_TABLE: return(new NSDU_Initialize_Routing_Table().Decode(cm)); case Network_Layer_Message.INITIALIZE_ROUTING_TABLE_ACK: return(new NSDU_Initialize_Routing_Table_Ack().Decode(cm)); case Network_Layer_Message.ESTABLISH_CONNECTION_TO_NETWORK: break; case Network_Layer_Message.DISCONNECT_CONNECTION_TO_NETWORK: break; case Network_Layer_Message.CHALLENGE_REQUEST: break; case Network_Layer_Message.SECURITY_PAYLOAD: break; case Network_Layer_Message.SECURITY_RESPONSE: break; case Network_Layer_Message.REQUEST_KEY_UPDATE: break; case Network_Layer_Message.UPDATE_KEY_SET: break; case Network_Layer_Message.UPDATE_DISTRIBUTION_KEY: break; case Network_Layer_Message.REQUEST_MASTER_KEY: break; case Network_Layer_Message.SET_MASTER_KEY: break; case Network_Layer_Message.WHAT_IS_NETWORK_NUMBER: break; case Network_Layer_Message.NETWORK_NUMBER_IS: break; } return(this); }
{ // public BACVnetVar Decode(BACPacket cm, int length) { return(this); }
public virtual APDUService Decode(BACPacket cm) { return(this); }