aboutsummaryrefslogtreecommitdiffhomepage
path: root/pyfantom.py
diff options
context:
space:
mode:
authorTat-Chee Wan (USM)2011-06-02 09:34:13 +0800
committerTat-Chee Wan (USM)2011-06-02 09:34:13 +0800
commitf692b54b96e1f5480973a968a15a145f5a531881 (patch)
treea941de3197741dbf45ab872f307ba9d160455541 /pyfantom.py
parent029f71003d518ca3b7cfe3a491db787dd846bce0 (diff)
force returned strings to uppercase for consistency
Diffstat (limited to 'pyfantom.py')
-rw-r--r--pyfantom.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/pyfantom.py b/pyfantom.py
index 038ffed..86171cd 100644
--- a/pyfantom.py
+++ b/pyfantom.py
@@ -275,7 +275,8 @@ class NXTIterator:
name = ctypes.create_string_buffer(256)
dll.nFANTOM100_iNXTIterator_getName(self.handle, name, cast(byref(status), POINTER(c_int)))
Status.check(status)
- return name.value
+ name = name.value
+ return name.upper()
get_resource_string = get_name
@@ -418,10 +419,12 @@ class NXT:
dll.nFANTOM100_iNXT_getDeviceInfo(self.handle, name,
bluetooth_address, signal_strength, byref(available_flash),
cast(byref(status), POINTER(c_int)))
+ name = name.value
+ bluetooth_address = ':'.join('%02x' % c
+ for c in bluetooth_address[0:6])
return self.DeviceInfo(
- name = name.value,
- bluetooth_address = ':'.join('%02x' % c
- for c in bluetooth_address[0:6]),
+ name = name.upper(),
+ bluetooth_address = bluetooth_address.upper(),
signal_strength = tuple(c for c in signal_strength),
available_flash = available_flash.value,
)
@@ -433,7 +436,8 @@ class NXT:
dll.nFANTOM100_iNXT_getResourceString(self.handle, name,
cast(byref(status), POINTER(c_int)))
Status.check(status)
- return name.value
+ name = name.value
+ return name.upper()
def close(self):
if self.debug:
@@ -451,7 +455,8 @@ class NXT:
status = StatusVar(0)
dll.nFANTOM100_pairBluetooth(resource, btpin, paired_name, cast(byref(status), POINTER(c_int)))
Status.check(status)
- return paired_name.value
+ paired_name = paired_name.value
+ return paired_name.upper()
def unpair_bluetooth(self, resource):
status = StatusVar(0)