Ankündigung

Einklappen
Keine Ankündigung bisher.

- √ - Driver JSon

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

    - √ - Driver JSon

    Hello,
    i'm trying to use JSon as driver to connect to my PC.
    I cannot understand the reponse i must give to the driver, in the "write" and "read" function.
    Thanks for your help

    public function write()
    {
    $res = '';


    if ($this->fp)
    {
    fwrite($this->fp, "{".$this->item.":".$this->val."}\n");

    $cnt = 0;
    while ($cnt < 4 && $this->fp && !feof($this->fp))
    {
    $res .= fgets($this->fp, 128);
    $stc = fgetc($this->fp);


    if ($stc == "\4") <<--- What is "\4"?
    {
    if ($res=="1") <<--- What does it mean "1" ?
    $ret[$this->item[0]] = $this->val;

    break;
    }

    $res .= $stc;
    $cnt++;
    }
    }

    return $ret;

    #2
    For that special driver \4 stands for EOT (Ascii, End of Transmission).

    Greetings
    Join smartVISU on facebook. Web: smartvisu.de.
    Dir gefällt smartVISU? Bitte spenden für die Weiterentwicklung.

    Kommentar


      #3
      I have added a new version of this, with advanced error handling.

      Greetings
      Join smartVISU on facebook. Web: smartvisu.de.
      Dir gefällt smartVISU? Bitte spenden für die Weiterentwicklung.

      Kommentar

      Lädt...
      X