// Wraps LookupName() to provide a Python method interface. // Arguments: // - address of the device to look up. Note that the address // is expected without colons!! e.g. "000D9319C868" // - True/False - if True, performs a remote name request even if the device // name is known in the cache from a previous request. // // Returns the name (a Python unicode string). static PyObject* LightBlue_LookupName(PyObject* self, PyObject* args) { const char *addr; bool ignoreCache; if (!PyArg_ParseTuple(args, "sb", &addr, &ignoreCache)) return NULL; THostName deviceName; TBTDevAddr wantedAddr; TBuf16<128> buf; buf.Copy(_L8(addr)); wantedAddr.SetReadable(buf); TInt err = LookupName(wantedAddr, &deviceName, ignoreCache); if (err) return SPyErr_SetFromSymbianOSErr(err); return Py_BuildValue("u#", deviceName.Ptr(), deviceName.Length()); }