From 050096823a3be796d1dc84969f2f69dba1b68235 Mon Sep 17 00:00:00 2001 From: David Frey Date: Tue, 17 May 2016 10:46:08 -0700 Subject: [PATCH] Revert the last 3 commits The commits depend on a version of Legato newer than the stable release (16.01.2) and thus they should have been performed on a Legato_16.04 branch. This reverts commit 8e16a6acb6949b1da4cf942c1230c4295d054bd6. This reverts commit 0c8d73f9358f8adb444d9aa3b849510db4ab6ca2. This reverts commit 8d014d8fc17d179196fae8f0be3e6cf787169127. --- CMakeLists.txt | 4 +- Makefile | 5 - .../wifiApTestComponent/Component.cdef | 2 +- .../wifiClientTestComponent/Component.cdef | 2 +- .../wifiWebApComponent/Component.cdef | 2 +- apps/tools/wifi/Makefile | 5 - apps/tools/wifi/wifi/Component.cdef | 4 +- le_wifiAp.api | 282 ++++++++++ le_wifiClient.api | 496 ++++++++++++++++++ le_wifiDefs.api | 93 ++++ service/daemon/Component.cdef | 4 +- targetDefs.wifi | 1 - 12 files changed, 880 insertions(+), 20 deletions(-) create mode 100644 le_wifiAp.api create mode 100644 le_wifiClient.api create mode 100644 le_wifiDefs.api diff --git a/CMakeLists.txt b/CMakeLists.txt index 25dd57c..06141fd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,6 @@ message(STATUS "MSG:MangOH Entered $ENV{MANGOH_WIFI_ROOT}/CMakeLists.txt") message(STATUS "MSG:MangOH:Wifi: CMakeLists.txt called") -generate_header_extern("$ENV{LEGATO_ROOT}/interfaces/wifi/le_wifiClient.api") -generate_header_extern("$ENV{LEGATO_ROOT}/interfaces/wifi/le_wifiAp.api") +generate_header_extern("$ENV{MANGOH_WIFI_ROOT}/le_wifiClient.api") +generate_header_extern("$ENV{MANGOH_WIFI_ROOT}/le_wifiAp.api") message(STATUS "MSG:MangOH Exit $ENV{MANGOH_WIFI_ROOT}/CMakeLists.txt") diff --git a/Makefile b/Makefile index da85cc0..1365e21 100644 --- a/Makefile +++ b/Makefile @@ -12,11 +12,6 @@ MANGOH_WIFI_ROOT = $(PWD) export MANGOH_WIFI_ROOT endif -ifndef LEGATO_WIFI_ROOT -LEGATO_WIFI_ROOT = $(LEGATO_ROOT)/interfaces/wifi -export LEGATO_WIFI_ROOT -endif - ifndef MANGOH_WIFI_PA MANGOH_WIFI_PA = ti export MANGOH_WIFI_PA diff --git a/apps/sample/wifiApTest/wifiApTestComponent/Component.cdef b/apps/sample/wifiApTest/wifiApTestComponent/Component.cdef index d3efe4d..c2b73f8 100644 --- a/apps/sample/wifiApTest/wifiApTestComponent/Component.cdef +++ b/apps/sample/wifiApTest/wifiApTestComponent/Component.cdef @@ -7,6 +7,6 @@ requires: { api: { - ${LEGATO_ROOT}/interfaces/wifi/le_wifiAp.api + ${MANGOH_WIFI_ROOT}/le_wifiAp.api } } diff --git a/apps/sample/wifiClientTest/wifiClientTestComponent/Component.cdef b/apps/sample/wifiClientTest/wifiClientTestComponent/Component.cdef index 834c33f..8684247 100644 --- a/apps/sample/wifiClientTest/wifiClientTestComponent/Component.cdef +++ b/apps/sample/wifiClientTest/wifiClientTestComponent/Component.cdef @@ -7,6 +7,6 @@ requires: { api: { - ${LEGATO_ROOT}/interfaces/wifi/le_wifiClient.api + ${MANGOH_WIFI_ROOT}/le_wifiClient.api } } diff --git a/apps/sample/wifiWebAp/wifiWebApComponent/Component.cdef b/apps/sample/wifiWebAp/wifiWebApComponent/Component.cdef index 4383771..638f869 100644 --- a/apps/sample/wifiWebAp/wifiWebApComponent/Component.cdef +++ b/apps/sample/wifiWebAp/wifiWebApComponent/Component.cdef @@ -7,7 +7,7 @@ requires: { api: { - ${LEGATO_ROOT}/interfaces/wifi/le_wifiAp.api + ${MANGOH_WIFI_ROOT}/le_wifiAp.api } } diff --git a/apps/tools/wifi/Makefile b/apps/tools/wifi/Makefile index 80d764d..b5f49e3 100644 --- a/apps/tools/wifi/Makefile +++ b/apps/tools/wifi/Makefile @@ -3,11 +3,6 @@ MANGOH_WIFI_ROOT = $(PWD)/../../.. export MANGOH_WIFI_ROOT endif -ifndef LEGATO_WIFI_ROOT -LEGATO_WIFI_ROOT = $(LEGATO_ROOT)/interfaces/wifi -export LEGATO_WIFI_ROOT -endif - localhost: app.localhost ar7: app.ar7 diff --git a/apps/tools/wifi/wifi/Component.cdef b/apps/tools/wifi/wifi/Component.cdef index 649582e..5e286a5 100644 --- a/apps/tools/wifi/wifi/Component.cdef +++ b/apps/tools/wifi/wifi/Component.cdef @@ -2,8 +2,8 @@ requires: { api: { - ${LEGATO_ROOT}/interfaces/wifi/le_wifiClient.api - ${LEGATO_ROOT}/interfaces/wifi/le_wifiAp.api + ${MANGOH_WIFI_ROOT}/le_wifiClient.api + ${MANGOH_WIFI_ROOT}/le_wifiAp.api } } diff --git a/le_wifiAp.api b/le_wifiAp.api new file mode 100644 index 0000000..1a1dd4b --- /dev/null +++ b/le_wifiAp.api @@ -0,0 +1,282 @@ +//-------------------------------------------------------------------------------------------------- +/** + * @page c_le_wifi_ap Wifi Access Point Service + * + * @ref le_wifiAp_interface.h "API Reference" + * + *
+ * + * This Wifi Service API provides Wifi Access Point setup. + * Please note that if there is only one wifi hardware the Wifi Access Point + * cannot be used at the same time as the Wifi Client service. + * + * @section le_wifi_binding IPC interfaces binding + * + * + * Here's a code sample binding to Wifi service: + * @verbatim + bindings: + { + clientExe.clientComponent.le_wifiAp -> wifiService.le_wifiAp + } + @endverbatim + * + * + * + * @section le_wifiAp_connect_to_ap Setting parameters for the Access Point. + * Note that these parameters must be set before the access point is started. + * See each function for its default value. + * + * To set the SSID for the Access Point use the following function: + * - le_wifiAp_SetSsid() + * + * To set the pass phrase prior for the Access Point use the function: + * Also see le_wifiAp_SetPreSharedKey(). + * - le_wifiAp_SetPassPhrase() + * + * Instead of setting the pass phrase, the Pre Shared Key (PSK), can be set explicitly. + * To set the Pre Shared Key prior for the Access Point start use the function: + * - le_wifiAp_SetPreSharedKey() + * + * Sets the security protocol to use. + * - le_wifiAp_SetSecurityProtocol() + * + * Sets is the Access Point should show up in network scans or not. + * - le_wifiAp_SetDiscoverable() + * + * Sets which channel to use. + * - le_wifiAp_SetChannel() + * + * + * @snippet "apps/sample/wifiApTest/wifiApTestComponent/wifiApTest.c" SetCred + * + * @section le_wifiAp_Start Starting the Wifi Access Point + * + * The Wifi Access Point is started with the function le_wifiAp_Start(). Unless values have been changed, default values will be used: + * - le_wifiAp_Start(): + * + * To subscribe to wifi events le_wifiAp_AddEventHandler() is to be called. + * - le_wifiAp_AddEventHandler() + * + * + * @snippet "apps/sample/wifiApTest/wifiApTestComponent/wifiApTest.c" Subscribe + * + *
+ * + * Copyright (C) Sierra Wireless Inc. Use of this work is subject to license. + */ +//-------------------------------------------------------------------------------------------------- + +//-------------------------------------------------------------------------------------------------- +/** + * @file le_wifiAp_interface.h + * + * Legato @ref c_le_wifiAp include file. + * + * Copyright (C) Sierra Wireless Inc. Use of this work is subject to license. + */ +//-------------------------------------------------------------------------------------------------- + +USETYPES le_wifiDefs.api; + +//-------------------------------------------------------------------------------------------------- +/** + * Wifi Access Point Events. + */ +//-------------------------------------------------------------------------------------------------- +ENUM Event +{ + EVENT_CLIENT_CONNECTED, ///< Client connected to Wifi Access Point. + EVENT_CLIENT_DISCONNECTED, ///< Client disconnected from Wifi Access Point. +}; + +//-------------------------------------------------------------------------------------------------- +/** + * Wifi Access Point Security levels. + */ +//-------------------------------------------------------------------------------------------------- +ENUM SecurityProtocol +{ + SECURITY_NONE, ///< Wifi Access Point is open and has no password. + SECURITY_WPA2 ///< Wifi Access Point has WPA2 activated. +}; + + +//-------------------------------------------------------------------------------------------------- +/** + * Handler for Wifi Access Point changes + */ +//-------------------------------------------------------------------------------------------------- +HANDLER EventHandler +( + Event event IN ///< Handles the wifi events +); + +//-------------------------------------------------------------------------------------------------- +/** + * These events provide information on Wifi Access Point + * + */ +//-------------------------------------------------------------------------------------------------- +EVENT NewEvent +( + handler EventHandler +); + + +//-------------------------------------------------------------------------------------------------- +/** + * This function starts the WIFI Access Point. + * @note that all settings, if to be used, such as security, username, password must set prior to + * starting the Access Point. + * + * @return LE_FAULT The function failed. + * @return LE_OK The function succeeded. + * + */ +//-------------------------------------------------------------------------------------------------- +FUNCTION le_result_t Start +( +); + +//-------------------------------------------------------------------------------------------------- +/** + * This function stops the WIFI Access Point. + * + * @return LE_FAULT The function failed. + * @return LE_OK The function succeeded. + * + */ +//-------------------------------------------------------------------------------------------------- +FUNCTION le_result_t Stop +( +); + +//-------------------------------------------------------------------------------------------------- +/** + * Set the Service set identification (SSID) of the AccessPoint + * Default value is "LEGATO Access Point" + * @note that the SSID does not have to be human readable ASCII values, but often has. + * + * @return LE_BAD_PARAMETER Some parameter is invalid. + * @return LE_OK Function succeeded. + */ +//-------------------------------------------------------------------------------------------------- +FUNCTION le_result_t SetSsid +( + uint8 ssid[le_wifiDefs.MAX_SSID_BYTES] IN ///< The SSID to set as a octet array. +); + +//-------------------------------------------------------------------------------------------------- +/** + * Set the Security protocol to use. + * Default value is SECURITY_WPA2. + * @note that the SSID does not have to be human readable ASCII values, but often has. + * + * @return LE_BAD_PARAMETER Some parameter is invalid. + * @return LE_OK Function succeeded. + */ +//-------------------------------------------------------------------------------------------------- +FUNCTION le_result_t SetSecurityProtocol +( + SecurityProtocol securityProtocol IN ///< The security protocol to use. +); + + + + +//-------------------------------------------------------------------------------------------------- +/** + * Set the passphrase used to generate the PSK. + * Default value is "ChangeThisPassword". + * + * @note If the PSK is to be set directly, please use le_wifiAp_SetPreSharedKey() + * + * @return LE_BAD_PARAMETER Parameter is invalid. + * @return LE_OK Function succeeded. + * + */ +//-------------------------------------------------------------------------------------------------- +FUNCTION le_result_t SetPassPhrase +( + string passPhrase[le_wifiDefs.MAX_PASSPHRASE_BYTES] IN ///< pass-phrase for PSK +); + +//-------------------------------------------------------------------------------------------------- +/** + * Set the Pre Shared Key, PSK. + * There is no default value, since le_wifiAp_SetPassPhrase is used as default. + * @note the difference between le_wifiAp_SetPassPhrase() and this function + * + * @return LE_BAD_PARAMETER Parameter is invalid. + * @return LE_OK Function succeeded. + * + */ +//-------------------------------------------------------------------------------------------------- +FUNCTION le_result_t SetPreSharedKey +( + string preSharedKey[le_wifiDefs.MAX_PSK_BYTES] IN ///< PSK. Note the difference between PSK and Pass Phrase. +); + + +//-------------------------------------------------------------------------------------------------- +/** + * Set if the Access Point should announce its presence. + * Default value is TRUE. + * If the value is set to FALSE, the Access Point will be hidden. + * + * @return LE_OK Function succeeded. + * + */ +//-------------------------------------------------------------------------------------------------- +FUNCTION le_result_t SetDiscoverable +( + bool discoverable IN ///< If TRUE the Access Point shows up on scans, else it is hidden. +); + +//-------------------------------------------------------------------------------------------------- +/** + * Set which Wifi Channel to use. + * Default value is 1. + * Some legal restrictions for values 12 - 14 might apply for your region. + * + * @return LE_OUT_OF_RANGE Requested channel number is out of range. + * @return LE_OK Function succeeded. + * + */ +//-------------------------------------------------------------------------------------------------- +FUNCTION le_result_t SetChannel +( + int8 channelNumber IN ///< the channel number must be between 1 and 14. +); + +//-------------------------------------------------------------------------------------------------- +/** + * Set number of maximally allowed clients to connect to the Access Point at the same time. + * + * @return LE_OUT_OF_RANGE Requested number of users exceeds the capabilities of the Access Point. + * @return LE_OK Function succeeded. + * + */ +//-------------------------------------------------------------------------------------------------- +FUNCTION le_result_t SetMaxNumberOfClients +( + int8 maxNumberOfClient IN ///< the maximum number of clients +); + +//-------------------------------------------------------------------------------------------------- +/** + * Defines the IP adresses range for the host AP. + * + * @return LE_BAD_PARAMETER At least, one of the given IP addresses is invalid. + * @return LE_FAULT A system call has failed. + * @return LE_OK Function succeeded. + * + */ +//-------------------------------------------------------------------------------------------------- +FUNCTION le_result_t SetIpRange +( + string ipAp[64] IN, ///< the IP address of the Access Point. + string ipStart[64] IN, ///< the start IP address of the Access Point. + string ipStop[64] IN ///< the stop IP address of the Access Point. +); diff --git a/le_wifiClient.api b/le_wifiClient.api new file mode 100644 index 0000000..f2bc6e3 --- /dev/null +++ b/le_wifiClient.api @@ -0,0 +1,496 @@ +//-------------------------------------------------------------------------------------------------- +/** + * @page c_le_wifi_client Wifi Client Service + * + * @ref le_wifiClient_interface.h "API Reference" + * + *
+ * + * This API provides Wifi Client setup. + * Please note that the Wifi Client cannot be used at the same time as the Wifi Access Points + * service, due to the sharing of same wifi hardware. + * + * @section le_wifi_binding IPC interfaces binding + * + * + * Here's a code sample binding to Wifi service: + * @verbatim + bindings: + { + clientExe.clientComponent.le_wifiClient -> wifiService.le_wifiClient + } + @endverbatim + * + * @section le_wifiClient_Start Starting the Wifi Client + * + * First of all the function le_wifiClient_Start() must be called to start the Wifi Service. + * - le_wifiClient_Start(): returns LE_OK if the call went ok. + * If Wifi Access Point is active, this will fail. + * + * + * To subscribe to wifi events le_wifiClient_AddNewEventHandler() is to be called. + * - le_wifiClient_AddNewEventHandler(): returns the handler reference if the call went ok. + * + * @code + * + * static void EventHandler + * ( + * le_wifiClient_Event_t clientEvent, + * void *contextPtr + * ) + * { + * switch( clientEvent ) + * { + * case LE_WIFICLIENT_EVENT_CONNECTED: + * { + * LE_INFO("Wifi Client Connected."); + * } + * break; + * case LE_WIFICLIENT_EVENT_DISCONNECTED: + * { + * LE_INFO("Wifi Client Disconnected."); + * } + * break; + * case LE_WIFICLIENT_EVENT_SCAN_DONE: + * { + * LE_INFO("Wifi Client Scan is done."); + * MyHandleScanResult(); + * } + * break; + * } + * } + * + * le_wifiClient_NewEventHandler WifiEventHandlerRef = NULL; + * + * static void MyInit + * ( + * void + * ) + * { + * le_result_t result = le_wifiClient_start(); + * + * if ( LE_OK == result ) + * { + * LE_INFO("Wifi Client started."); + * WifiEventHandlerRef = le_wifiClient_AddNewEventHandler( EventHandler, NULL ); + * } + * else if ( LE_BUSY == result ) + * { + * LE_INFO("ERROR: Wifi Client already started."); + * } + * else + * { + * LE_INFO("ERROR: Wifi Client not started."); + * } + * + * } + * + * @endcode + * + * + * @section le_wifiClient_scan Scanning Access Points with Wifi Client + * + * To start a scan for Access Points, the le_wifiClient_Scan() should be called. + * - le_wifiClient_Scan(): returns the LE_OK if the call went ok. + * + * + * @section le_wifiClient_scan_result Processing the Wifi scan results + * + * Once the scan results are available, the event LE_WIFICLIENT_EVENT_SCAN_DONE is received. + * The found Access Points can then be gotten with + * - le_wifiClient_GetFirstAccessPoint(): returns the Access Point if found. Else NULL. + * - le_wifiClient_GetNextAccessPoint(): returns the next Access Point if found. Else NULL. + * + * The Access Points SSID, Service Set Identifier, is not a string. + * It does however often contain human readable ASCII values. + * It can be read with the following function: + * - le_wifiClient_GetSsid() : returns the LE_OK if the SSID was read ok. + * + * The Access Points signal strength can be read with the following function: + * - le_wifiClient_GetSignalStrength() : returns the signal strength in dBm of the AccessPoint + * + * @code + * + * static void MyHandleScanResult + * ( + * void + * ) + * { + * uint8 ssid[MAX_SSID_BYTES]; + * le_wifiClient_AccessPointRef_t accessPointRef = le_wifiClient_GetFirstAccessPoint(); + * + * while( NULL != accessPointRef ) + * { + * result = le_wifiClient_GetSsid( accessPointRef, ssid, MAX_SSID_BYTES ); + * if (( result == LE_OK ) && ( memcmp( ssid, "MySSID", 6) == 0 )) + * { + * LE_INFO("Wifi Client found."); + * break; + * } + * accessPointRef = le_wifiClient_GetNextAccessPoint(); + * } + * } + * + * @endcode + * + * @section le_wifiClient_connect_to_ap Connecting to Access Point + * + * To connect to an Access Point use the function: + * - le_wifiClient_Connect() : returns the LE_OK if the function was called ok. + * + * To set the pass phrase prior for the Access Point use the function: + * - le_wifiClient_SetPassphrase() : returns the LE_OK if the function was called ok. + * + * WPA-Enterprise requires a username and password to authenticate. + * To set them use the function : + * - le_wifiClient_SetUserCredentials() : returns the LE_OK if the function was called ok. + * + * If an Access Point is hidden, it does not announce it's presence, + * it will not show up in the scan. + * To be able to connect to it, the SSID must be known. + * Use the following function to get an Access Point that can be used to connect to: + * - le_wifiClient_Create() : returns Access Point. + * + * @code + * + * static void MyConnectTo + * ( + * le_wifiClient_AccessPointRef_t accessPointRef + * ) + * { + * le_result_t result; + * le_wifiClient_SetPassphrase ( accessPointRef, "Secret1" ); + * result = le_wifiClient_Connect( accessPointRef ); + * if (result == LE_OK) + * { + * LE_INFO("Connecting to AP."); + * } + * } + * + * @endcode + * + *
+ * + * Copyright (C) Sierra Wireless Inc. Use of this work is subject to license. + */ +//-------------------------------------------------------------------------------------------------- + +//-------------------------------------------------------------------------------------------------- +/** + * @file le_wifiClient_interface.h + * + * Legato @ref c_le_wifiClient include file. + * + * Copyright (C) Sierra Wireless Inc. Use of this work is subject to license. + */ +//-------------------------------------------------------------------------------------------------- + +USETYPES le_wifiDefs.api; + + +//-------------------------------------------------------------------------------------------------- +/** + * Reference type for AccessPoint that is returned by the Wifi Scan. + */ +//-------------------------------------------------------------------------------------------------- +REFERENCE AccessPoint; + +//-------------------------------------------------------------------------------------------------- +/** + * Wifi Client Events. + */ +//-------------------------------------------------------------------------------------------------- +ENUM Event +{ + EVENT_CONNECTED, ///< Wifi Client Connected + EVENT_DISCONNECTED, ///< Wifi Client Disconnected + EVENT_SCAN_DONE ///< Wifi Scan result for available Access Points available +}; + +//-------------------------------------------------------------------------------------------------- +/** + * Wifi Client Security Protocol for connection + */ +//-------------------------------------------------------------------------------------------------- +ENUM SecurityProtocol +{ + SECURITY_NONE, ///< no security. + SECURITY_WEP, ///< Using WEP. + SECURITY_WPA_PSK_PERSONAL, ///< Using WPA + SECURITY_WPA2_PSK_PERSONAL, ///< Using WPA2 + SECURITY_WPA_EAP_PEAP0_ENTERPRISE, ///< Using WPA Enterprise + SECURITY_WPA2_EAP_PEAP0_ENTERPRISE ///< Using WPA2 Enterprise +}; + + + +//-------------------------------------------------------------------------------------------------- +/** + * Handler for Wifi Client changes + */ +//-------------------------------------------------------------------------------------------------- +HANDLER NewEventHandler +( + Event event IN ///< Handles the wifi events +); + + +//-------------------------------------------------------------------------------------------------- +/** + * This event provide information on Wfifi Client event changes. + * + */ +//-------------------------------------------------------------------------------------------------- +EVENT NewEvent +( + handler NewEventHandler +); + + +//-------------------------------------------------------------------------------------------------- +/** + * This function starts the WIFI device. + * + * @return LE_FAULT The function failed. + * @return LE_BUSY If the WIFI device is already started. + * @return LE_OK The function succeeded. + * + */ +//-------------------------------------------------------------------------------------------------- +FUNCTION le_result_t Start +( +); + +//-------------------------------------------------------------------------------------------------- +/** + * This function stops the WIFI device. + * + * @return LE_FAULT The function failed. + * @return LE_DUPLICATE If the WIFI device is already stopped. + * @return LE_OK The function succeeded. + * + */ +//-------------------------------------------------------------------------------------------------- +FUNCTION le_result_t Stop +( +); + + +//-------------------------------------------------------------------------------------------------- +/** + * Start Scanning for Wifi Access points + * Will result in event LE_WIFICLIENT_EVENT_SCAN_DONE when the scan results are available. + * + * @return LE_FAULT Function failed. + * @return LE_OK Function succeeded. + */ +//-------------------------------------------------------------------------------------------------- +FUNCTION le_result_t Scan +( +); + + +//-------------------------------------------------------------------------------------------------- +/** + * Get the first Wifi Access Point found. + * Will return the Access Points in the order of found. + * + * @return Wifi Access Point reference if ok. + * @return NULL if no Access Point reference available. + */ +//-------------------------------------------------------------------------------------------------- +FUNCTION AccessPoint GetFirstAccessPoint +( +); + +//-------------------------------------------------------------------------------------------------- +/** + * Get the next Wifi Access Point. + * Will return the Access Points in the order of found. + * This function must be called in the same context as the GetFirstAccessPoint + * + * @return Wifi Access Point reference if ok. + * @return NULL if no Access Point reference available. +*/ +//-------------------------------------------------------------------------------------------------- +FUNCTION AccessPoint GetNextAccessPoint +( +); + + +//-------------------------------------------------------------------------------------------------- +/** + * Get the signal strength of the AccessPoint + * + * @return + * - signal strength in dBm. Example -30 = -30dBm + * - if no signal available it will return OxFFFF + */ +//-------------------------------------------------------------------------------------------------- +FUNCTION int16 GetSignalStrength +( + AccessPoint accessPointRef IN ///< Wifi Access Point reference. +); + +//-------------------------------------------------------------------------------------------------- +/** + * Get the Service set identification (SSID) of the AccessPoint + * @note that the SSID does not have to be human readable ASCII values, but often has. + * + * @return LE_FAULT Function failed. + * @return LE_BAD_PARAMETER Some parameter is invalid. + * @return LE_OK Function succeeded. + */ +//-------------------------------------------------------------------------------------------------- +FUNCTION le_result_t GetSsid +( + AccessPoint accessPointRef IN, ///< Wifi Access Point reference. + uint8 Ssid[le_wifiDefs.MAX_SSID_BYTES] OUT ///< The SSID returned as a octet array. +); + + + +//-------------------------------------------------------------------------------------------------- +/** + * Set the passphrase used to generate the PSK. + * + * @note the difference between le_wifiClient_SetPreSharedKey() and this function + * + * @return LE_FAULT Function failed. + * @return LE_BAD_PARAMETER Parameter is invalid. + * @return LE_OK Function succeeded. + * + */ +//-------------------------------------------------------------------------------------------------- +FUNCTION le_result_t SetPassphrase +( + AccessPoint accessPointRef IN, ///< Wifi Access Point reference. + string PassPhrase[le_wifiDefs.MAX_PASSPHRASE_BYTES] IN ///< pass-phrase for PSK +); + +//-------------------------------------------------------------------------------------------------- +/** + * Set the Pre Shared Key, PSK. + * @note the difference between le_wifiClient_SetPassphrase() and this function + * + * @return LE_FAULT Function failed. + * @return LE_BAD_PARAMETER Parameter is invalid. + * @return LE_OK Function succeeded. + * + */ +//-------------------------------------------------------------------------------------------------- +FUNCTION le_result_t SetPreSharedKey +( + AccessPoint accessPointRef IN, ///< Wifi Access Point reference. + string PreSharedKey[le_wifiDefs.MAX_PSK_BYTES] IN ///< PSK. Note the difference between PSK and Pass Phrase. +); + +//-------------------------------------------------------------------------------------------------- +/** + * Set the security protocol for connection + * + * @return LE_FAULT Function failed. + * @return LE_BAD_PARAMETER Parameter is invalid. + * @return LE_OK Function succeeded. + * + */ +//-------------------------------------------------------------------------------------------------- +FUNCTION le_result_t SetSecurityProtocol +( + AccessPoint accessPointRef IN, ///< Wifi Access Point reference. + SecurityProtocol securityProtocol IN ///< Security Mode +); + +//-------------------------------------------------------------------------------------------------- +/** + * WPA-Enterprise requires a username and password to authenticate. + * This function sets these parameters. + * + * @return LE_FAULT Function failed. + * @return LE_BAD_PARAMETER Parameter is invalid. + * @return LE_OK Function succeeded. + * + */ +//-------------------------------------------------------------------------------------------------- +FUNCTION le_result_t SetUserCredentials +( + AccessPoint accessPointRef IN, ///< Wifi Access Point reference. + string userName[le_wifiDefs.MAX_USERNAME_BYTES] IN, ///< UserName used for WPA-Enterprise. + string password[le_wifiDefs.MAX_PASSWORD_BYTES] IN ///< Password used for WPA-Enterprise. +); + + +//-------------------------------------------------------------------------------------------------- +/** + * Set the WEP key (WEP) + * + * @return LE_FAULT The function failed. + * @return LE_OK The function succeed. + */ +//-------------------------------------------------------------------------------------------------- +FUNCTION le_result_t SetWepKey +( + AccessPoint accessPointRef IN, ///< Wifi Access Point reference. + string wepKey[le_wifiDefs.MAX_WEPKEY_BYTES] IN ///< The WEP key +); + + + +//-------------------------------------------------------------------------------------------------- +/** + * If an AccessPoint is not announcing it's precense, it will not show up in the scan. + * But if the SSID is known, a connnection can be tried using this create function. + * First create the AccessPoint, then le_wifiClient_Connect() to connect to it. + * Will fail if called while scan is running. + * + * @return AccessPoint reference to the current + */ +//-------------------------------------------------------------------------------------------------- +FUNCTION AccessPoint Create +( + uint8 Ssid[le_wifiDefs.MAX_SSID_BYTES] IN ///< The SSID as a octet array. +); + +//-------------------------------------------------------------------------------------------------- +/** + * Deletes an accessPointRef. + * + * @note The handle becomes invalid after it has been deleted. + * @return LE_BAD_PARAMETER accessPointRef was not found. + * @return LE_BUSY Function called during scan. + * @return LE_OK Function succeeded. + */ +//-------------------------------------------------------------------------------------------------- +FUNCTION le_result_t Delete +( + AccessPoint accessPointRef IN ///< Wifi Access Point reference. +); + +//-------------------------------------------------------------------------------------------------- +/** + * Connect to the Wifi Access Point. + * All authentication must be set prior to calling this function. + * + * @return LE_BAD_PARAMETER Parameter is invalid. + * @return LE_OK Function succeeded. + * + * @note For PSK credentials see le_wifiClient_SetPassphrase() or le_wifiClient_SetPreSharedKey() . + * @note For WPA-Enterprise credentials see le_wifiClient_SetUserCredentials() + */ +//-------------------------------------------------------------------------------------------------- +FUNCTION le_result_t Connect +( + AccessPoint accessPointRef IN ///< Wifi Access Point reference. +); + +//-------------------------------------------------------------------------------------------------- +/** + * Disconnect from the current connected Wifi Access Point. + * + * @return LE_FAULT Function failed. + * @return LE_OK Function succeeded. + */ +//-------------------------------------------------------------------------------------------------- +FUNCTION le_result_t Disconnect +( +); diff --git a/le_wifiDefs.api b/le_wifiDefs.api new file mode 100644 index 0000000..b67eeb0 --- /dev/null +++ b/le_wifiDefs.api @@ -0,0 +1,93 @@ +//-------------------------------------------------------------------------------------------------- +/** + * @file le_wifiDefs_interface.h + * + * Definition file common to multiple wifi related services. + * + * Copyright (C) Sierra Wireless Inc. Use of this work is subject to license. + */ + +//-------------------------------------------------------------------------------------------------- +/** + * The maximum length of the wep key + */ +//-------------------------------------------------------------------------------------------------- +DEFINE MAX_WEPKEY_LENGTH = 63; + + +//-------------------------------------------------------------------------------------------------- +/** + * The maximum number of bytes of the wep key + * One extra byte is added for the null character. + */ +//-------------------------------------------------------------------------------------------------- +DEFINE MAX_WEPKEY_BYTES = (MAX_WEPKEY_LENGTH+1); + +/** + * The maximum length of the pass-phrase used to generate PSK is 63 bytes. See 802.11-2007: H4.2. + */ +//-------------------------------------------------------------------------------------------------- +DEFINE MAX_PASSPHRASE_LENGTH = 63; + +//-------------------------------------------------------------------------------------------------- +/** + * Maximum length of PSK, Pre Shared Key. + * One extra byte is added for the null character. + */ +//-------------------------------------------------------------------------------------------------- +DEFINE MAX_PASSPHRASE_BYTES = (MAX_PASSPHRASE_LENGTH+1); + +//-------------------------------------------------------------------------------------------------- +/** + * The length of the PSK, Pre Shared Key, is 64 bytes. See 802.11-2007: H4.2. + */ +//-------------------------------------------------------------------------------------------------- +DEFINE MAX_PSK_LENGTH = 64; + +//-------------------------------------------------------------------------------------------------- +/** + * Maximum length of PSK, Pre Shared Key. + * One extra byte is added for the null character. + */ +//-------------------------------------------------------------------------------------------------- +DEFINE MAX_PSK_BYTES = (MAX_PSK_LENGTH+1); + +//-------------------------------------------------------------------------------------------------- +/** + * Maximum length of the User-Name. RFC2865 recommends the ability to handle at least 63 octets. + */ +//-------------------------------------------------------------------------------------------------- +DEFINE MAX_USERNAME_LENGTH = 63; + +//-------------------------------------------------------------------------------------------------- +/** + * Maximum length of the User-Name. + * One extra byte is added for the null character. + */ +//-------------------------------------------------------------------------------------------------- +DEFINE MAX_USERNAME_BYTES = (MAX_USERNAME_LENGTH+1); + +//-------------------------------------------------------------------------------------------------- +/** + * Maximum length of the User-Name. RFC2865 recommends at least 130. + */ +//-------------------------------------------------------------------------------------------------- +DEFINE MAX_PASSWORD_LENGTH = 130; + +//-------------------------------------------------------------------------------------------------- +/** + * Maximum length of the User-Name. + * One extra byte is added for the null character. + */ +//-------------------------------------------------------------------------------------------------- +DEFINE MAX_PASSWORD_BYTES = (MAX_PASSWORD_LENGTH+1); + +//-------------------------------------------------------------------------------------------------- +/** + * The maximum length of octets of the Service set identification (SSID). + * @note that while the values are probably human readable, this is not a string. + */ +//-------------------------------------------------------------------------------------------------- +DEFINE MAX_SSID_BYTES = 32; + + diff --git a/service/daemon/Component.cdef b/service/daemon/Component.cdef index 1fd2c86..2bb6b17 100644 --- a/service/daemon/Component.cdef +++ b/service/daemon/Component.cdef @@ -2,8 +2,8 @@ provides: { api: { - ${LEGATO_ROOT}/interfaces/wifi/le_wifiClient.api - ${LEGATO_ROOT}/interfaces/wifi/le_wifiAp.api + ${MANGOH_WIFI_ROOT}/le_wifiClient.api + ${MANGOH_WIFI_ROOT}/le_wifiAp.api } } diff --git a/targetDefs.wifi b/targetDefs.wifi index 5cb742d..56db3d5 100644 --- a/targetDefs.wifi +++ b/targetDefs.wifi @@ -1,7 +1,6 @@ # Root directory for MangOH code export MANGOH_ROOT = $(LEGATO_ROOT)/../mangOH export MANGOH_WIFI_ROOT = $(MANGOH_ROOT)/apps/WiFi -export LEGATO_WIFI_ROOT = $(LEGATO_ROOT)/interfaces/wifi # this variable goes from environment -> cmake -> Doxygen. # It can be used in Legato Doxygen code to conditionally add MangOH links etc.