Esempio n. 1
0
 /**
  * test parsing the empty package from the corpus
  */
 public function testParse()
 {
     $buf = $this->getBuffer('empty_oscbundle');
     $this->_object->setDataString($buf);
     $this->_object->parse();
     $result = $this->_object->getResult();
     $this->assertEquals($result['address'], "/");
     $this->assertEquals($result['data'], array());
 }
Esempio n. 2
0
 /**
  * parse data until no more buffers remain
  *
  * after this method we are always in the done state
  * since messages may not contain osc bundles.
  *
  * @return void
  */
 private function _parseBundles()
 {
     $state = $this->_state;
     $bundlets = $this->_multiByteShift(8, 'array');
     $this->_parseTimestamp();
     while (!empty($this->_data)) {
         $bundlesize = hexdec($this->_multiByteShift(4));
         if ($bundlesize % 4 !== 0) {
             $bundlesize++;
         }
         $bundledata = $this->_multiByteShift($bundlesize, 'array');
         if ($this->_debug) {
             printf("Found Bundle of length %s\n", $bundlesize);
         }
         $bundleparse = new Osc_Parse();
         $bundleparse->setDebug($this->_debug);
         $bundleparse->setData($bundledata);
         $bundleparse->parse();
         if ($this->_debug) {
             printf("Parsed bundle.");
             var_dump($bundleparse->getResult());
         }
         $this->_appendStore($bundleparse->getResult());
     }
     $state = Osc_Parse::STATE_DONE;
     return $state;
 }