Answered Wi-Fi Settings

  • dinsdag 7 september 2010 10:46
     
     

    Hi I am trying to configure(set) wi-fi settings in a windows mobile device using CSP:-

     

    here is the XML:

     

    LPCWSTR G_WifiXml=

    L"<wap-provisioningdoc>"

    L"<characteristic type=\"Wi-Fi\">"

        L"<characteristic type=\"access-point\">"

            L"<characteristic type=\"brink\">"

                L"<parm name=\"DestId\" value=\"{436EF144-B4FB-4863-A041-8F905A62C572}\"/>"

                L"<parm name=\"Encryption\" value=\"0\"/>"

                L"<parm name=\"Authentication\" value=\"0\"/>"

                L"<parm name=\"EAPType\" value=\"0\"/>"

       L"<parm name=\"hidden\" value=\"1\"/>"

       L"<parm name=\"KeyProvided\" value=\"0\"/>"

                L"<parm name=\"NetworkKey\" value=\"12345678\"/>"

                L"<parm name=\"KeyIndex\" value=\"1\"/>"

               L"<parm name=\"Use8021x\" value=\"0\"/>"

            L"</characteristic>"

        L"</characteristic>"

    L"</characteristic>"

    L"</wap-provisioningdoc>";

     

    i am using an API for that: DMProcessConfigXML but it is giving characteristic-error type at L"<characteristic type=\"brink\">".

     

    I also tried an API WZCSetInterface. Using this i am trying to set up SSID in the device.

     

    here is the code which i implemented:

     

    // WZC_WiFi.cpp : Defines the entry point for the console application.

    //

     

    #include "stdafx.h"

    #include <windows.h>

    #include <commctrl.h>

    #include "wzcsapi.h"

     

    WCHAR g_szAdapterName[32] = _T("");

    FILE *gfpWiFiLog = NULL;

    #define MAX_NUM_OF_RETRY 6

     

    bool SetSSID()

    {

        DWORD dwInFlags = 0;

        INTF_ENTRY Intf;

        memset(&Intf, 0x00, sizeof(INTF_ENTRY));

    Intf.wszGuid = g_szAdapterName;

     

    WZC_WLAN_CONFIG wzcConfig1;

        memset(&wzcConfig1, 0, sizeof(wzcConfig1));

    // Length

    /*if(GetOSVersion() == POCKET_PC_2003)

    wzcConfig1.Length = 180;

    else

    wzcConfig1.Length = sizeof(wzcConfig1);

        */

    // dwCtlFlags

        wzcConfig1.dwCtlFlags = 0;//WZCCTL_POLICY;// No falg set ???

     

    wzcConfig1.Length = sizeof(wzcConfig1);

     

    wzcConfig1.dwCtlFlags = 0;

     

        // Ssid 

    WCHAR *szSsidToConnect = L"ready";

    wzcConfig1.Ssid.SsidLength = wcslen(szSsidToConnect);    

    for(UINT i = 0; i<wzcConfig1.Ssid.SsidLength; i++)

            wzcConfig1.Ssid.Ssid[i] = (char)szSsidToConnect[i];

     

    /////////////////////////////////////////////////////////////

        DWORD dwDataLen = sizeof(WZC_802_11_CONFIG_LIST);

        WZC_802_11_CONFIG_LIST *pNewConfigList = (WZC_802_11_CONFIG_LIST *)malloc(dwDataLen);

        pNewConfigList->NumberOfItems = 1;

        pNewConfigList->Index = 0;

        memcpy(pNewConfigList->Config, &wzcConfig1, sizeof(wzcConfig1));

        Intf.rdStSSIDList.pData = (BYTE*)pNewConfigList;

        Intf.rdStSSIDList.dwDataLen = dwDataLen;

    DWORD dwStatus = 1;

    //for(int i = 0; (dwStatus) && (i < MAX_NUM_OF_RETRY ); i++)

    dwStatus = WZCSetInterface(NULL, INTF_PREFLIST, &Intf, &dwInFlags);

     

        if(dwStatus)

    {

    fwprintf(gfpWiFiLog, _T("ERROR: WZCSetInterface failed. (Error code: %d)\n"), dwStatus);

    return false;

    }

     

    return true;

    }

     

    int _tmain(int argc, _TCHAR* argv[])

    {

    SetSSID();

         return 0;

     }

    here, the value for dwStatus should be 0 but i am getting it to be 2.

     

     

     

     

     

Alle reacties

  • dinsdag 7 september 2010 11:01
    Moderator
     
     Antwoord

    Hi ,

    This forum is specifically for matters dealing with Microsoft Project.  I suggest you try to find a more appropriate forum that deals with your equipment problems.

    Mike Glen
    Project MVP