Exemple #1
0
 public static function initVars(PDU $pdu)
 {
     // if is the report status
     if ($pdu->getType() instanceof Type\Report) {
         // parse timestamp
         $pdu->setDateTime(SCTS::parse());
         // parse discharge
         $pdu->setDischarge(SCTS::parse());
         // get status
         $pdu->setStatus(hexdec(PDU::getPduSubstr(2)));
     } else {
         // get pid
         $pdu->setPid(PDU\PID::parse());
         // parse dcs
         $pdu->setDcs(DCS::parse());
         // if this submit sms
         if ($pdu->getType() instanceof Type\Submit) {
             // parse vp
             $pdu->setVp(VP::parse($pdu));
         } else {
             // parse scts
             $pdu->setScts(SCTS::parse());
         }
         // get data length
         $pdu->setUdl(hexdec(PDU::getPduSubstr(2)));
         // parse data
         $pdu->setData(Data::parse($pdu));
     }
     return $pdu;
 }