PrevNextUpHome SophiaFramework UNIVERSE 5.3
SFBNetMgr
Wrapper Class for the INetMgr interface.
#include <SFBNetMgr.h.hpp>
class SFBNetMgr : public SFBNotifier;
SFMTYPEDEFWRAPPER(SFBNetMgr)

Inheritance diagram

 Inheritance diagram of SFBNetMgrClass

Version

BREW 2.0 BREW 2.1 BREW 3.1 BREW 4.0
O O O O

Reference

BREW API INetMgr

Member

Public Functions
SFCError GetDefaultNetwork( SInt32Ptr network )
Return the default data network.
SInt32 GetDefaultNetwork( Void )
Return the default data network.
Void GetHostByName( AEEDNSResult* result , ACharConstPtr domain , SFXCallbackPtr callback )
Retrieve IP addresses associated with the specified host name.
Void GetHostByName( AEEDNSResult* result , SFXAnsiStringConstRef domain , SFXCallbackPtr callback )
Retrieve IP addresses associated with the specified host name.
SFCError GetLastError( Void )
Return the last error that occurred by INetMgr interface.
INAddr GetMyIPAddr( Void )
Return the IP address of the local host or device.
SFCError GetOpt( SInt32 optName , VoidPtr value , SInt32Ptr size )
Provide the ability to query certain network options.
SFCError GetOpt( SInt32 optName , SFXBufferPtr value )
Provide the ability to query certain network options.
SFCError GetUMTSCount( UInt16Ptr count )
Return the number of Packet Data Profiles (UMTS only).
NetState NetStatus( AEENetStats* stats )
Return the current network status.
static
SFBNetMgrSmp
NewInstance( SFCErrorPtr exception = null )
Create a new SFBNetMgr instance.
static
SFBNetMgrSmp
NewInstance( AEECLSID id , SFCErrorPtr exception = null )
Create a new SFBNetMgr instance.
SInt32 OnEvent( PFNNETMGREVENT notify , VoidPtr data = null , Bool reg = true )
This function allows the caller to register to receive notification of in progress SFBNetMgr operations.
SFBSocketSmp OpenSocket( NetSocket type )
Create a socket and returns a pointer to the ISocket Interface.
SInt32 RegisterEvent( PFNNETMGREVENT notify , VoidPtr data = null )
Register the callback function.
SFCError SelectNetwork( SInt32 network )
Selects a specific data network.
UInt16 SetLinger( UInt16 secs )
Set the linger time for the network connection to the value specified by Secs, and returns the previous value.
SFCError SetOpt( SInt32 optName , VoidPtr value , SInt32 size )
Provide the ability to configure certain network options.
SFCError SetOpt( SInt32 optName , SFXBufferPtr value )
Provide the ability to configure certain network options.
SInt32 UnregisterEvent( PFNNETMGREVENT notify , VoidPtr data = null )
Unregister the callback function.
Protected Functions
static
SFBBaseSmp
FactoryByCreate( AEECLSID id , SFCErrorPtr exception = null ) (inherits from SFBBase)
Create the instance for the specified ClassID's interface.
static
SFBBaseSmp
FactoryByQuery( SFBQuerySmpConstRef query , AEECLSID id , SFCErrorPtr exception = null ) (inherits from SFBBase)
Create the instance for the specified ClassID's interface using the SFBQuery instance.

SFBNetMgr::GetDefaultNetwork
Return the default data network.
[ public ]
SFCError GetDefaultNetwork(
    SInt32Ptr network   // pointer to network
                        // will be filled in with AEE_NETWORK_*
);
[ public ]
SInt32 GetDefaultNetwork(Void);

Return value

  • If succeeds: SFERR_NO_ERROR
  • If failed: SFERR_FAILED

Version

This function is available in BREW 3.1.


SFBNetMgr::GetHostByName
Retrieve IP addresses associated with the specified host name.
[ public ]
Void GetHostByName(
    AEEDNSResult* result      // pointer to the result structure
    ACharConstPtr domain      // domain name to be resolved, terminated by a colon (:),slash (/), or null (\0) character
    SFXCallbackPtr callback   // pointer to the callback
);
[ public ]
Void GetHostByName(
    AEEDNSResult* result           // pointer to the result structure
    SFXAnsiStringConstRef domain   // domain name to be resolved, terminated by a colon (:),slash (/), or null (\0) character
    SFXCallbackPtr callback        // pointer to the callback
);

Reference

BREW API INETMGR_GetHostByName | AEEDNSResult | SFXCallback


SFBNetMgr::GetLastError
Return the last error that occurred by INetMgr interface.
[ public ]
SFCError GetLastError(Void);

Reference

BREW API INETMGR_GetLastError


SFBNetMgr::GetMyIPAddr
Return the IP address of the local host or device.
[ public ]
INAddr GetMyIPAddr(Void);

Reference

BREW API INETMGR_GetMyIPAddr


SFBNetMgr::GetOpt
Provide the ability to query certain network options.
[ public ]
SFCError GetOpt(
    SInt32 optName   // integer identifying which option to get 
    VoidPtr value    // filled with option-specific data 
    SInt32Ptr size   // if pOptVal is non-null, on input specifies size of pOptVal, 
                     // which must match the required size of the option data. 
                     // if pOptVal is null, on input is ignored, on output holds the required size of the option data
);
[ public ]
SFCError GetOpt(
    SInt32 optName       // integer identifying which option to get 
    SFXBufferPtr value   // buffer filled with option-specific data, size can be automatically modified
);

Reference

BREW API INETMGR_GetOpt | SFBNetMgr::SetOpt


SFBNetMgr::GetUMTSCount
Return the number of Packet Data Profiles (UMTS only).
[ public ]
SFCError GetUMTSCount(
    UInt16Ptr count   // filled in with the PDP count
);

Return value

  • If succeeds: SFERR_NO_ERROR
  • If failed: SFERR_FAILED
  • The network is not valid : AEE_NET_EINVAL

Version

This function is available in BREW 3.1.


SFBNetMgr::NetStatus
Return the current network status.
[ public ]
NetState NetStatus(
    AEENetStats* stats   // pointer to the block to be filled with statistical data
);

Example

Get the current network status, show it in log.

NetState      state;
AEENetStats   stats;

// create SFBNetMgr interface.
SFBNetMgrSmp    netmgr = SFBNetMgr::NewInstance();

// get the current network status.
state = netmgr->NetStatus(&stats);

// show the status in log.
switch (state) {
case NET_INVALID_STATE:
    DBGPRINTF ("*** Status: Invalid ***");
    break;

case NET_PPP_OPENING:
    DBGPRINTF ("*** Status: Opening ***");
    break;

case NET_PPP_OPEN:
    DBGPRINTF ("*** Status: Open ***");
    break;

case NET_PPP_CLOSING:
    DBGPRINTF ("*** Status: Closing ***");
    break;

case NET_PPP_CLOSED:
    DBGPRINTF ("*** Status: Closed ***");
    break;

case NET_PPP_SLEEPING:
    DBGPRINTF ("*** Status: Sleeping ***");
    break;

case NET_PPP_ASLEEP:
    DBGPRINTF ("*** Status: ASleep ***");
    break;

case NET_PPP_WAKING:
    DBGPRINTF ("*** Status: Waking ***");
    break;
}

Reference

BREW API INETMGR_NetStatus | AEENetStats | NetState


SFBNetMgr::NewInstance
Create a new SFBNetMgr instance.
[ public, static ]
SFBNetMgrSmp NewInstance(
    SFCErrorPtr exception = null   // Error
);
[ public, static ]
SFBNetMgrSmp NewInstance(
    AEECLSID id                    // Class ID
    SFCErrorPtr exception = null   // Error
);

SFBNetMgr::OnEvent
This function allows the caller to register to receive notification of in progress SFBNetMgr operations.
[ public ]
SInt32 OnEvent(
    PFNNETMGREVENT notify   // user-specified callback to call when event occurs
    VoidPtr data = null     // user-specified context data passed as first argument to callback
    Bool reg = true         // true, if registering, false if deregistering
);

Reference

BREW API INETMGR_OnEvent | PFNNETMGREVENT


SFBNetMgr::OpenSocket
Create a socket and returns a pointer to the ISocket Interface.
[ public ]
SFBSocketSmp OpenSocket(
    NetSocket type   // specifies the socket type: AEE_SOCK_STREAM for TCP 
                     // AEE_SOCK_DGRAM for UDP Corresponding to stream or datagram sockets respectively 
        
);

Reference

BREW API INETMGR_OpenSocket | NetSocket


SFBNetMgr::RegisterEvent
Register the callback function.
[ public ]
SInt32 RegisterEvent(
    PFNNETMGREVENT notify   // user-specified callback to call when event occurs
    VoidPtr data = null     // user-specified context data passed as first argument to callback
);

Description

Calling this function is as same as calling SFBNetMgr::OnEvent( pfn , pUser , true )

Reference

SFBNetMgr::OnEvent | SFBNetMgr::UnregisterEvent


SFBNetMgr::SelectNetwork
Selects a specific data network.
[ public ]
SFCError SelectNetwork(
    SInt32 network   // data network
);

Return value

  • If succeeds: SFERR_NO_ERROR
  • If failed: SFERR_FAILED
  • The network is not valid : AEE_NET_EINVAL
  • The network has already been selected : AEE_NET_EOPNOTSUPP

Version

This function is available in BREW 3.1.


SFBNetMgr::SetLinger
Set the linger time for the network connection to the value specified by Secs, and returns the previous value.
[ public ]
UInt16 SetLinger(
    UInt16 secs   // linger time in seconds
);

Example

Set the linger time for the network.

// create the SFBNetMgr interface.
SFBNetMgrSmp    netmgr = SFBNetMgr::NewInstance();

// set 5 seconds linger time for the network.
netmgr->SetLinger(5);

Reference

BREW API INETMGR_SetLinger |


SFBNetMgr::SetOpt
Provide the ability to configure certain network options.
[ public ]
SFCError SetOpt(
    SInt32 optName   // integer identifying which option to set
    VoidPtr value    // filled with option-specific data
    SInt32 size      // size of value
);
[ public ]
SFCError SetOpt(
    SInt32 optName       // integer identifying which option to set
    SFXBufferPtr value   // filled with option-specific data
                         // if null, do nothing and return SFERR_INVALID_PARAM
);

Reference

BREW API INETMGR_SetOpt | SFBNetMgr::GetOpt


SFBNetMgr::UnregisterEvent
Unregister the callback function.
[ public ]
SInt32 UnregisterEvent(
    PFNNETMGREVENT notify   // callback function to unregister
    VoidPtr data = null     // user-specified context data passed as first argument to callback
);

Description

Calling this function is as same as calling SFBNetMgr::OnEvent( pfn , pUser , false )

Reference

SFBNetMgr::OnEvent | SFBNetMgr::RegisterEvent