91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 337KB
    文件類型: .7z
    金幣: 1
    下載: 1 次
    發布日期: 2021-11-20
  • 語言: Java
  • 標簽: plc??s7??

資源簡介

用于連接s7plc設備,從谷歌下載,包含所需jar包,為完整項目

資源截圖

代碼片段和文件信息

/*
?Part?of?Libnodave?a?free?communication?libray?for?Siemens?S7?300/400?via
?the?MPI?adapter?6ES7?972-0CA22-0XAC
?or??MPI?adapter?6ES7?972-0CA33-0XAC
?or??MPI?adapter?6ES7?972-0CA11-0XAC.
?
?(C)?Thomas?Hergenhahn?(thomas.hergenhahn@web.de)?2002..2005

?Libnodave?is?free?software;?you?can?redistribute?it?and/or?modify
?it?under?the?terms?of?the?GNU?Library?General?Public?License?as?published?by
?the?Free?Software?Foundation;?either?version?2?or?(at?your?option)
?any?later?version.

?Libnodave?is?distributed?in?the?hope?that?it?will?be?useful
?but?WITHOUT?ANY?WARRANTY;?without?even?the?implied?warranty?of
?MERCHANTABILITY?or?FITNESS?FOR?A?PARTICULAR?PURPOSE.??See?the
?GNU?Library?General?Public?License?for?more?details.

?You?should?have?received?a?copy?of?the?GNU?Library?General?Public?License
?along?with?this;?see?the?file?COPYING.??If?not?write?to
?the?Free?Software?Foundation?675?Mass?Ave?Cambridge?MA?02139?USA.??
*/
package?org.libnodave;

public?class?IBH_MPIConnection?extends?S7Connection?{
byte?MPI;

public?IBH_MPIConnection(PLCinterface?ifa?int?mpi)?{
super(ifa);
this.MPI?=?(byte)?mpi;
PDUstartIn?=?8?+?7;
PDUstartOut?=?8?+?7;
}

private?int?readPacket()?{
int?res?=?iface.read(msgIn?0?4);
if?(res?==?4)?{
int?len?=?0x100?*?msgIn[2]?+?msgIn[3];
res?+=?iface.read(msgIn?4?len);
}
return?res;
}

int?writeIBH(byte[]?buffer?int?len)?{
iface.write(buffer?0?len);
if?((Nodave.Debug?&?Nodave.DEBUG_IFACE)?!=?0)?{
Nodave.dump(“writeIBH?“?buffer?0?len);
}
return?0;
}

int?readIBHPacket()?{
// System.out.println(“readIBHPacket“);
int?i?res?=?0;
res?=?iface.read(msgIn?0?3);
// System.out.println(“readIBHPacket??res:“?+?res);
if?(res?==?3)?{
int?len?=?Nodave.USByte(msgIn?2)?+?5;
res?+=?iface.read(msgIn?3?len);
}?else?{
if?((Nodave.Debug?&?Nodave.DEBUG_IFACE)?!=?0)?{
System.out.println(“res?“?+?res);
Nodave.dump(“readIBHpacket:?short?packet“?msgIn?0?res);
}
return?(0);?//?short?packet
}
if?((Nodave.Debug?&?Nodave.DEBUG_IFACE)?!=?0)?{

System.out.println(
“readIBHpacket:?“
+?res
+?“?bytes?read?“
+?(msgIn[2]?+?8)
+?“?needed“);
Nodave.dump(“readIBHpacket:?“?msgIn?0?res);
}
return?(res);
};

/*
This?performs?initialization?steps?with?sampled?byte?sequences.?If?chal?is?<>NULL
it?will?send?this?byte?sequence.
It?will?then?wait?for?a?packet?and?compare?it?to?the?sample.
*/
int?initStepIBH(byte[]?chal?int[]?resp?int?rl)?{
int?res?=?0?a?=?0;
int?res2;
if?((Nodave.Debug?&?Nodave.DEBUG_CONNECT)?!=?0)
System.out.println(“_daveInitStepIBH?before?write.\n“);
res?=?writeIBH(chal?chal.length);
if?((Nodave.Debug?&?Nodave.DEBUG_CONNECT)?!=?0)
System.out.println(“_daveInitStepIBH?write?returned?“?+?res);
//if?(res? // return?100;
res?=?readIBHPacket();
/*
We?may?get?a?network?layer?ackknowledge?and?an?MPI?layer?ackknowledge?which?we?discard.
So?normally?at?least?the?3rd?packet?should?h

評論

共有 條評論