コード例 #1
0
ファイル: CommandTest.php プロジェクト: phpindonesia/pintu
 public function testSendSMS()
 {
     $command = new Command();
     $command->sendSMS('123', 'Some Message');
     // Get the commands
     $commands = $command->all();
     $this->assertCount(2, $commands);
     $this->assertEquals('AT+CMGS="123"', $commands[0][ATCommandInterface::EXE]);
     $this->assertEquals('Some Message', $commands[1][ATCommandInterface::EXE]);
 }
コード例 #2
0
ファイル: PeerJson.php プロジェクト: phpindonesia/pintu
 protected function collectPayload()
 {
     $reader = new ReaderArray();
     $dsn = "dio.serial:///dev/ttyUSB2";
     $session = new Session($dsn);
     $command = new Command();
     $command->setSMSTextMode();
     $command->readSMS(ATCommandInterface::TYPE_ALL);
     $service = new Service($session, $command);
     $this->payload[self::DATA_INBOX] = $reader->get($service);
 }
コード例 #3
0
ファイル: ReaderTest.php プロジェクト: phpindonesia/pintu
 public function testRead()
 {
     $reader = new ReaderArray();
     $this->assertInstanceOf('\\Pintu\\ReaderInterface', $reader);
     $dsn = "dio.serial:///dev/ttyUSB0";
     $session = new Session($dsn);
     $command = new Command();
     $command->setSMSTextMode();
     $command->readSMS(ATCommandInterface::TYPE_ALL);
     $service = new Service($session, $command);
     $this->assertTrue(is_array($reader->get($service)));
 }
コード例 #4
0
ファイル: ServiceTest.php プロジェクト: phpindonesia/pintu
 public function testRunValidService()
 {
     $dsn = "dio.serial:///dev/ttyUSB0";
     $session = new Session($dsn);
     $command = new Command();
     $command->setSMSTextMode();
     $command->sendSMS('085648721439', 'Foo Bar');
     $command->readSMS(ATCommandInterface::TYPE_ALL);
     $service = new Service($session, $command);
     $this->assertInstanceOf('\\Pintu\\DIOServiceInterface', $service);
     $service->run();
 }