Compare commits
5 Commits
f9f6e07696
...
df8e665e15
| Author | SHA1 | Date | |
|---|---|---|---|
| df8e665e15 | |||
| cf2950907a | |||
| 8399f70285 | |||
| 63307e2deb | |||
| d0bfbd3f5c |
@@ -9,6 +9,8 @@ import java.net.Socket;
|
|||||||
public class AASMini {
|
public class AASMini {
|
||||||
private final String targetIP;
|
private final String targetIP;
|
||||||
private final int targetPort;
|
private final int targetPort;
|
||||||
|
private final int msgId = 15;
|
||||||
|
private final String zones = "Zone_1,Zone_2,Zone_3,Zone_4";
|
||||||
private Socket socket;
|
private Socket socket;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -19,8 +21,10 @@ public class AASMini {
|
|||||||
public AASMini(String ip , int port){
|
public AASMini(String ip , int port){
|
||||||
this.targetIP = ip;
|
this.targetIP = ip;
|
||||||
this.targetPort = port;
|
this.targetPort = port;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the AAS Mini is connected
|
* Check if the AAS Mini is connected
|
||||||
* @return true if connected, false otherwise
|
* @return true if connected, false otherwise
|
||||||
@@ -67,6 +71,22 @@ public class AASMini {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//TODO protocol untuk kirim data ke AAS Mini
|
//TODO protocol untuk kirim data ke AAS Mini
|
||||||
|
private void SendPlatNoToAAS(String platNo){
|
||||||
|
|
||||||
|
String protocol = "BROADCAST;"+msgId+";IND;$PLATNOMOR$="+platNo+";"+zones;
|
||||||
|
byte[] data = protocol.getBytes();
|
||||||
|
byte[] rplyData = SendAndReceive(data);
|
||||||
|
String rplyInStr = rplyData.toString();
|
||||||
|
String[] rply = rplyInStr.split(";");
|
||||||
|
if (rply.length ==2){
|
||||||
|
if (rply[0].equals("BROADCAST")){
|
||||||
|
if (rply[1].equals("OK")){
|
||||||
|
System.out.println("Success sending data to AAS!");
|
||||||
|
}else System.out.println("Failed sending data to AAS!");
|
||||||
|
}else System.out.println("Wrong format answer!");
|
||||||
|
}else System.out.println("Wrong size answer");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send data to AAS Mini and receive response
|
* Send data to AAS Mini and receive response
|
||||||
|
|||||||
@@ -1,23 +1,4 @@
|
|||||||
package ProtegeGX;
|
package ProtegeGX;
|
||||||
|
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
public class ProtegeGX {
|
public class ProtegeGX {
|
||||||
@Setter private Consumer<ProtegeData> onCardRead;
|
|
||||||
|
|
||||||
private void updateCardRead(ProtegeData data){
|
|
||||||
if (onCardRead!=null) onCardRead.accept(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ProtegeGX(){
|
|
||||||
System.out.println("ProtegeGX Constructor");
|
|
||||||
//TODO belum ada codingan, tunggu apache cxf jar nya
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Disconnect(){
|
|
||||||
//TODO belum ada codingan, tunggu apache cxf jar nya
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user