Beispiel #1
0
        //Get the calibration structure from the master unit
        public SlaveConfig getCalibration(UInt32 CanID)
        {
            SlaveConfig sc = new SlaveConfig();
            UInt32      retval;

            CAN.VCI_CAN_OBJ[] send = new CAN.VCI_CAN_OBJ[1];
            CAN.VCI_CAN_OBJ[] receive;

            send[0].ID         = CanID;
            send[0].TimeFlag   = 0;
            send[0].SendType   = 0;
            send[0].RemoteFlag = 0;
            send[0].ExternFlag = 1;
            send[0].DataLen    = 1;
            send[0].Data       = new byte[8];

            send[0].Data[0] = (byte)CANCMD.CAN_CMD_READ_CAL;

            retval = CAN.VCI_Transmit(CAN.DEV_USBCAN2, 0, 0, send, 1);
            if (retval != CAN.STATUS_OK)
            {
                return(sc);
            }

            ctl.getCanFrames(out receive, 3);

            byte[] buffer = new byte[Marshal.SizeOf(typeof(SlaveConfig))];

            for (int i = 0; i < buffer.Length; i++)
            {
                buffer[i] = receive[i / 8].Data[i % 8];
            }
            return(StructTools.byteArray2Struct <SlaveConfig>(buffer));
        }
Beispiel #2
0
        //Get the calibration structure from the master unit
        public bool setCalibration(UInt32 CanID, SlaveConfig sc)
        {
            UInt32 retval;

            CAN.VCI_CAN_OBJ[] send = ctl.allocateCanFrameBuffer(1 + Marshal.SizeOf(typeof(SlaveConfig)) / 8);
            CAN.VCI_CAN_OBJ[] receive;

            send[0].ID         = CanID;
            send[0].TimeFlag   = 0;
            send[0].SendType   = 0;
            send[0].RemoteFlag = 0;
            send[0].ExternFlag = 1;
            send[0].DataLen    = 1;

            send[0].Data[0] = (byte)CANCMD.CAN_CMD_WRITE_CAL;

            retval = CAN.VCI_Transmit(CAN.DEV_USBCAN2, 0, 0, send, 1);
            if (retval != CAN.STATUS_OK)
            {
                return(false);
            }

            ctl.sendData(StructTools.struct2byteArray <SlaveConfig>(sc), CanID, false, true);

            ctl.getCanFrames(out receive, 1);

            if (receive[0].Data[0] == (byte)CANCMD.CAN_CMD_WRITE_CAL)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            EndpointAddress endpoint = new EndpointAddress("http://localhost:8000/RoutingAi/Slave");

            IRoutingAiSlaveService proxy = ChannelFactory <IRoutingAiSlaveService> .CreateChannel(new BasicHttpBinding(), endpoint);

            String message = proxy.Ping();

            Console.WriteLine(message);

            OptimizationRequest req = new OptimizationRequest()
            {
                Id       = Guid.NewGuid(),
                ClientId = Guid.NewGuid(),
                Tasks    = new RoutingAI.DataContracts.Task[] { },
                Workers  = new Resource[] { }
            };
            SlaveConfig config = new SlaveConfig()
            {
                OptimizationRequest = req,
                OSRMServers         = new IPEndPoint[] { new IPEndPoint(IPAddress.Parse("192.168.2.31"), 5000) },
                RandomSeed          = 11235813,
                RedisServers        = new IPEndPoint[] { new IPEndPoint(IPAddress.Parse("192.168.2.13"), 6379) }
            };
            Guid id = proxy.ConfigureComputationThread(config);

            Console.WriteLine(id);

            Console.WriteLine("Press <ENTER> to terminate...");
            Console.ReadLine();
        }
Beispiel #4
0
 public PlanetColonizerRoutingAlgorithm(SlaveConfig config, ICostFunction costfunc)
 {
     this.configuration = config;
     this.CostFunction  = costfunc;
 }
Beispiel #5
0
 public TCPPortService(Modbussetting modbus, SlaveConfig slaveConfig, bool isMaster)
 {
     this.modbus      = modbus;
     this.slaveConfig = slaveConfig;
     this.isMaster    = isMaster;
 }