Esempio n. 1
0
        // private  string msg = "hold";  //默认发送数据
        //发送数据
        private void sendMsg()
        {
            String targetIP = Utils.getConfig("targetIP");

            if (targetIP != null && !"".Equals(targetIP))
            {
                try
                {
                    EndPoint       point = new IPEndPoint(IPAddress.Parse(targetIP), 6000);
                    Rehabilitation rhb   = Rehabilitation.GetSingleton();
                    int            now   = 0;
                    while (isServe)
                    {
                        if (server != null && (now = rhb.GetScore()) != -1)
                        {
                            server.SendTo(Encoding.UTF8.GetBytes(now.ToString()), point);
                        }
                    }
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.ToString(), "出错了");
                    isServe = false;
                }
            }
            else
            {
                MessageBox.Show("目标IP地址不能为空", "出错了");
            }
        }
Esempio n. 2
0
        public GloveModel()
        {
            gc = GloveController.GetSingleton(ModelType.HandOnly);
            //            var mLogger = Logger.GetInstance(mw.txt_log);
            //            gc.RegisterLogger(mLogger);

            //if (!gc.IsConnected((int)handType)) //接入手套
            //{
            //    gc.Connect(chuankou, 0);       //连接手套和串口
            //}
            rhb             = Rehabilitation.GetSingleton();
            dh              = DataWarehouse.GetSingleton();
            sc              = SkeletonCalculator.GetSingleton("");
            handinformation = HandInf.GetSingleton();

            OptimizedData = HandInf.GetSingleton();

            fram       = new SkeletonJson();
            Mychuankou = "COM3";


            //pullDataTimer = new Timer(500);
            //pullDataTimer.Elapsed += pullDataTimer_Tick;
            //pullDataTimer.Start();
        }
Esempio n. 3
0
 public GloveConfigView()
 {
     InitializeComponent();
     sc  = SensorCalibrator.GetSingleton();
     rhb = Rehabilitation.GetSingleton();
     skc = SkeletonCalculator.GetSingleton("");
     dh  = DataWarehouse.GetSingleton();
 }
Esempio n. 4
0
        private GloveModule(MainWindow mw)
        {
            this.mw = mw;
            gc      = GloveController.GetSingleton(ModelType.HandOnly);
            var mLogger = Logger.GetInstance(mw.txt_log);

            gc.RegisterLogger(mLogger);
            rhb = Rehabilitation.GetSingleton();
            dh  = DataWarehouse.GetSingleton();
            string[] ports = gc.GetPorts();
            if (ports.Length > 0)
            {
                ports.ToList().ForEach(n => mw.cbb_port.Items.Add(n));
                mw.cbb_port.SelectedItem = mw.cbb_port.Items[mw.cbb_port.Items.Count - 1];
            }
            // socket module
            sm = SocketManager.GetInstance();
            sm.Start(10200);
            sc                     = SkeletonCalculator.GetSingleton("");
            pullDataTimer          = new Timer(10);
            pullDataTimer.Elapsed += pullDataTimer_Tick;
            pullDataTimer.Start();
        }