示例#1
0
文件: Parse.php 项目: hairmare/PoscHP
 /**
  * same test as before with "raw" data
  */
 public function testSetData()
 {
     $abuf = array("2f", "0", "0", "0", "2c", "0", "0", "0");
     $this->assertFalse($this->_object->hasData());
     $this->_object->setData($abuf);
     $this->assertTrue($this->_object->hasData());
 }
示例#2
0
文件: Parse.php 项目: hairmare/PoscHP
 /**
  * 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;
 }