Esempio n. 1
0
 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]);
 }
Esempio n. 2
0
 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);
 }
Esempio n. 3
0
 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)));
 }
Esempio n. 4
0
 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();
 }