AppendMHDR appends encoded msg to dst.
(dst []byte, msg *ttnpb.MHDR)
| 26 | |
| 27 | // AppendMHDR appends encoded msg to dst. |
| 28 | func AppendMHDR(dst []byte, msg *ttnpb.MHDR) ([]byte, error) { |
| 29 | if msg.GetMType() > 7 { |
| 30 | return nil, errExpectedLowerOrEqual("MType", 7)(msg.GetMType()) |
| 31 | } |
| 32 | if msg.GetMajor() > 4 { |
| 33 | return nil, errExpectedLowerOrEqual("Major", 4)(msg.GetMajor()) |
| 34 | } |
| 35 | return append(dst, byte(msg.GetMType())<<5|byte(msg.GetMajor())), nil |
| 36 | } |
| 37 | |
| 38 | // MarshalMHDR returns encoded msg. |
| 39 | func MarshalMHDR(msg *ttnpb.MHDR) ([]byte, error) { |
no test coverage detected