public function testArrayWithDuration()
 {
     $Collector = new DataCollector(array(140, 145, 140, 150, 160, 175, 190, 150, 145, 140), array(60, 90, 100, 140, 170, 190, 200, 230, 290, 300));
     $this->assertEquals(array(140 => 80, 145 => 90, 150 => 70, 160 => 30, 175 => 20, 190 => 10), $Collector->result());
 }
Beispiel #2
0
 for ($ii = 1; $ii <= $nsid; $ii++) {
     $sid = $msid[$ii];
     $dd = $dat[$ii];
     if ($mid == SXN_DATA || $mid == SXN_MAILBOX) {
         setClientStatus($sid, $name, $ip, $appid);
     }
     $dbM = new DataManager(SXN_USER, SXN_PASSWORD, "localhost", SXN_DATABASE_ADMIN);
     $dbM->selectAllFromTable(SXN_ADMIN_TABLE_STREAMS, SXN_ADMIN_STREAMS_COLUMN_SID . "=" . $sid);
     $numRes = $dbM->retrieveNumberOfResults();
     if ($numRes == 1) {
         while ($data = $dbM->retrieveResult()) {
             if ($mid == SXN_DATA) {
                 $tag = $data[SXN_ADMIN_STREAMS_COLUMN_TAG];
                 //if($tag) $name = $tag;
                 //echo SXN_USER, SXN_PASSWORD, \"localhost\", SXN_DATABASE_COLLECTOR)";
                 $dbC = new DataCollector(SXN_USER, SXN_PASSWORD, "localhost", SXN_DATABASE_COLLECTOR);
                 $dbC->openDataBase();
                 $success = $dbC->insertData($sid, $dd);
                 echo "{$sid} {$dd} DATA";
                 lib_executeSidFunction($sid);
                 getControlMessage($sid);
             }
             if ($mid == SXN_LATEST) {
                 $value = lib_getLatestValue($sid);
                 echo "{$sid}:{$value}:LATEST";
             }
             if ($mid == SXN_DERLATEST) {
                 $value = lib_getLatestDerivative($sid);
                 echo "{$sid}:{$value}:DERLATEST";
             }
             if ($mid == SXN_MAILBOX) {