51         for ($i = 0; $i < strlen(
$data); $i++) {
 
   52             $checksum += ord(
$data[$i]);
 
   54         $checksum = $checksum & 0xFF;
 
   55         $checksum = 0xFF - $checksum;
 
   56         $checksum = chr($checksum);
 
   67         $length = strlen(
$data);
 
   68         $length = sprintf(
"%04x", $length);
 
   81         for ($i=0; $i < strlen($hex); $i+=2) {
 
   82             $string .= chr(hexdec($hex[$i] . $hex[$i+1]));
 
   95         for ($i=0; $i < strlen($str); $i+=2) {
 
   96             $hex .= dechex(ord($str[$i])) . dechex(ord($str[$i+1]));
 
  108         return pack(
'H*', 
$data);
 
  118         return unpack(
'H*', 
$data);
 
  137         return $this -> frame;
 
  156         return $this -> frameId;
 
  174         return $this -> apiId;
 
  193         return $this -> cmdData;
 
  211         return $this -> startByte;
 
  312         parent::_XBeeFrameBase();
 
  367         trigger_error(
'queued_at not implemented', E_USER_ERROR);
 
  375         trigger_error(
'tx not implemented', E_USER_ERROR);
 
  383         trigger_error(
'tx_explicit not implemented', E_USER_ERROR);
 
  404         parent::_XBeeFrameBase();
 
  406         $this->status_byte = array(
'00' => 
'OK',
'01' => 
'Error',
'02'=> 
'Invalid Command', 
'03' => 
'Invalid Parameter', 
'04' => 
'No Response' );
 
  407         $this -> _parse($response);
 
  410             $this -> _parseRemoteAt();
 
  412             $this -> _parseRX16();
 
  414             $this -> _parseLocalAt();
 
  416             trigger_error(
'Could not determine response type or response type is not implemented.', E_USER_WARNING);
 
  433     private function _parse($response) {
 
  434         $length = substr($response, 0, 2);
 
  435         $checksum = substr($response, -1);
 
  436         $cmdData = substr($response, 2, -1);
 
  442         $packedChecksum = $checksum;        
 
  443         $packedLength = $length;        
 
  445         if ($packedChecksum === $calculatedChecksum && $packedLength === $calculatedLength) {
 
  453             trigger_error(
'Checksum or length check failed.', E_USER_WARNING);
 
  462     private function _parseRemoteAt() {
 
  480         $this->_setCmd(
$cmd);
 
  490     private function _parseLocalAt() {
 
  508         $this->_setCmd(
$cmd);
 
  519     private function _parseRX16() {
 
  528         $this->_setSignalStrength($rssi);
 
  530         $this->_setCmd($payload);
 
  538         return $this -> signalStrength;
 
  546     private function _setSignalStrength($strength) {
 
  547         $this->signalStrength = $strength;
 
  564     private function _setNodeId(
$nodeId) {
 
  573     private function _setStatus(
$status) {
 
  611     private function _setCmd(
$cmd) {
 
remoteAtCommand($address16, $cmd, $val, $address64= '0000000000000000', $options= '02')
 
localAtCommand($cmd, $val= '')