Sad update
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
|||||||
"encoding/ascii85"
|
"encoding/ascii85"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log"
|
||||||
|
|
||||||
"github.com/warthog618/sms/encoding/gsm7"
|
"github.com/warthog618/sms/encoding/gsm7"
|
||||||
)
|
)
|
||||||
@@ -71,14 +72,23 @@ func (p *SUBMIT_SM) Encode(buf *bytes.Buffer) error {
|
|||||||
if buf == nil {
|
if buf == nil {
|
||||||
return fmt.Errorf("cannot encode into nil buffer")
|
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)
|
asciiEncoder := ascii85.NewEncoder(buf)
|
||||||
// TODO: Implement encodings bsed on p.data_coding
|
// TODO: Implement encodings bsed on p.data_coding
|
||||||
messageEncoder := gsm7.NewEncoder()
|
messageEncoder := gsm7.NewEncoder()
|
||||||
|
|
||||||
p.header.Encode(buf)
|
p.header.Encode(buf)
|
||||||
asciiEncoder.Write([]byte(p.service_type))
|
n, err := asciiEncoder.Write([]byte("OOO"))
|
||||||
buf.Write(NULL_ARR)
|
if err != nil {
|
||||||
asciiEncoder.Write([]byte(p.service_type))
|
return err
|
||||||
|
}
|
||||||
|
log.Println(n)
|
||||||
|
// asciiEncoder.Write([]byte(p.service_type))
|
||||||
buf.Write(NULL_ARR)
|
buf.Write(NULL_ARR)
|
||||||
binary.Write(buf, binary.BigEndian, p.source_addr_ton)
|
binary.Write(buf, binary.BigEndian, p.source_addr_ton)
|
||||||
binary.Write(buf, binary.BigEndian, p.source_addr_npi)
|
binary.Write(buf, binary.BigEndian, p.source_addr_npi)
|
||||||
|
Reference in New Issue
Block a user