package com;

import Net.PC15.Command.CommandDetial;
import Net.PC15.Command.CommandParameter;
import Net.PC15.Command.INCommand;
import Net.PC15.Command.INCommandResult;
import Net.PC15.Connector.ConnectorAllocator;
import Net.PC15.Connector.ConnectorDetial;
import Net.PC15.Connector.E_ControllerType;
import Net.PC15.Connector.INConnectorEvent;
import Net.PC15.Connector.TCPClient.TCPClientDetial;
import Net.PC15.Data.INData;
import Net.PC15.FC8800.Command.Data.DoorPortDetail;
import Net.PC15.FC8800.Command.Door.CloseDoor;
import Net.PC15.FC8800.Command.Door.OpenDoor;
import Net.PC15.FC8800.Command.Door.Parameter.OpenDoor_Parameter;
import Net.PC15.FC8800.Command.Door.Parameter.RemoteDoor_Parameter;
import Net.PC15.FC8800.Command.FC8800Command;
import Net.PC15.FC8800.FC8800Identity;

public class TestDoor {

    public static void main(String args[]) throws InterruptedException {
        open();


        //System.out.println(connector.AddCommand(closeDoor));
    }

    public static void  open(){
        ConnectorAllocator connector = ConnectorAllocator.GetAllocator();
        //connector.AddListener(new TestConnect());
        TCPClientDetial c = new TCPClientDetial("192.168.1.150", 8000);
        connector.GetCommandCount(c);
        //connector.CloseForciblyConnect(new TCPClientDetial("192.168.1.150", 8000));
        connector.OpenForciblyConnect(c);
        CommandDetial detial = new CommandDetial();
        detial.Connector = c;
        detial.Identity = new FC8800Identity("MC-5824T28085603", "FFFFFFFF", E_ControllerType.FC8900);



        OpenDoor_Parameter openDoor_parameter = new OpenDoor_Parameter(detial);
        openDoor_parameter.Door.SetDoor(1,1);
        OpenDoor openDoor = new OpenDoor(openDoor_parameter);
        openDoor.getIsTimeout();
        //openDoor.Release();
    }

    static class TestConnect implements INConnectorEvent {

        @Override
        public void CommandCompleteEvent(INCommand inCommand, INCommandResult inCommandResult) {
            System.out.println("CommandCompleteEvent");

        }

        @Override
        public void CommandProcessEvent(INCommand inCommand) {
            System.out.println("CommandProcessEvent");
        }

        @Override
        public void ConnectorErrorEvent(INCommand inCommand, boolean b) {
            System.out.println("ConnectorErrorEvent");
        }

        @Override
        public void ConnectorErrorEvent(ConnectorDetial connectorDetial) {
            System.out.println("ConnectorErrorEvent");
        }

        @Override
        public void CommandTimeout(INCommand inCommand) {
            System.out.println("CommandTimeout");
        }

        @Override
        public void PasswordErrorEvent(INCommand inCommand) {
            System.out.println("PasswordErrorEvent");
        }

        @Override
        public void ChecksumErrorEvent(INCommand inCommand) {
            System.out.println("ChecksumErrorEvent");
        }

        @Override
        public void WatchEvent(ConnectorDetial connectorDetial, INData inData) {
            System.out.println("WatchEvent");
        }
    }

}
