static void Main() { try { // Inizializzazione configurazione Log4Net var logRepository = LogManager.GetRepository(Assembly.GetEntryAssembly()); XmlConfigurator.Configure(logRepository, new FileInfo("log4net.config")); //Inizializzazione configurazione _config = Utils.Utils.ReadConfiguration(); //Inizializzazione modulo di monitoring Modulo modulo = _config.Monitoring.Modules.Find(x => x.Name.Contains("Hub")); AliveServer(modulo.Ip, modulo.Port); //Inizializzazione client AMQP _amqpconn = new ClientAMQP(); _amqpconn.CreateExchange(_config.Communications.AMQP.Exchange, ExchangeType.Direct.ToString()); //Inizializzazione server MQTT e ricezione messaggi ServerMQTT mqttC = new ServerMQTT(); mqttC.MessageReceived += OnMQTTMessageReceived; mqttC.StartAsync(); mqttC.ReceiveAsync(); _log.Info("HUB INIZIALIZZATO CORRETTAMENTE!"); Console.ReadLine(); } catch (Exception e) { _log.ErrorFormat("!ERROR: {0}", e.ToString()); } }
public IoT(DashBoard dashBoard, ServerMQTT mqtt, string mqttClientId, IRepository repository, IScenarioEngine engine) { this.dashBoard = dashBoard; system = ActorSystem.Create("iot"); orchastraion = system.ActorOf(Orchestration.Props(this.dashBoard, mqttClientId, repository, engine), "orch"); //AddGateway(new GatewayDashBoard("1")); //AddDevice(new GatewayDashBoard("1"), new DeviceDashBoard("2")); orchastraion.Tell(new SystemStart()); this.mqtt = mqtt; mqtt.ReceiveMsg += Mqtt_ReceiveMsg; }