[tuxdroid-svn] r5331 - in software_suite_v3/smart-core/smart-server/trunk/util: . wifi
Status: Beta
Brought to you by:
ks156
|
From: remi <c2m...@c2...> - 2009-09-04 11:45:38
|
Author: remi Date: 2009-09-04 13:45:26 +0200 (Fri, 04 Sep 2009) New Revision: 5331 Added: software_suite_v3/smart-core/smart-server/trunk/util/wifi/ software_suite_v3/smart-core/smart-server/trunk/util/wifi/TuxWifiChannel.py software_suite_v3/smart-core/smart-server/trunk/util/wifi/__init__.py software_suite_v3/smart-core/smart-server/trunk/util/wifi/libtuxwifichannel.dll Log: * Added wrapper to libtuxwifichannel library Added: software_suite_v3/smart-core/smart-server/trunk/util/wifi/TuxWifiChannel.py =================================================================== --- software_suite_v3/smart-core/smart-server/trunk/util/wifi/TuxWifiChannel.py (rev 0) +++ software_suite_v3/smart-core/smart-server/trunk/util/wifi/TuxWifiChannel.py 2009-09-04 11:45:26 UTC (rev 5331) @@ -0,0 +1,56 @@ +# Copyright (C) 2009 KYSOH Sa +# Remi Jocaille <rem...@ky...> +# Distributed under the terms of the GNU General Public License +# http://www.gnu.org/copyleft/gpl.html + +from ctypes import * +import os + +# ============================================================================== +# Public class +# ============================================================================== + +# ------------------------------------------------------------------------------ +# libtuxwifichannel wrapper class. +# ------------------------------------------------------------------------------ +class TuxWifiChannel(object): + """libtuxwifichannel wrapper class. + """ + + # -------------------------------------------------------------------------- + # Constructor. + # -------------------------------------------------------------------------- + def __init__(self, library_path = None): + """Constructor. + @param library_path: Path of libtuxwifichannel library. (Default None) + """ + if library_path == None: + mPath, mFile = os.path.split(__file__) + if os.name == 'nt': + library_path = os.path.join(mPath, "libtuxwifichannel.dll") + else: + library_path = os.path.join(mPath, "libtuxwifichannel.so") + self.tux_wifi_channel_lib = None + if os.path.isfile(library_path): + try: + self.tux_wifi_channel_lib = CDLL(library_path) + except: + self.tux_wifi_channel_lib = None + + # -------------------------------------------------------------------------- + # Get the currently used wifi channel. + # -------------------------------------------------------------------------- + def getCurrent(self, priorSSID = ""): + """Get the currently used wifi channel. + @param priorSSID: Network SSID to search in prior. + @return: An integer or None. + """ + if self.tux_wifi_channel_lib == None: + return None + try: + channel = self.tux_wifi_channel_lib.get_wifi_channel(c_char_p(priorSSID)) + if channel == -1: + channel = None + except: + channel = None + return channel Added: software_suite_v3/smart-core/smart-server/trunk/util/wifi/__init__.py =================================================================== Added: software_suite_v3/smart-core/smart-server/trunk/util/wifi/libtuxwifichannel.dll =================================================================== (Binary files differ) Property changes on: software_suite_v3/smart-core/smart-server/trunk/util/wifi/libtuxwifichannel.dll ___________________________________________________________________ Name: svn:mime-type + application/octet-stream |