Ejemplo n.º 1
0
 private void MessageClient_MessageReceived(object sender, MessageQueues.MessageReceivedEventArgs e)
 {
     if (ForwardMessageToIoTHubTransform != null)
     {
         var sendMessage = ForwardMessageToIoTHubTransform(e.MessageEnevelope);
         azureDeviceClient.SendEventAsync(sendMessage);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Handles a received message.  If the message is a Client Announce Message, it send the client the current shared key.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void MessageClient_MessageReceived(object sender, MessageQueues.MessageReceivedEventArgs e)
 {
     if (e.MessageEnevelope.Message.GetType() == typeof(ClientAnnounceMessage))
     {
         //TODO: Check validity???
         this.MessageClient.RespondToMessage(
             e.MessageEnevelope,
             new TrustZoneSharedKeyUpdate(this.MessageClient.PublicKeystore.CurrentSharedKey),
             EncryptionOption.EncryptWithPrivateKey);;
     }
 }
        private void MessageClient_MessageReceived(object sender, MessageQueues.MessageReceivedEventArgs e)
        {
            List <Func <MessageBase, string> > funcs;

            if (transforms.TryGetValue(e.MessageEnevelope.Message.GetType(), out funcs))
            {
                foreach (var func in funcs)
                {
                    string result = func(e.MessageEnevelope.Message);

                    if (!string.IsNullOrEmpty(result))
                    {
                        pushoverClient.Push("", result, pushoverUserKey);
                    }
                }
            }

            e.Response = MessageQueues.MessageResponse.Ack;
        }