CMD.go 346 B

123456789101112131415161718192021222324
  1. package QuectelAT
  2. import "strings"
  3. const (
  4. CMD = "CMD"
  5. )
  6. type SentenceCMD struct {
  7. Message []string
  8. CMD string
  9. }
  10. func (s SentenceCMD) DataType() string {
  11. return CMD
  12. }
  13. func NewCMD(raw string) Sentence {
  14. Index := strings.Index(raw, ":")
  15. return SentenceCMD{
  16. CMD: raw[1:Index],
  17. Message: strings.Split(raw[Index+2:], ","),
  18. }
  19. }