platforms/bebop/client: fix type for binary.Write call
binary.Write only takes fixed-width types, of which 'bool' is not one. Add a helper and turn those into int8s instead.
This commit is contained in:
parent
67ff7da9e3
commit
f131a82e69
|
@ -618,7 +618,7 @@ func (b *Bebop) HullProtection(protect bool) error {
|
|||
cmd.Write(tmp.Bytes())
|
||||
|
||||
tmp = &bytes.Buffer{}
|
||||
binary.Write(tmp, binary.LittleEndian, bool(protect))
|
||||
binary.Write(tmp, binary.LittleEndian, bool2int8(protect))
|
||||
cmd.Write(tmp.Bytes())
|
||||
|
||||
_, err := b.write(b.networkFrameGenerator(cmd, ARNETWORKAL_FRAME_TYPE_DATA, BD_NET_CD_NONACK_ID).Bytes())
|
||||
|
@ -644,13 +644,20 @@ func (b *Bebop) Outdoor(outdoor bool) error {
|
|||
cmd.Write(tmp.Bytes())
|
||||
|
||||
tmp = &bytes.Buffer{}
|
||||
binary.Write(tmp, binary.LittleEndian, bool(outdoor))
|
||||
binary.Write(tmp, binary.LittleEndian, bool2int8(outdoor))
|
||||
cmd.Write(tmp.Bytes())
|
||||
|
||||
_, err := b.write(b.networkFrameGenerator(cmd, ARNETWORKAL_FRAME_TYPE_DATA, BD_NET_CD_NONACK_ID).Bytes())
|
||||
return err
|
||||
}
|
||||
|
||||
func bool2int8(b bool) int8 {
|
||||
if b {
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (b *Bebop) createARStreamACK(frame ARStreamFrame) *bytes.Buffer {
|
||||
//
|
||||
// ARSTREAM_NetworkHeaders_AckPacket_t;
|
||||
|
|
Loading…
Reference in New Issue