public static IOnewayEnergyServiceChannel GetOneWayEnergyChannel(ChannelFactory <IOnewayEnergyServiceChannel> channelFactory)
        {
            IOnewayEnergyServiceChannel channel = channelFactory.CreateChannel();

            Console.WriteLine("Opening Channel.");
            channel.Open();
            return(channel);
        }
        private void InitNetOnewayRelayClient()
        {
            string issuerName             = tsSolutionName.Text;
            string issuerKey              = tsSolutionPassword.Text;
            string serviceNamespaceDomain = tsSolutionToConnect.Text;

            try
            {
                Uri address = ServiceBusEnvironment.CreateServiceUri("sb", serviceNamespaceDomain, "OnewayEnergyServiceOperations");

                netOnewayChannelFactory = new ChannelFactory <IOnewayEnergyServiceChannel>("RelayEndpoint", new EndpointAddress(address));

                netOnewayChannel = ServiceBusHelper.GetOneWayEnergyChannel(netOnewayChannelFactory);

                ClearLog();
                AddLog("Connected");
                AddLog(netOnewayChannelFactory.Endpoint.Address.Uri.ToString());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 public static void SendHVACSetPointValue(IOnewayEnergyServiceChannel netOnewayChannel, string gatewayId, string hvacId, int setPointValue)
 {
     netOnewayChannel.SendHVACSetPoint(gatewayId, hvacId, setPointValue, DateTime.UtcNow);
 }
 public static void SendKwhValue(IOnewayEnergyServiceChannel netOnewayChannel, string gatewayId, string meterId, double kWhValue)
 {
     netOnewayChannel.SendKwhValue(gatewayId, meterId, kWhValue, DateTime.UtcNow);
 }
 public static void SendLightingValue(IOnewayEnergyServiceChannel netOnewayChannel, string gatewayId, string switchId, int lightingValue)
 {
     netOnewayChannel.SendLightingValue(gatewayId, switchId, lightingValue, DateTime.UtcNow);
 }
        public static void CloseoneWayChannelFactoryAndChannel(ChannelFactory <IOnewayEnergyServiceChannel> channelFactory, IOnewayEnergyServiceChannel channel)
        {
            channel.Close();

            channelFactory.Close();
        }