Exemple #1
0
        /// <summary>
        /// Initializes the underlying communication channels.
        /// </summary>
        /// <remarks>
        /// This is a length operation, and should be turned into an async method.
        /// </remarks>
        private bool InitilizeCommunications()
        {
            bool initialized = false;

            this.eventHubSettings = new EventHubSettings()
            {
                ServiceBusName = "lightningbolt",
                EventHubName = "sumobot",
                Policies = new Dictionary<string, string>()
                {
                    { "manage", "Z6KTK+hqBmMiu0WPLchX0oaYDMd+K2nwSRpZKt4RsqA=" },
                    { "device", "syc3awPWUXN1V+KbdAFmpPwx/r0F3chn1SLZJ6smioY=" },
                    { "processor", "8cxDOUPPQLkFIskUxMFCi9JNrBv6xHN8WcIwDz2fYhA=" }
                }
            };

            var sendLinks = new SendLinkDescription[]
            {
                new SendLinkDescription("temperature", "0"),
                new SendLinkDescription("sonar", "1"),
                new SendLinkDescription("ir", "2")
            };

            this.eventSender = new EventSender("PixyBot", this.eventHubSettings, "device");
            try
            {
                this.eventSender.InitializeChannels(sendLinks);
                initialized = true;
            }
            catch (Exception x)
            {
                StatusTxt.Text = "ERROR: " + x.Message;
                initialized = false;
            }

            return initialized;
        }
Exemple #2
0
 public EventSender(string name, EventHubSettings settings, string sendPolicyName)
     : base(settings, sendPolicyName)
 {
     this.Name = name;
 }
Exemple #3
0
 public EventReceiver(string name, EventHubSettings settings, string receivePolicyName, int receiveTimeoutMs = 5000)
     : base(settings, receivePolicyName)
 {
     this.Name = name;
     this.ReceiveTimeoutMs = receiveTimeoutMs;
 }
 public EventHubClient(EventHubSettings settings, string sendPolicyName)
 {
     this.settings = settings;
     this.policyName = sendPolicyName;
 }