Class: Wx::DialUpManager
- Inherits:
-
Object
- Object
- Wx::DialUpManager
- Defined in:
- lib/wx/doc/gen/dial_up_manager.rb
Overview
This class is untracked and should not be derived from nor instances extended!
This class encapsulates functions dealing with verifying the connection status of the workstation (connected to the Internet via a direct connection, connected through a modem or not connected at all) and to establish this connection if possible/required (i.e.
in the case of the modem). The program may also wish to be notified about the change in the connection status (for example, to perform some action when the user connects to the network the next time or, on the contrary, to stop receiving data from the net when the user hangs up the modem). For this, you need to use one of the event macros described below. This class is different from other wxWidgets classes in that there is at most one instance of this class in the program accessed via DialUpManager.create and you can’t create the objects of this class directly.
Events emitted by this class
The following event-handler methods redirect the events to member method or handler blocks for DialUpEvent events. Event handler methods for events emitted by this class:
-
EvtHandler#evt_dialup_connected(meth = nil, &block): A connection with the network was established.
-
EvtHandler#evt_dialup_disconnected(meth = nil, &block): The connection with the network was lost.
Category: Networking
Class Method Summary collapse
-
.create ⇒ Wx::DialUpManager
This function should create and return the object of the platform-specific class derived from DialUpManager.
Instance Method Summary collapse
-
#cancel_dialing ⇒ Boolean
Cancel dialing the number initiated with #dial with async parameter equal to true.
-
#dial(nameOfISP = (''), username = (''), password = (''), async = true) ⇒ Boolean
Dial the given ISP, use username and password to authenticate.
-
#disable_auto_check_online_status ⇒ void
Disable automatic check for connection status change - notice that the EVT_DIALUP_XXX events won’t be sent any more either.
-
#enable_auto_check_online_status(nSeconds = 60) ⇒ Boolean
Enable automatic checks for the connection status and sending of
wxEVT_DIALUP_CONNECTED/wxEVT_DIALUP_DISCONNECTED
events. -
#get_isp_names ⇒ Array<String>
(also: #isp_names)
This function is only implemented under Windows.
-
#hang_up ⇒ Boolean
Hang up the currently active dial up connection.
-
#is_always_online ⇒ Boolean
(also: #always_online?)
Returns true if the computer has a permanent network connection (i.e.
-
#is_dialing ⇒ Boolean
(also: #dialing?)
Returns true if (async) dialing is in progress.
-
#is_ok ⇒ Boolean
(also: #ok?)
Returns true if the dialup manager was initialized correctly.
-
#is_online ⇒ Boolean
(also: #online?)
Returns true if the computer is connected to the network: under Windows, this just means that a RAS connection exists, under Unix we check that the “well-known host” (as specified by #set_well_known_host) is reachable.
-
#set_connect_command(commandDial = ("/USR/BIN/PON"), commandHangup = ("/USR/BIN/POFF")) ⇒ void
(also: #connect_command=)
This method is for Unix only.
-
#set_online_status(isOnline = true) ⇒ void
(also: #online_status=)
Sometimes the built-in logic for determining the online status may fail, so, in general, the user should be allowed to override it.
-
#set_well_known_host(hostname, portno = 80) ⇒ void
(also: #well_known_host=)
This method is for Unix only.
Class Method Details
.create ⇒ Wx::DialUpManager
This function should create and return the object of the platform-specific class derived from Wx::DialUpManager.
You should delete the pointer when you are done with it.
144 |
# File 'lib/wx/doc/gen/dial_up_manager.rb', line 144 def self.create; end |
Instance Method Details
#cancel_dialing ⇒ Boolean
Cancel dialing the number initiated with #dial with async parameter equal to true.
This won't result in a DISCONNECTED event being sent.
42 |
# File 'lib/wx/doc/gen/dial_up_manager.rb', line 42 def cancel_dialing; end |
#dial(nameOfISP = (''), username = (''), password = (''), async = true) ⇒ Boolean
Dial the given ISP, use username and password to authenticate.
The parameters are only used under Windows currently, for Unix you should use #set_connect_command to customize this functions behaviour. If no nameOfISP is given, the function will select the default one (proposing the user to choose among all connections defined on this machine) and if no username and/or password are given, the function will try to do without them, but will ask the user if really needed. If async parameter is false, the function waits until the end of dialing and returns true upon successful completion. If async is true, the function only initiates the connection and returns immediately - the result is reported via events (an event is sent anyhow, but if dialing failed it will be a DISCONNECTED one).
55 |
# File 'lib/wx/doc/gen/dial_up_manager.rb', line 55 def dial(nameOfISP=(''), username=(''), password=(''), async=true) end |
#disable_auto_check_online_status ⇒ void
This method returns an undefined value.
Disable automatic check for connection status change - notice that the EVT_DIALUP_XXX events won’t be sent any more either.
59 |
# File 'lib/wx/doc/gen/dial_up_manager.rb', line 59 def disable_auto_check_online_status; end |
#enable_auto_check_online_status(nSeconds = 60) ⇒ Boolean
Enable automatic checks for the connection status and sending of wxEVT_DIALUP_CONNECTED/wxEVT_DIALUP_DISCONNECTED
events.
The interval parameter is only for Unix where we do the check manually and specifies how often should we repeat the check (each minute by default). Under Windows, the notification about the change of connection status is sent by the system and so we don’t do any polling and this parameter is ignored. false if couldn’t set up automatic check for online status.
67 |
# File 'lib/wx/doc/gen/dial_up_manager.rb', line 67 def enable_auto_check_online_status(nSeconds=60) end |
#get_isp_names ⇒ Array<String> Also known as: isp_names
This function is only implemented under Windows.
Fills the array with the names of all possible values for the first parameter to #dial on this machine and returns their number (may be 0).
73 |
# File 'lib/wx/doc/gen/dial_up_manager.rb', line 73 def get_isp_names; end |
#hang_up ⇒ Boolean
Hang up the currently active dial up connection.
78 |
# File 'lib/wx/doc/gen/dial_up_manager.rb', line 78 def hang_up; end |
#is_always_online ⇒ Boolean Also known as: always_online?
Returns true if the computer has a permanent network connection (i.e.
\ is on a LAN) and so there is no need to use #dial function to go online.
This function tries to guess the result and it is not always guaranteed to be correct, so it is better to ask user for confirmation or give him a possibility to override it.
90 |
# File 'lib/wx/doc/gen/dial_up_manager.rb', line 90 def is_always_online; end |
#is_dialing ⇒ Boolean Also known as: dialing?
Returns true if (async) dialing is in progress.
98 |
# File 'lib/wx/doc/gen/dial_up_manager.rb', line 98 def is_dialing; end |
#is_ok ⇒ Boolean Also known as: ok?
Returns true if the dialup manager was initialized correctly.
If this function returns false, no other functions will work either, so it is a good idea to call this function and check its result before calling any other Wx::DialUpManager methods.
105 |
# File 'lib/wx/doc/gen/dial_up_manager.rb', line 105 def is_ok; end |
#is_online ⇒ Boolean Also known as: online?
Returns true if the computer is connected to the network: under Windows, this just means that a RAS connection exists, under Unix we check that the “well-known host” (as specified by #set_well_known_host) is reachable.
110 |
# File 'lib/wx/doc/gen/dial_up_manager.rb', line 110 def is_online; end |
#set_connect_command(commandDial = ("/USR/BIN/PON"), commandHangup = ("/USR/BIN/POFF")) ⇒ void Also known as: connect_command=
This method returns an undefined value.
This method is for Unix only.
Sets the commands to start up the network and to hang up again.
119 |
# File 'lib/wx/doc/gen/dial_up_manager.rb', line 119 def set_connect_command(commandDial=("/USR/BIN/PON"), commandHangup=("/USR/BIN/POFF")) end |
#set_online_status(isOnline = true) ⇒ void Also known as: online_status=
This method returns an undefined value.
Sometimes the built-in logic for determining the online status may fail, so, in general, the user should be allowed to override it.
This function allows forcefully setting the online status - whatever our internal algorithm may think about it.
128 |
# File 'lib/wx/doc/gen/dial_up_manager.rb', line 128 def set_online_status(isOnline=true) end |
#set_well_known_host(hostname, portno = 80) ⇒ void Also known as: well_known_host=
This method returns an undefined value.
This method is for Unix only.
Under Unix, the value of well-known host is used to check whether we’re connected to the internet. It is unused under Windows, but this function is always safe to call. The default value is "www.yahoo.com:80"
.
137 |
# File 'lib/wx/doc/gen/dial_up_manager.rb', line 137 def set_well_known_host(hostname, portno=80) end |