Example #1
0
File: device.go Project: harikb/nfc
// Set a device's boolean-property value. Returns nil on success, otherwise an
// error. See integer constants in this package for possible properties.
func (d Device) SetPropertyBool(property int, value bool) error {
	if *d.d == nil {
		return errors.New("device closed")
	}

	err := C.nfc_device_set_property_bool(*d.d, C.nfc_property(property), C.bool(value))

	if err != 0 {
		return Error(err)
	}

	return nil
}
Example #2
0
File: device.go Project: harikb/nfc
// Set a device's integer-property value. Returns nil on success, otherwise an
// error. See integer constants in this package for possible properties.
func (d Device) SetPropertyInt(property, value int) error {
	if *d.d == nil {
		return errors.New("device closed")
	}

	err := C.nfc_device_set_property_int(*d.d, C.nfc_property(property), C.int(value))

	if err != 0 {
		return Error(err)
	}

	return nil
}