mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-09 09:45:06 +00:00
grammer and punctuation changes
@@ -1,17 +1,17 @@
|
||||
### Unifying communication methods
|
||||
### Unifying communication methods
|
||||
|
||||
In networked A/V systems, devices can use many different methods of communication. Com ports; TCP/IP sockets; Telnet; SSh... Generally, the data protocol and commands that are sent and received using any of these methods are the same, and it is not necessary for a device to need to know the details of the method of communication it is using. A Samsung MDC protocol display in room 1, using RS232 speaks the same language as another Samsung MDC does in the next room using TCP/IP. For these, and most cases where the device doesn't really need to know its communication method, we introduce the `IBasicCommunication` interface.
|
||||
In networked A/V systems, devices can use many different methods of communicatio: COM ports, TCP/IP sockets, Telnet, SSh. Generally, the data protocol and commands that are sent and received using any of these methods are the same, and it is not necessary for a device to know the details of the communication method it is using. A Samsung MDC protocol display in room 1 using RS232 speaks the same language as another Samsung MDC does in the next room using TCP/IP. For these, and most cases where the device doesn't need to know its communication method, we introduce the `IBasicCommunication` interface.
|
||||
|
||||
#### Classes covered
|
||||
|
||||
* `PepperDash.Core.GenericTcpIpClient`
|
||||
* `PepperDash.Core.GenericSshClient`
|
||||
* `PepperDash.Core.GenericSecureTcpIpClient`
|
||||
* `PepperDash.Essentials.Core.ComPortController`
|
||||
- `PepperDash.Core.GenericTcpIpClient`
|
||||
- `PepperDash.Core.GenericSshClient`
|
||||
- `PepperDash.Core.GenericSecureTcpIpClient`
|
||||
- `PepperDash.Essentials.Core.ComPortController`
|
||||
|
||||
#### IBasicCommunication and ISocketStatus
|
||||
|
||||
All common communication controllers will implement the `IBasicCommunication` interface, which is an extension of `ICommunicationReceiver`. This defines receive events, connection state properties, and send methods. Devices that need to use Com port, TCP, SSh or other similar communication will require an `IBasicCommunication` type object to be injected into them at construction time.
|
||||
All common communication controllers will implement the `IBasicCommunication` interface, which is an extension of `ICommunicationReceiver`. This defines receive events, connection state properties, and send methods. Devices that need to use COM port, TCP, SSh or other similar communication will require an `IBasicCommunication` type object to be injected at construction time.
|
||||
|
||||
```csharp
|
||||
/// <summary>
|
||||
@@ -21,12 +21,12 @@ public interface ICommunicationReceiver : IKeyed
|
||||
{
|
||||
event EventHandler<GenericCommMethodReceiveBytesArgs> BytesReceived;
|
||||
event EventHandler<GenericCommMethodReceiveTextArgs> TextReceived;
|
||||
|
||||
|
||||
bool IsConnected { get; }
|
||||
void Connect();
|
||||
void Disconnect();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Represents a device that uses basic connection
|
||||
/// </summary>
|
||||
@@ -35,7 +35,7 @@ public interface IBasicCommunication : ICommunicationReceiver
|
||||
void SendText(string text);
|
||||
void SendBytes(byte[] bytes);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// For IBasicCommunication classes that have SocketStatus. GenericSshClient,
|
||||
/// GenericTcpIpClient
|
||||
@@ -49,7 +49,7 @@ public interface ISocketStatus : IBasicCommunication
|
||||
|
||||
#### Developing devices with communication
|
||||
|
||||
Essentials uses dependency injection concepts in its start up phase. Simply, most devices use the same methods of communication, and are often communication-agnostic. During the build-from-configuration phase, the communication method device is instantiated, and then injected into the device that will use it. Since the communication device is of `IBasicCommunication`, the device controller receiving it knows that it can do things like listen for events, send text, be notified when sockets change.
|
||||
Essentials uses dependency injection concepts in its start up phase. Simply, most devices use the same methods of communication, and are often communication-agnostic. During the build-from-configuration phase, the communication method device is instantiated, and then injected into the device that will use it. Since the communication device is of `IBasicCommunication`, the device controller receiving it knows that it can do things like listen for events, send text, or be notified when sockets change.
|
||||
|
||||
#### Device Factory, Codec example
|
||||
|
||||
@@ -61,7 +61,7 @@ The DeviceManager will contain two new devices after this: The Cisco codec, and
|
||||
|
||||
#### ISocketStatus
|
||||
|
||||
`PepperDash.Core.GenericTcpIpClient`, `GenericSshClient` and some other socket controllers implement `ISocketStatus`, which is an extension of `IBasicCommunication`. This interface reveals connection status properties and events.
|
||||
`PepperDash.Core.GenericTcpIpClient`, `GenericSshClient` and some other socket controllers implement `ISocketStatus`, which is an extension of `IBasicCommunication`. This interface reveals connection status properties and events.
|
||||
|
||||
```csharp
|
||||
public interface ISocketStatus : IBasicCommunication
|
||||
@@ -71,4 +71,4 @@ public interface ISocketStatus : IBasicCommunication
|
||||
}
|
||||
```
|
||||
|
||||
Classes that are using socket-based comms will need to check for whether the communication is `ISocketStatus` and link up to the `ConnectionChange` event for connection handling.
|
||||
Classes that are using socket-based comms will need to check if the communication is `ISocketStatus` and link up to the `ConnectionChange` event for connection handling.
|
||||
|
||||
Reference in New Issue
Block a user