Porovnávané verzie

Kľúč

  • Tento riadok sa pridal
  • Riadok je odstránený.
  • Formátovanie sa zmenilo.

Modul The module sk.ipesoft.sgcom.hdlc obsahuje implementáciu protokolu contains the implementation of the IEC62056-46 HDLC . HDLC primárne zabezpečuje spojovo orientovanú komunikáciu po sériovej zbernici podobne, ako protocol. HDLC primarily provides connection-oriented communication over a serial bus, similar to TCP/IP nad over Ethernet -om alebo WiFi, aj keď neobsahuje toľko sofistikovaných rozšírení. Použitie tejto implementácie HDLC protokolu pred vstavanou podporou v jDLMS knižnici je kvôli tomu, že umožňuje posielať aj dlhé správy, ktoré sa nezmestia do jedného HDLC Information Frame-u. Taktiež je ho možné lepšie ladiť, vďaka konfigurovateľnému a podrobnému výstupu do LOG-u.
Hlavnou triedou modulu je HdlcLayer, ktorá udržiava stav komunikácie a riadi prijímanie a zasielanie frame-ov. Je implementovaná tak, že dokáže operovať nad ľubovoľnou fyzickou vrstvou, ktorej rozhraním sú InputStream, OutputStreamsetTimeout, čiže nad TCP/IP socketom, sériovou linkou aj DatagramSocketWrapper-om.
Narozdiel od iných komunikačných vrstiev sa v HdlcLayer nenachádza čítacia programová slučka vykonávaná v samostatnom vlákne, ako je tomu napr. v module Serial alebo Udp. Je to z toho dôvodu, že komunikácia je prísne half-duplexná – v každom okamihu komunikácie je jednoznačne zrejmé, ktorý z partnerov čaká a ktorý môže poslať or WiFi, although it does not include as many sophisticated extensions. The use of this implementation of the HDLC protocol instead of the built-in support in the jDLMS library is due to the fact that it allows sending even long messages that do not fit into one HDLC Information Frame. It is also possible to debug it better, thanks to the configurable and detailed output to the LOG.
The main class of the module is HdlcLayer, which maintains the state of communication and controls the reception and transmission of frames. It is implemented in such a way that it can operate over any physical layer whose interfaces are InputStream, OutputStream and setTimeout, i.e. over TCP/IP socket, serial line, and DatagramSocketWrapper.
Unlike other communication layers, HdlcLayer does not have a read program loop executed in a separate thread, as is the case for example in the Serial or Udp module. This is due to the fact that the communication is strictly half-duplex - at every moment of the communication it is clearly obvious which of the partners is waiting and which can send the frame.