Esempio n. 1
0
//
// Get the list of ICS connections
//
void
CIcsManager::GetIcsConnections(
    CRefObjList<CIcsConnectionInfo *> & ConnectionList
    )
{
    // remove all old entries
    ConnectionList.RemoveAllEntries();

    // add connections
    _ASSERT(m_pList);

    for (long i = 0; i < m_lNumConns; i++)
    {
        CIcsConnectionInfo * pConnInfo = nullptr;

        pConnInfo = new(std::nothrow) CIcsConnectionInfo(m_pList[i]);

        if (nullptr == pConnInfo)
        {
            break;
        }

        ConnectionList.AddTail(pConnInfo);
    }
}
VOID 
CWlanManager::OnHostedNetworkStopped()
{
    CHostedNetworkNotificationSink * pSink = NULL;
    CRefObjList<CWlanStation *> stationList;

    Lock();

    // Save all stations that haven't left the network
    while ( 0 != m_StationList.GetCount() )
    {
        CWlanStation* pStation = m_StationList.RemoveHead();

        stationList.AddTail(pStation);
    }

    m_HostedNetworkState = wlan_hosted_network_idle;
    pSink = GetNotificationSink();

    Unlock();

    if (pSink != NULL)
    {
        //
        // Notify client
        //

        // notify station leave
        while ( 0 != stationList.GetCount() )
        {
            CWlanStation* pStation = stationList.RemoveHead();

            pSink->OnStationLeave(pStation);

            pStation->Release();

            pStation = NULL;
        }

        pSink->OnHostedNetworkStopped();

        _ASSERT(m_CallbackComplete != NULL);

        //
        // Signal callback complete
        //
        SetEvent(m_CallbackComplete);
    }
}
HRESULT 
CWlanManager::GetStaionList(
    CRefObjList<CWlanStation*>& StationList
    )
{
    HRESULT hr = S_OK;

    Lock();

    if (!m_Initialized)
    {
        BAIL_ON_WIN32_ERROR(ERROR_INVALID_STATE, hr);
    }

    if (m_HostedNetworkState != wlan_hosted_network_active)
    {
        BAIL_ON_WIN32_ERROR(ERROR_INVALID_STATE, hr);
    }

    //
    // Remove old entries
    //
    StationList.RemoveAllEntries();

    //
    // Copy all the stations to the list
    //
    for (size_t i = 0; i < m_StationList.GetCount(); i++)
    {
        CWlanStation* pStation = m_StationList.GetAt(m_StationList.FindIndex(i));
        _ASSERT(pStation != NULL);

        pStation->AddRef();
        StationList.AddTail(pStation);
    }

error:
    Unlock();

    return hr;
}