Esempio n. 1
0
File: fap.go Progetto: masone/ogn
// MicEMbitsToMessage converts mic-e message bits (three numbers 0-2)
// to a textual message.
func MicEMbitsToMessage(mbits string) string {
	if mbits == "" {
		log.Fatal("MicEMbitsToMessage() called with empty string")
	}

	buffer := C.new_c_str(60)
	defer C.free(unsafe.Pointer(buffer))

	C.fap_mice_mbits_to_message(C.CString(mbits), buffer)

	return C.GoString(buffer)
}
Esempio n. 2
0
File: fap.go Progetto: masone/ogn
func (c *fap_packet_t) error() error {
	if c.error_code == nil {
		return nil
	}

	buffer := C.new_c_str(64)
	defer C.free(unsafe.Pointer(buffer))

	C.fap_explain_error(*c.error_code, buffer)

	return errors.New(C.GoString(buffer))
}