1 // http://www.apache.org/licenses/LICENSE-2.0
3 // Unless required by applicable law or agreed to in writing, software
4 // distributed under the License is distributed on an "AS IS" BASIS,
5 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6 // See the License for the specific language governing permissions and
7 // limitations under the License.
9 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
12 * These are adapter APIs will make caller modules agnostic to platform.
15 #include "softapnative.h"
16 #include "easysetup.h"
18 #include "networkhandler.h"
20 void ESCreateSoftapCallback(int result, const char *ip, const char* mac_addr,
21 const char* device_name );
23 NetworkEventCallback gCallback;
26 * It will return Device which is creating Soft AP.
27 * i.e.Enrollee or Mediator.
28 * This decesion is based on, what is the value set for ES_SOFTAP_MODE in build command as well as
29 * in iotivity.spec file.
31 DeviceRole ESSoftapHost()
33 #ifdef ENROLLEE_SOFTAP
43 * It will return true if the Soft AP is created at Enrollee device
45 bool ESSoftapAtEnrollee()
47 return ( ESSoftapHost() == ENROLLEE) ? true : false;
51 * It will return true if the Soft AP is created at Mediator device
53 bool ESSoftapAtMediator()
55 return (ESSoftapHost() == MEDIATOR) ? true : false;
59 * This API will map result returned from the native to the caller.
60 * Callback API's signature needs to be modified under build switch according
61 * to the underline platform.
63 void ESCreateSoftapCallback(int result, const char *ip, const char* mac_addr,
64 const char* device_name)
66 if(SOFTAP_SUCCESS == result) //on Success
77 * This API will create the softap at enrollee
79 void ESCreateSoftap(const char * ssid, const char* passwd, NetworkEventCallback cb)
83 // TODO: To be implemented
84 // Create Soft AP through native APIs -- start
85 // native API call by and pass ESCreateSoftapCallback() as callback
86 ESCreateSoftapNative(ssid, passwd,ESCreateSoftapCallback);
87 // Create Soft AP through native APIs -- end