private PhyLayer process(DNPConfig config) throws Exception {
try {
this.config = config;
if (config.getCommType() == COMM.ETHERNET) {
EthernetParameters parameters = (EthernetParameters) config
.getCommConfig();
setCommAddress(parameters.getHost());
setPort(parameters.getPort());
setPhyETHERNET(new PhyETHERNET(this));
setInputStream(phyETHERNET.getInputStream());
setOutputStream(phyETHERNET.getOutputStream());
} else if (config.getCommType() == COMM.SERIAL) {
SerialParameters parameters = (SerialParameters) config
.getCommConfig();
setCommAddress(parameters.getCommAddress());
setBaudrate(parameters.getBaudrate());
setDataBits(parameters.getDatabits());
setStopBits(parameters.getStopbits());
setParity(parameters.getParity());
setPhySERIAL(new PhySERIAL(this));
setInputStream(phySERIAL.getInputStream());
setOutputStream(phySERIAL.getOutputStream());
}