客户端开门开发
This commit is contained in:
@@ -16,6 +16,11 @@
|
||||
<groupId>smartvenue</groupId>
|
||||
<artifactId>netty-model</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.pc15</groupId>
|
||||
<artifactId>fc-card</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -1,8 +1,17 @@
|
||||
package com.sv.intergration;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* 对接场馆门禁
|
||||
*/
|
||||
public interface DoorService {
|
||||
|
||||
Logger logger = LoggerFactory.getLogger(DoorService.class);
|
||||
|
||||
void enterOpenDoor();
|
||||
|
||||
void outOpenDoor();
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.sv.intergration.impl;
|
||||
|
||||
import Net.PC15.Command.CommandDetial;
|
||||
import Net.PC15.Connector.ConnectorAllocator;
|
||||
import Net.PC15.Connector.E_ControllerType;
|
||||
import Net.PC15.Connector.TCPClient.TCPClientDetial;
|
||||
import Net.PC15.FC8800.Command.Door.OpenDoor;
|
||||
import Net.PC15.FC8800.Command.Door.Parameter.OpenDoor_Parameter;
|
||||
import Net.PC15.FC8800.FC8800Identity;
|
||||
import com.sv.intergration.DoorService;
|
||||
|
||||
public class OldDoorService implements DoorService {
|
||||
|
||||
@Override
|
||||
public void enterOpenDoor() {
|
||||
try {
|
||||
logger.info("----init open door tcp ----");
|
||||
ConnectorAllocator connector = ConnectorAllocator.GetAllocator();
|
||||
TCPClientDetial tcpClientDetial = new TCPClientDetial("192.168.1.150", Integer.valueOf("8000"));
|
||||
connector.GetCommandCount(tcpClientDetial);
|
||||
connector.OpenForciblyConnect(tcpClientDetial);
|
||||
CommandDetial detial = new CommandDetial();
|
||||
detial.Connector = tcpClientDetial;
|
||||
detial.Identity = new FC8800Identity("MC-5824T28085603", "FFFFFFFF", E_ControllerType.FC8900);
|
||||
OpenDoor_Parameter openDoorParameter = new OpenDoor_Parameter(detial);
|
||||
|
||||
openDoorParameter.Door.SetDoor(1, 1);
|
||||
OpenDoor openDoor = new OpenDoor(openDoorParameter);
|
||||
boolean command = connector.AddCommand(openDoor);
|
||||
if (openDoor.getIsTimeout()) {
|
||||
logger.info("----open door timeout ----");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("----open door error ----", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void outOpenDoor() {
|
||||
try {
|
||||
logger.info("----init open door tcp ----");
|
||||
ConnectorAllocator connector = ConnectorAllocator.GetAllocator();
|
||||
TCPClientDetial tcpClientDetial = new TCPClientDetial("192.168.1.150", Integer.valueOf("8000"));
|
||||
connector.GetCommandCount(tcpClientDetial);
|
||||
connector.OpenForciblyConnect(tcpClientDetial);
|
||||
CommandDetial detial = new CommandDetial();
|
||||
detial.Connector = tcpClientDetial;
|
||||
detial.Identity = new FC8800Identity("MC-5824T28085603", "FFFFFFFF", E_ControllerType.FC8900);
|
||||
OpenDoor_Parameter openDoorParameter = new OpenDoor_Parameter(detial);
|
||||
|
||||
openDoorParameter.Door.SetDoor(2, 1);
|
||||
OpenDoor openDoor = new OpenDoor(openDoorParameter);
|
||||
boolean command = connector.AddCommand(openDoor);
|
||||
if (openDoor.getIsTimeout()) {
|
||||
logger.info("----open door timeout ----");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("----open door error ----", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user