Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            //string meterId="39615123355104";

            //string meterType="SerialPort";

            //Channel.IDataChannel  channel= Channel.DataChannelFactoryService.getInstance().getDataChannel(meterId,meterType);

            //TestMeter meter = new TestMeter(meterId, channel);



            ////读操作
            //DataItem item=new DataItem_8103();
            //TaskArge data = new TaskArge(meterId, item,ControlCode.ReadData);
            //meter.SendData(data);


            ////写操作
            //CT ct = new CT(MeterType.气量表, true, JieSuanType.全年度, 5);
            //DataItem item_A010 = new DataItem_A010(ct,2.3m,100,3.1m,200,4.7m,300,5.3m,400,6.8m,21);

            //TaskArge data_A010 = new TaskArge(meterId, item_A010, ControlCode.WriteData);

            //meter.SendData(data_A010);



            RegisterWCFService wcf = new RegisterWCFService("localhost", 9000);

            wcf.RunWCFService();


            System.Console.Read();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                ServiceBase[] ServicesToRun;
                ServicesToRun = new ServiceBase[]
                {
                    new IoTMBCService()
                };
                ServiceBase.Run(ServicesToRun);
            }
            else
            {
                int port = 9000;
                port = Convert.ToInt32(System.Configuration.ConfigurationSettings.AppSettings["WCFServicePort"]);

                RegisterWCFService wcf = new RegisterWCFService("localhost", 9000);
                wcf.RunWCFService();
                DataRecordQueueFactory.getInstance().StartService();
                while (true)
                {
                    System.Console.Read();
                }
            }
        }
Ejemplo n.º 3
0
        protected override void OnStart(string[] args)
        {
            int port = 9000;

            port = Convert.ToInt32(System.Configuration.ConfigurationSettings.AppSettings["WCFServicePort"]);
            wcf  = new RegisterWCFService("localhost", port);
            wcf.RunWCFService();
            DataRecordQueueFactory.getInstance().StartService();
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            RegisterWCFService wcf = new RegisterWCFService("localhost", 9000);

            wcf.RunWCFService();
            DataRecordQueueFactory.getInstance().StartService();
            while (true)
            {
                System.Console.Read();
            }
        }
        static void Main(string[] args)
        {
            string server = System.Configuration.ConfigurationSettings.AppSettings["Server"];
            int    port   = Convert.ToInt32(System.Configuration.ConfigurationSettings.AppSettings["port"]);

            RegisterWCFService _rWcf = new RegisterWCFService(server, port);

            _rWcf.RunWCFService();

            Console.WriteLine("服务器已启动.");
            Console.ReadLine();
        }
Ejemplo n.º 6
0
        static void Main(string[] args)
        {
            //string hexstr = "43 8C E8 F5";
            string hexstr = "01 03 04 42 40 66 66 44 15";

            /*01 03 1E
             * 3 00 02
             * 5 43 8F A8 F5
             * 9 00 00
             * 11 02 9A 45 D0
             *
             * 15 55 48 43 3A
             * 19 80 00 44 D0
             * 23 50 00 41 D9
             *
             * 99 9A 00 03 00 20 71 89
             **/

            byte[] data   = strToToHexByte(hexstr);
            int    iIndex = 0;
            //float WenDu = BitConverter.ToSingle(getIEEE(data, iIndex + 3 + 2 + 4 + 6 + 4 + 4), 0);

            //float v = BitConverter.ToSingle(data, 0);
            //System.Console.WriteLine("{0}", WenDu);

            float ZongYongLiang = BytesTouInt16(data, iIndex + 3) * 10000;

            System.Console.WriteLine("{0}", ZongYongLiang);
            ZongYongLiang = BitConverter.ToSingle(getIEEE(data, iIndex + 3), 0);
            System.Console.WriteLine("{0}", ZongYongLiang);

            //int i = 0;
            //while (true)
            //{
            //    System.Console.WriteLine("{0}", Convert.ToByte(new Random().Next(0, 255)));

            //    System.Threading.Thread.Sleep(1000 * 3);
            //    i++;
            //    if (i > 10)
            //        break;
            //}

            int port = 9000;

            port = Convert.ToInt32(System.Configuration.ConfigurationSettings.AppSettings["WCFServicePort"]);

            RegisterWCFService wcf = new RegisterWCFService("localhost", port);

            wcf.RunWCFService();

            DataRecordQueueFactory.getInstance().StartService();

            System.Console.WriteLine(DataChannelFactoryService.getInstance().StartChannelService());
            DDService.getInstance();


            //new System.Threading.Thread(p =>
            //{
            //    DataService.Business.OneNetChannelService _oneNetService = new DataService.Business.OneNetChannelService();
            //    System.Console.WriteLine(_oneNetService.PostToOneNet("29720180402002", hexstr));
            //    System.Console.WriteLine($"ApartmentState:{System.Threading.Thread.CurrentThread.ApartmentState} CurrentUICulture:{System.Threading.Thread.CurrentThread.CurrentUICulture.Name} CurrentThread.Priority:{System.Threading.Thread.CurrentThread.Priority.ToString()}");
            //}).Start();

            while (true)
            {
                System.Console.Read();
            }
        }