public static async Task AsyncPointMethodExample(PointInfo currentPointInfo) { Point currentPoint = currentPointInfo.CurrentPoint; Point parentPoint = currentPointInfo.ParentPoint; ControlSpace cs = currentPointInfo.CurrentControlSpace; // Point otherPoint = currentPointInfo.GetPoint("Getting point by channel name"); // otherPoint = currentPointInfo.GetPoint(new Channel("", ChannelType.TCP));// at what stage it should contain something? IEnumerable <Channel> allChannels = currentPointInfo.Channels; await otherPoint.CancelAsync(); foreach (var item in allChannels) { } }
/// <summary> /// Constructor /// </summary> /// <param name="channelToRemotePoint">Channel to remote point</param> /// <param name="currentPointChannel">Channel of point from which request will be performed</param> internal Point(Channel channelToRemotePoint, Channel currentPointChannel, ControlSpace space) { if (currentPointChannel == null) { currentPointChannel = channelToRemotePoint; } _pointThatUsingThisPoint = currentPointChannel; Channel = channelToRemotePoint; _controlSpace = space;/* * if (channelToRemotePoint.IP == currentPointChannel.IP && channelToRemotePoint.Type != ChannelType.TCP) * { * _PointServiceClient = ChannelFactory<IPointService>.CreateChannel(WCFSettings.GetNamedPipeBinding(), new EndpointAddress($"net.pipe://{channelToRemotePoint.IP}/{channelToRemotePoint.Port}")); * } * else*/ { _PointServiceClient = ChannelFactory <IPointService> .CreateChannel(WCFSettings.GetTcpBinding(), new EndpointAddress($"net.tcp://{channelToRemotePoint.IP}:{channelToRemotePoint.Port}")); } // }
internal Daemon(string daemonIPAndPort, ControlSpace space) { _linkedControlSpace = space; Name = daemonIPAndPort; _daemon = ChannelFactory <IDaemonService> .CreateChannel(WCFSettings.GetTcpBinding(), new EndpointAddress(daemonIPAndPort)); }
public async Task GeneralIdea() { // CS constructors //Creating Point-service for data exchange with createdPoints. ControlSpace cs = new ControlSpace("TaskName"); cs = new ControlSpace("TaskName", "uri"); cs = new ControlSpace("TaskName", new List <string>() { "uri" }); // CS Functions { // Working With Daemons { IEnumerable <Daemon> daemons = cs.Daemons; var daemon = daemons.FirstOrDefault(); cs.AddDaemons("daemon uri"); cs.AddDaemons("daemon uri", "another one"); // Daemon functions { string DaemonNameOrUri = daemon.Name; // Daemon Points Pool // Daemon Points { //Points Service Operations } // Daemon Statistics { //PC workload etc } } } // AddingFiles to CS (every daemon) { await cs.AddFileAsync(""); await cs.AddDirectoryAsync(""); } // Work with Points { Point point1 = await cs.CreatePointAsync(); Point point2 = await cs.CreatePointAsync("Name", PointType.Any, ChannelType.TCP); Channel info = point1.Channel; //Channel // Point operations { //GetCurrent Daemon Daemon daemon = await point1.GetDaemonAsync(); // await point1.AddChannelAsync(new Channel("Uri/name", new[] { ChannelType.TCP }, new Uri(""), Guid.NewGuid())); // point1.AddChannel(new Channel("Uri/name", new[] { ChannelType.TCP }, new Uri(""), Guid.NewGuid())); //Get current thread CPU/RAM load { } //Data transfer await point1.SendAsync(42); //json/bson/XML serialization to byte array int data = await point2.GetAsync <int>(); // deserialize T from json/bson/XML // Functioning await point1.CancelAsync(); await point1.RunAsync(new PointStartInfo(AsyncPointMethodExample)); // at this stage point service may contain channels to other points await point1.StopAsync(); } } } }