X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=pcremote-server-desktop%2Fdebian%2Fpcremote-server%2Fusr%2Fshare%2Fpcremote-server%2Fconnection%2Ficonnection.py;fp=pcremote-server-desktop%2Fdebian%2Fpcremote-server%2Fusr%2Fshare%2Fpcremote-server%2Fconnection%2Ficonnection.py;h=0000000000000000000000000000000000000000;hb=e164265008086869be2d718f635900a9bf38b7dd;hp=310d175095902c9003c67b5440342085fc39f3eb;hpb=3885148cece97c7cd7e9e4aaa1cb51f341e53f6c;p=remotepc diff --git a/pcremote-server-desktop/debian/pcremote-server/usr/share/pcremote-server/connection/iconnection.py b/pcremote-server-desktop/debian/pcremote-server/usr/share/pcremote-server/connection/iconnection.py deleted file mode 100755 index 310d175..0000000 --- a/pcremote-server-desktop/debian/pcremote-server/usr/share/pcremote-server/connection/iconnection.py +++ /dev/null @@ -1,167 +0,0 @@ -# -*- coding: utf-8 -*- - -# **************************************************************************** -# Copyright (c) 2008 INdT/Fucapi. -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with this program. If not, see . -# -# ============================================================================ -# Project Name : PC Remote -# Author : André Portela -# Email : andre_portela_@hotmail.com -# Reviewer : Jônatas Isvi -# Email : jonatas.nona@gmail.com -# Version : 1.0 -# Package : connection -# Description : Iconnection Interface Class -# ============================================================================ - -from wirelessconnectionmanager import * -from bluetoothconnectionmanager import * -from exceptions import * - -# connections aliases -_btconst = ['bluetooth', 'BLUETOOTH', 'blue'] -_wificonst = ['wireless', 'WIRELESS', 'wifi'] - -class Iconnection: - - """ Iconnection - Interface for wireless and bluetooth connections. - Manages all commonalities operations between entities. - """ - def __init__(self, string): - self.string = string - if(self.string in _btconst): - self.obj = BluetoothConnectionManager() - elif(self.string in _wificonst): - self.obj = WirelessConnectionManager() - else: - raise IconnectionError, "Undefined type." - - - # +---------------------------------------------+ - # | Generic methods -> Wireless and Bluetooth | - # +---------------------------------------------+ - - # create a socket with defined protocol - def create_socket(self, protocol=None): - self.obj.create_socket(protocol) - - # connect device - def connect(self): - self.obj.connect() - - # accept the connection - def accept(self): - return self.obj.accept() - - # send a message to device - def send_message(self, msg=None): - self.obj.send_message(msg) - - # received a message - def received_message(self): - return self.obj.received_message() - - # bind the connection - def bind(self): - self.obj.bind() - - # listen the connection - def listen(self): - self.obj.listen() - - # close connection - def close(self): - self.obj.close() - - # set the port to communicate - def set_port(self, port): - self.obj.set_port(port) - - # get the port to communicate - def get_port(self): - return self.obj.get_port() - - # set the device address - def set_address(self, address): - self.obj.set_address(address) - - # get the device address - def get_address(self): - return self.obj.get_address() - - # get the client address - def get_client_address(self): - return self.obj.get_client_address() - - # +------------------------------------------+ - # | Bluetooth: particular behaviors | - # +------------------------------------------+ - - # fast way to create a simple server - def bluetooth_create_server(self, protocol, port): - if self.string in _btconst: - return self.obj.create_server(protocol, port) - else: - raise IconnectionError, "Only method used by Bluetooth connections." - - # fast way to create a simple client - def bluetooth_create_client(self, protocol, address, port): - if self.string in _btconst: - return self.obj.create_client(protocol, address, port) - else: - raise IconnectionError, "Only method used by Bluetooth connections." - - # search for all devices - def bluetooth_find_devices(self, time=8): - if self.string in _btconst: - return self.obj.find_devices(time) - else: - raise IconnectionError, "Only method used by Bluetooth connections." - - # search only devices names - def bluetooth_find_devices_only_names(self): - if self.string in _btconst: - return self.obj.find_devices_only_names() - else: - raise IconnectionError, "Only method used by Bluetooth connections." - - # search the device port - def bluetooth_find_port(self, addr): - if self.string in _btconst: - return self.obj.find_port(addr) - else: - raise IconnectionError, "Only method used by Bluetooth connections." - - # search device services - def bluetooth_find_services(self, service=None, addr=None): - if self.string in _btconst: - return self.obj.find_services(service, addr) - else: - raise IconnectionError, "Only method used by Bluetooth connections." - - - # search the device indicated by name - def bluetooth_find_device_address_by_name(self, device_name=None): - if self.string in _btconst: - return self.obj.find_device_address_by_name(device_name) - else: - raise IconnectionError, "Only method used by Bluetooth connections." - - - - # +---------------------------------+ - # | Wireless: particular behaviors | - # +---------------------------------+