コード例 #1
0
        public void StartInfoThread()
        {
            string hostName = Dns.GetHostName(); // Retrive the Name of HOST
            string myIP     = Dns.GetHostEntry(hostName).AddressList[0].ToString();

            var udpServer = UdpServer.GetInstance();

            rigBusDesc              = VirtualRigInfo.Instance;
            rigBusDesc.Command      = "update";
            rigBusDesc.Id           = Id;
            rigBusDesc.UdpPort      = udpServer.listenUdpPort;
            rigBusDesc.TcpPort      = udpServer.listenTcpPort;
            rigBusDesc.MinVersion   = 1;
            rigBusDesc.MaxVersion   = 1;
            rigBusDesc.Host         = hostName;
            rigBusDesc.Description  = "Kenwood Virtual RigBus";
            rigBusDesc.Ip           = myIP;
            rigBusDesc.SendSyncInfo = true;
            rigBusDesc.RigType      = Constants.VirtualRigType;
            rigBusDesc.Name         = Constants.VirtualRigName;
            rigBusDesc.DocType      = DocTypes.RigBusInfo;;

            infoThread = new Thread(SendRigBusInfo);
            infoThread.Start();

            var dirClient = DirectoryClient.Instance;

            dirClient.StartThread();
        }
コード例 #2
0
        public void StartInfoThread()
        {
            string hostName = NetworkUtils.getHostName();
            // Get the IP
            string myIP = NetworkUtils.getIpAddress();

            Console.WriteLine("my ip: {0}", myIP);
            var netThread = UdpServer.GetInstance();

            rigBusDesc         = OmniRigInfo.Instance;
            rigBusDesc.Command = "update";

            rigBusDesc.UdpPort      = netThread.listenUdpPort;
            rigBusDesc.TcpPort      = netThread.listenTcpPort;
            rigBusDesc.MinVersion   = 1;
            rigBusDesc.MaxVersion   = 1;
            rigBusDesc.Host         = hostName;
            rigBusDesc.Ip           = myIP;
            rigBusDesc.SendSyncInfo = true;
            rigBusDesc.RigType      = "Unknown";
            rigBusDesc.Name         = "OmniRig RigBus";
            rigBusDesc.Description  = "OmniRig RigBus";
            infoThread = new Thread(SendRigBusInfo);
            infoThread.Start();
        }
コード例 #3
0
        /// <summary>
        /// The Main
        /// </summary>
        /// <param name="args">The args<see cref="string[]"/></param>
        public static void Main(string[] args)
        {
            int httpPort = IpPorts.TcpPort;


            var url = string.Format("http://+:{0}", httpPort);

            var udpServer       = UdpServer.GetInstance();
            var reportingThread = ReportingThread.GetInstance();

            reportingThread.StartInfoThread();
            StartVirtualRigs();

            WebApp.Start <Startup>(url: url);
            Console.ReadLine();
        }
コード例 #4
0
ファイル: ORig.cs プロジェクト: haminteropt/omnibus
        private void sendRigBusState(RigStatePacket rigState)
        {
            var netRunniner = UdpServer.GetInstance();
            var net         = OmniRigInfoThread.GetInstance();

            var state      = RigOperatingState.Instance;
            var rigBusDesc = OmniRigInfo.Instance;

            state.Id      = rigBusDesc.Id;
            state.DocType = "RigOperatingState";
            state.Command = "StateUpdate";
            state.Freq    = rigState.Freq;
            state.FreqA   = rigState.Freq;
            state.Mode    = rigState.Mode;
            Console.WriteLine("Freq: {0} - Mode: {1}", state.Freq,
                              state.Mode);
            netRunner.SendBroadcast(state, 7300);
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: haminteropt/omnibus
        static int Main(string[] args)
        {
            UdpServer.GetInstance();
            var netThread = OmniRigInfoThread.GetInstance();

            netThread.StartInfoThread();

            try
            {
                var exitCode = HostFactory.Run(c =>
                {
                    c.Service <OmniRigService>(service =>
                    {
                        ServiceConfigurator <OmniRigService> s = service;
                        s.ConstructUsing(() => new OmniRigService());
                        s.WhenStarted(a => a.Start());
                        s.WhenStopped(a => a.Stop());
                    });
                    c.SetServiceName("OmniRigHamBus");
                    c.SetDisplayName("OmniRig HamBus server");
                    c.SetDescription("Web server for OmniRig and hambus");
                });
                return((int)exitCode);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                if (e.InnerException != null)
                {
                    Console.WriteLine(e.InnerException.Message);

                    Console.WriteLine("\n\nCould not open COM object! Exiting");


                    return(-1);
                }
            }
            return(0);

            Console.ReadKey();
        }
コード例 #6
0
        public void StartInfoThread()
        {
            var udpServer = UdpServer.GetInstance();
            var hostName  = Dns.GetHostName(); // Retrive the Name of HOST

            dataBusDesc.Command     = "update";
            dataBusDesc.Id          = Id;
            dataBusDesc.DocType     = DocTypes.DataBusInfo;
            dataBusDesc.UdpPort     = udpServer.listenUdpPort;
            dataBusDesc.TcpPort     = udpServer.listenTcpPort;
            dataBusDesc.MinVersion  = 1;
            dataBusDesc.MaxVersion  = 1;
            dataBusDesc.Host        = hostName;
            dataBusDesc.Name        = "CouchDB DataBus";
            dataBusDesc.Description = "DataBus for CouchDB";

            // Get the IP
            string myIP = Dns.GetHostEntry(hostName).AddressList[0].ToString();

            infoThread = new Thread(SendRigBusInfo);
            infoThread.Start();
        }
コード例 #7
0
        static void Main(string[] args)
        {
            int httpPort = IpPorts.TcpPort;
            var url      = string.Format("http://localhost:{0}/", httpPort);

            app = WebApp.Start(url);
            string baseAddress = "http://localhost:9000/";

            // Start OWIN host
            using (WebApp.Start <Startup>(url: baseAddress))
            {
                // Create HttpCient and make a request to api/values
                HttpClient client = new HttpClient();

                var response = client.GetAsync(baseAddress + "api/values").Result;

                Console.WriteLine(response);
                Console.WriteLine(response.Content.ReadAsStringAsync().Result);
                Console.ReadLine();
            }

            var comPort         = "com20";
            var udpServer       = UdpServer.GetInstance();
            var reportingThread = ReportingThread.GetInstance();

            reportingThread.rigBusDesc.ComPort = comPort;
            reportingThread.StartInfoThread();
            var kenwood = new KenwoodEmu();

            kenwood.Id = reportingThread.Id;

            kenwood.OpenPort(comPort);

            var kenwood2 = new KenwoodEmu();

            Console.ReadKey();
        }