diff --git a/pdu/submit.go b/pdu/submit.go index b7b8775..4ec139d 100644 --- a/pdu/submit.go +++ b/pdu/submit.go @@ -5,6 +5,7 @@ import ( "encoding/ascii85" "encoding/binary" "fmt" + "log" "github.com/warthog618/sms/encoding/gsm7" ) @@ -71,14 +72,23 @@ func (p *SUBMIT_SM) Encode(buf *bytes.Buffer) error { if buf == nil { return fmt.Errorf("cannot encode into nil buffer") } + // This won't do... + // TODO: Implement your own encoders and shit + // ASCII is easy + // UCS2 should also be fairly easy, use uint16 or something + // GSM7 will not be easy + // See https://www.codeproject.com/Tips/470755/Encoding-Decoding-7-bit-User-Data-for-SMS-PDU-PDU asciiEncoder := ascii85.NewEncoder(buf) // TODO: Implement encodings bsed on p.data_coding messageEncoder := gsm7.NewEncoder() p.header.Encode(buf) - asciiEncoder.Write([]byte(p.service_type)) - buf.Write(NULL_ARR) - asciiEncoder.Write([]byte(p.service_type)) + n, err := asciiEncoder.Write([]byte("OOO")) + if err != nil { + return err + } + log.Println(n) + // asciiEncoder.Write([]byte(p.service_type)) buf.Write(NULL_ARR) binary.Write(buf, binary.BigEndian, p.source_addr_ton) binary.Write(buf, binary.BigEndian, p.source_addr_npi)