Ejemplo n.º 1
0
        static async Task Main(string[] args)
        {
            CloudConnectionConfig cloudConnectionConfig = CloudConnectionConfig.Instance;
            CloudConnector        cloudConnector        = new CloudConnector(cloudConnectionConfig);

            string topic   = "mytest/topic";
            string message = "Test message";
            int    i       = 0;

            await cloudConnector.ConnectToAwsIoT();

            while (true)
            {
                Console.WriteLine("Enter 1 for publish. 2 for subscribe.");
                string input = Console.ReadLine();

                if (input == "1")
                {
                    await cloudConnector.PublishMessage($"{message} {i}", topic);
                }
                else if (input == "2")
                {
                    await cloudConnector.SubscribeTo(topic);
                }

                i++;
            }
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            CloudConnectionConfig cloudConnectionConfig = ConnectionConfigManager.GetConnectionConfig();

            CloudConnector cloudConnector = new CloudConnector(cloudConnectionConfig);



            Console.WriteLine("Enter 1 for Publish. 2 for subscribe.");


            string input = Console.ReadLine();

            if (input == "1")
            {
                cloudConnector.PublishMessage();
            }

            else if (input == "2")
            {
                cloudConnector.SubscribeMessage();
            }



            Console.ReadLine();
        }
        public static CloudConnectionConfig  GetConnectionConfig()
        {
            if (cloudConnectionConfig == null)
            {
                cloudConnectionConfig = new CloudConnectionConfig();
            }

            return(cloudConnectionConfig);
        }
 public CloudConnector(CloudConnectionConfig cloudConnectionConfig)
 {
     this.cloudConnectionConfig = cloudConnectionConfig;
     isSubscribed = false;
 }
Ejemplo n.º 5
0
 public CloudConnector(CloudConnectionConfig cloudConnectionConfig1)
 {
     cloudConnectionConfig = cloudConnectionConfig1;
 }