public function rawDataReceiver()
 {
     $data = Input::get('data');
     // Elephant SOCKET IO
     $client = new CLient(new Version1X('http://localhost:3636'));
     // 라인별로 데이터 분리
     $lineData = explode("\n", $data);
     $lineDataSize = count($lineData);
     // 현재 요청한 시각.
     $currentTime = date("Y-m-d H:i:s", time());
     $output = [];
     // 아웃풋 데이터
     for ($i = 0; $i < $lineDataSize; $i++) {
         $each = explode(',', $lineData[$i]);
         if (sizeof($each) !== 2) {
             continue;
         }
         $dataType = (int) $each[0];
         $dataRaw = (int) $each[1];
         // 데이터 변환
         $convertedRaw = $dataRaw * (1.8 / 4096.0) / 2000.0;
         $convertedRaw = $convertedRaw * 1000000;
         if ($convertedRaw >= -100.5 && $convertedRaw <= 100.5) {
             $output[] = $convertedRaw;
             $oRawData = new MemberRawData();
             $oRawData->rawdata = $dataRaw;
             $oRawData->regdate = $currentTime;
             $oRawData->save();
         }
     }
     $client->initialize();
     $client->emit('neuroskyData', ['data' => $output]);
     $client->close();
     return " OKAY !";
 }
Example #2
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $Invoice = Invoice::find($id);
     $Clients = CLient::orderBy('nombre', 'ASC')->lists('nombre', 'id');
     //dd($Invoice->details);
     return view('invoice.create')->with('Invoice', $Invoice)->with('Clients', $Clients);
     /*
         return view('invoice.create')
                     ->with('Clients',  $Clients);
     */
 }
Example #3
0
        } else {
            Gpio::write($_["pin"], $_["state"], true);
        }
        break;
        // Gestion des interfaces de seconde génération
    // Gestion des interfaces de seconde génération
    case 'SUBSCRIBE_TO_CLIENT':
        Action::write(function ($_, &$response) {
            global $myUser, $conf;
            if (!isset($_['ip'])) {
                throw new Exception("IP invalide");
            }
            if (!isset($_['port']) || !is_numeric($_['port'])) {
                throw new Exception("Port invalide");
            }
            $url = Functions::getBaseUrl('action.php') . '/action.php';
            $client = new CLient($_['ip'], $_['port']);
            Plugin::callHook("vocal_command", array(&$vocal, $url));
            $conf = array('VOCAL_ENTITY_NAME' => $conf->put('VOCAL_ENTITY_NAME', 'YANA'), 'SPEECH_COMMAND' => $vocal);
            if (!$client->suscribe($url, $myUser->getToken())) {
                throw new Exception("Appairage impossible");
            }
            if (!$client->configure($conf)) {
                throw new Exception("Configuration impossible");
            }
        }, array('user' => 'u'));
        break;
    default:
        Plugin::callHook("action_post_case", array());
        break;
}
Example #4
0
    /**
     * @return array validation rules for model attributes.
     */
    public function rules()
    {
        return array(['cli_fname, cli_sname, cli_email', 'required'], ['telephones', 'checkTelephones', 'on' => 'validPhoneOnInsert'], ['addressID', 'checkAddressID'], ['propertyCategoryIds, propertyTypesIds', 'safe'], ['cli_salemin, cli_salemax', 'numerical', 'allowEmpty' => true, 'on' => 'search'], ['budget', 'numerical', 'allowEmpty' => true], ['budget', 'default', 'setOnEmpty' => true, 'value' => null], ['cli_salebed, cli_source,cli_neg,cli_branch, cli_salestatus, searchPrice', 'numerical', 'allowEmpty' => true], ['cli_email, secondaryEmail', 'email'], ['cli_saleemail, cli_sales', 'in', 'range' => [Client::EMAIL_SALES_YES, Client::EMAIL_SALES_NO]], ['cli_fname, cli_sname', 'type', 'type' => 'string'], ['cli_salutation', 'in', 'range' => Client::getSalutationTypes()], ['cli_preferred', 'in', 'range' => CLient::getContactMethods()], ['lastContacted', 'default', 'setOnEmpty' => true, 'value' => null], ['minPrice, maxPrice', 'numerical', 'allowEmpty' => true, 'on' => 'search'], ['searchNoBudget, searchNoMinimumBeds', 'boolean', 'allowEmpty' => true, 'on' => 'search'], ['matchingPostcode', 'unsafe'], ['invalidEmail', 'in', 'range' => [0, 1]], ['invalidEmail', 'default', 'setOnEmpty' => 0, 'value' => 0], ['searchPostcodes', 'safe', 'on' => 'search'], ['fullName, cli_id, cli_status, cli_method,
						cli_source, cli_preferred, cli_created, cli_reviewed,
						cli_vendor, cli_landlord, cli_sales, cli_lettings,
						cli_regd, cli_branch, cli_neg,
						cli_solicitor, cli_salutation,
						cli_fname, cli_sname, cli_pro,
						cli_email, cli_password,
						cli_question, cli_answer, cli_salemin,
						cli_salemax, cli_salebed, cli_saleemail,  cli_saleptype, cli_salereq,
						cli_letptype, cli_letreq, cli_area, cli_oldnotes, cli_oldaddr,
						cli_salestatus, cli_mortgagestatus,
						cli_timestamp, cli_deposit, cli_selling, cli_renting,
						 cli_wparents, cli_valuation, cli_workstatus, cli_student, cli_moveby', 'safe', 'on' => 'search']);
    }
 public function testInvalidRequestIfAuthClientIsNotSame()
 {
     $this->expectException(OAuth2Exception::class, null, 'invalid_request');
     $request = $this->createMock(ServerRequestInterface::class);
     $request->expects($this->once())->method('getParsedBody')->willReturn(['code' => '123', 'client_id' => 'foo']);
     $token = $this->getValidAuthorizationCode(null, null, CLient::createNewClient('id', 'http://www.example.com'));
     $this->authorizationCodeService->expects($this->once())->method('getToken')->with('123')->will($this->returnValue($token));
     $this->grant->createTokenResponse($request, CLient::createNewClient('id', 'http://www.example.com'));
 }