Пример #1
0
 public Int32 OnAnyPipe(Object sender, Nordicsemi.PipeDataEventArgs arguments)
 {
     if (arguments.PipeNumber == pipeSetup.WctrlPipe)
         OnDataReceived_Wctrl(sender, arguments);
     if (arguments.PipeNumber == pipeSetup.RctrlPipe)
         OnDataReceived_Rctrl(sender, arguments);
     return (42);
 }
Пример #2
0
        //(sender, e)
        public virtual void data_received_handler(Object sender, Nordicsemi.PipeDataEventArgs e)
        {
            //""" Callback for the DLL if any data is recieved from peer device. """
            System.Text.StringBuilder stringBuffer = new System.Text.StringBuilder();
            foreach (Byte element in e.PipeData)
            {
                stringBuffer.AppendFormat(" 0x{0:X2}", element);
            }
            //if (DebugMessagesEnabled)
            //{
            //    AddToLog(String.Format("Data received on pipe number {0}:{1}", arguments.PipeNumber, stringBuffer.ToString()));
            //}

            int pipe_number = e.PipeNumber;

            //data = "".join("%02x" % byte for byte in e.PipeData);
            logger.log(String.Format("Received unhandled data on pipe {0} ({1})!", pipe_number, stringBuffer));//data));
        }
Пример #3
0
 void OnDataReceived_Rctrl(Object sender, Nordicsemi.PipeDataEventArgs arguments)
 {
     if (arguments.PipeNumber == pipeSetup.RctrlPipe)
         On_Rctrl(arguments.PipeData, arguments.PipeData.Length);
 }
Пример #4
0
 //PPP , PipeSetup pipe)
 public void CtrlEngine_Setup(Nordicsemi.MasterEmulator master)
 {
     masterEmulator = master;
     //PPP pipeSetup = pipe;
     pipeSetup = new PipeSetup_Ctrl(master);
 }
Пример #5
0
 void OnDataReceived_Up(Object sender, Nordicsemi.PipeDataEventArgs arguments)
 {
     if (arguments.PipeNumber == pipeSetup.UcmdPipe)
         On_Ucmd(arguments.PipeData, arguments.PipeData.Length);
     if (arguments.PipeNumber == pipeSetup.UdatPipe)
         On_Udat(arguments.PipeData, arguments.PipeData.Length);
 }
Пример #6
0
 void OnDataReceived_Dn(Object sender, Nordicsemi.PipeDataEventArgs arguments)
 {
     On_Dcfm(arguments.PipeData, arguments.PipeData.Length);
 }
Пример #7
0
        public Int32 OnAnyPipe(Object sender, Nordicsemi.PipeDataEventArgs arguments)
        {
            //===== udEngine =====
            if (arguments.PipeNumber == pipeSetup.DcfmPipe)
                OnDataReceived_Dn(sender, arguments);

            if (arguments.PipeNumber == pipeSetup.UcmdPipe)
                OnDataReceived_Up(sender, arguments);
            if (arguments.PipeNumber == pipeSetup.UdatPipe)
                OnDataReceived_Up(sender, arguments);
            return (42);
        }
Пример #8
0
        /// <summary>
        /// This event handler is called when data has been received on any of our pipes.
        /// </summary>
        void meEv_OnDataReceived(Object sender, Nordicsemi.PipeDataEventArgs arguments)
        {
            System.Text.StringBuilder stringBuffer = new System.Text.StringBuilder();
            foreach (Byte element in arguments.PipeData)
            {
                stringBuffer.AppendFormat(" 0x{0:X2}", element);
            }
            if (DebugMessagesEnabled)
            {
                AddToLog(String.Format("Data received on pipe number {0}:{1}", arguments.PipeNumber, stringBuffer.ToString()));
            }

            udEngine.OnAnyPipe(sender, arguments);
            ctrlEngine.OnAnyPipe(sender, arguments);

            //REF if (arguments.PipeNumber == pipeSetup.UartTxPipe)
            //REF     OnDataReceived_Uart( sender, arguments);
            /*
            //===== udEngine =====
            if (arguments.PipeNumber == pipeSetup.DcfmPipe)
                udEngine.OnAnyPipe(sender, arguments); // OnDataReceived_Dn( sender, arguments);

            if( arguments.PipeNumber == pipeSetup.UcmdPipe )
                udEngine.OnAnyPipe(sender, arguments); // OnDataReceived_Up( sender, arguments);
            if( arguments.PipeNumber == pipeSetup.UdatPipe )
                udEngine.OnAnyPipe(sender, arguments); // OnDataReceived_Up( sender, arguments);

            //===== ctrlEngine =====
            if (arguments.PipeNumber == pipeSetup.WctrlPipe)
                ctrlEngine.OnAnyPipe(sender, arguments); // OnDataReceived_Wctrl(sender, arguments);
            if (arguments.PipeNumber == pipeSetup.RctrlPipe)
                ctrlEngine.OnAnyPipe(sender, arguments); // OnDataReceived_Rctrl(sender, arguments);
            */
        }
Пример #9
0
 void OnProgressUpdated(object sender, Nordicsemi.ValueEventArgs<int> e)
 {
     int progress = e.Value;
     if (0 <= progress && progress <= 100)
     {
         SetProgressBarValue(progress);
     }
 }
Пример #10
0
 public void UpDnEngine_Setup(Nordicsemi.MasterEmulator master)//PPP , PipeSetup pipe)
 {
     masterEmulator = master;
     pipeSetup = new PipeSetup_UpDn(master);
 }