sim-modem/api/modem/at/response.go

26 lines
460 B
Go
Raw Permalink Normal View History

2024-07-23 09:22:53 +00:00
package at
type Resp string
const RespNil = Resp("")
func (resp Resp) Check() bool {
return len(resp) >= 2 && resp[len(resp)-2:] == "OK"
}
func (resp Resp) RmFront(str string) Resp {
return Resp(string(resp)[len(str):])
}
2024-08-09 08:21:02 +00:00
func (resp Resp) CheckFront(str string) bool {
return len(resp) >= len(str) && resp[:len(str)].String() == str
}
2024-07-23 14:26:24 +00:00
func (resp Resp) String() string {
2024-07-23 09:22:53 +00:00
return string(resp)
}
2024-07-28 18:01:18 +00:00
func (resp Resp) Bytes() []byte {
return []byte(resp)
}