Ejemplo n.º 1
0
 private void Button2_Tapped_1(object sender, TappedRoutedEventArgs e)
 {
     if (InterfaceCommand != null)
     {
         InterfaceCommand.Execute(null);
     }
 }
Ejemplo n.º 2
0
 public CommandHandler(
     BillToBillDevice device, InterfaceCommand interfaceCommand,
     byte[] commandData) : base(device)
 {
     m_CommandData      = commandData;
     m_InterfaceCommand = interfaceCommand;
 }
    static void Main(string[] args)
    {
        Response response = new Response();

        response.ResponseStatus = "ok";
        //ConcreteCommand command = new ConcreteCommand();    //switch with line below to test inteface
        InterfaceCommand command = new InterfaceCommand();

        command.Execute();
        response.Results = command.Results;
        List <Type> knownTypes = new List <Type>
        {
            typeof(MyObject),
            typeof(Result <MyObject>)                     //switch with line below to test inteface
            //typeof(Result<IMyObject>)
        };
        DataContractJsonSerializer serializer = new DataContractJsonSerializer(response.GetType(), knownTypes, int.MaxValue, false, null, true);
        Stream stream = new MemoryStream();

        serializer.WriteObject(stream, response);
        stream.Position = 0;
        StreamReader reader = new StreamReader(stream);
        string       output = reader.ReadToEnd();

        Console.WriteLine(output);
    }
Ejemplo n.º 4
0
 public MessageCmd(InterfaceAddress interfaceAddr,
                   InterfaceCommand interfaceCommand, byte[] data)
     : base(interfaceAddr)
 {
     m_InterfaceCmd = interfaceCommand;
     m_Data         = data;
 }
Ejemplo n.º 5
0
        void SendCmdMessage(
            InterfaceCommand interfaceCommand, byte[] data)
        {
            var cmdMessage = new MessageCmd(
                m_InterfaceAddress, interfaceCommand, data);

            //get message data bytes
            var sendData = cmdMessage.GetSendingData();

            //send data bytes at port
            SendMessageLow(sendData);
        }
Ejemplo n.º 6
0
            bool HandleCommandWithRetData(
                InterfaceCommand command, byte[] commandData,
                out byte[] responseData)
            {
                bool commandHandledSuccessfully = false;

                //send command at device
                m_Device.SendCmdMessage(command, commandData);
                //wait timeout response filled
                Thread.Sleep(B2B_RETURN_ACK_TIMEOUT_MSEC);
                if (Helper.GetDeviceCmdResponse(
                        m_Device.m_CommunicationPort, out responseData) &&
                    Response.CheckDataPacket(responseData) &&
                    NakResponse.CheckData(responseData) == false)
                {
                    commandHandledSuccessfully = true;
                }
                return(commandHandledSuccessfully);
            }
Ejemplo n.º 7
0
        bool HandleCommandWithNoRetData(
            InterfaceCommand command, byte[] commandData)
        {
            bool commandHandledSuccessfully = false;

            lock (m_PortLocker)
            {
                byte[] responseData;
                SendCmdMessage(command, commandData);
                Thread.Sleep(B2B_RETURN_ACK_TIMEOUT_MSEC);
                if (Helper.GetDeviceCmdResponse(m_CommunicationPort, out responseData) &&
                    Response.CheckDataPacket(responseData) &&
                    AckResponse.CheckData(responseData)
                    )
                {
                    //SendAckMessage();
                    //GetAckMessage();
                    commandHandledSuccessfully = true;
                }
            }
            return(commandHandledSuccessfully);
        }
Ejemplo n.º 8
0
 public CmdHandlerWithoutRetData(BillToBillDevice device,
                                 InterfaceCommand interfaceCommand)
     : base(device)
 {
     m_InterfaceCommand = interfaceCommand;
 }
Ejemplo n.º 9
0
 public PollCmdHandler(BillToBillDevice device,
                       InterfaceCommand command, byte[] commandData) : base(
         device, command, commandData)
 {
 }
Ejemplo n.º 10
0
 public void Execute(T0 p0, T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6, T7 p7, T8 p8, T9 p9)
 {
     SetValues(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9);
     InterfaceCommand.Execute();
 }