Closed arturscheiner closed 7 years ago
Hello,
I'm playing a little with this package but I was unable to get it decode a valid SMS PDU, the simple example bellow always returns:
&{0 0 0 0 {0 0 } 0 false false false false false false false}
import ( "encoding/hex" "fmt"
"github.com/xlab/at/sms"
)
func main() { bs, err := hex.DecodeString("0791551010010201040D91551699296568F80011719022124215293DD4B71C5E26BF41D3E6145476D3E5E573BD0C82BF40B59A2D96CBE564351BCE8603A164319D8CA6ABD540E432482673C172AED82DE502") if err != nil { panic(err) } msg := new(sms.Message) msg.ReadFrom(bs) fmt.Println(msg) }
The code bellow was extracted from this link: https://stackoverflow.com/questions/30291987/parse-sms-pdu-on-go
It works with the sample PDU message provided on the link but not with the the SMS Messages I'm receiving.
Hi @arturhs ! Don't forget to check return values of methods like msg.ReadFrom, in your case it was returning errors. I fixed them, should be OK.
msg.ReadFrom
Thanks! It is working now!
Best Regards,
Artur
Hello,
I'm playing a little with this package but I was unable to get it decode a valid SMS PDU, the simple example bellow always returns:
&{0 0 0 0 {0 0} 0 false false false false false false false}
import ( "encoding/hex" "fmt"
)
func main() { bs, err := hex.DecodeString("0791551010010201040D91551699296568F80011719022124215293DD4B71C5E26BF41D3E6145476D3E5E573BD0C82BF40B59A2D96CBE564351BCE8603A164319D8CA6ABD540E432482673C172AED82DE502") if err != nil { panic(err) } msg := new(sms.Message) msg.ReadFrom(bs) fmt.Println(msg) }
The code bellow was extracted from this link: https://stackoverflow.com/questions/30291987/parse-sms-pdu-on-go
It works with the sample PDU message provided on the link but not with the the SMS Messages I'm receiving.