Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed Servo X_NUCLEO_IKS01A2 X_NUCLEO_IDW01M1v2 NetworkSocketAPI NDefLib MQTT
X_NUCLEO_IDW01M1/intermediate.cpp
- Committer:
- mridup
- Date:
- 2016-04-13
- Revision:
- 2:ba0531d896f0
- Parent:
- 0:cbf8bc43bc9e
File content as of revision 2:ba0531d896f0:
/* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
******************************************************************************
* @file intermediate.c
* @author STMicroelectronics
* @brief Wrapper Functions for access to SPWFSADevice class/vice-versa
******************************************************************************
* @copy
*
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
* TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
* DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
*
* <h2><center>© COPYRIGHT 2016 STMicroelectronics</center></h2>
******************************************************************************
*/
#include "SpwfSADevice.h"
SpwfSADevice * device;
void setSpwfSADevice(SpwfSADevice * dev);
void setSpwfSADevice(SpwfSADevice * dev)
{
device = dev;
}
#ifdef __cplusplus
extern "C" {
#endif
void callSpwfSADevice_init(void* object);
char callSpwfSADevice_getChar(void* object);
void callSpwfSADevice_write(void* object, const char * cmd, uint16_t size);
void callSpwfSADevice_wakeup(void* object, int wake);
void callSpwfSADevice_reset(void* object, int reset);
void callSpwfSADevice_rts(void* object, int rts);
void callSpwfSADevice_attach(wifi_bool attach);
void callSpwfSADevice_debug(void* object, const char * string);
void destroySpwfSADevice(void);
int callSpwfSADevice_read_rts(void* object);
void callSpwfSADevice_init(void* object)
{
//static_cast<SpwfSADevice*>(object)->init();
device->init();
return;
}
char callSpwfSADevice_getChar(void* object)
{
return(device->spwf_get());
}
void callSpwfSADevice_write(void* object, const char * cmd, uint16_t size)
{
device->spwf_send(cmd, size);
}
void callSpwfSADevice_wakeup(void* object, int wake)
{
device->spwf_wakeup(wake);
}
void callSpwfSADevice_reset(void* object, int reset)
{
device->spwf_reset(reset);
}
void callSpwfSADevice_rts(void* object, int rts)
{
device->spwf_rts(rts);
}
int callSpwfSADevice_read_rts(void* object)
{
return(device->spwf_read_rts());
}
void callSpwfSADevice_attach(wifi_bool attach)
{
device->spwf_attach_irq(attach);
}
void callSpwfSADevice_debug(void* object, const char * string)
{
device->debug_print(string);
}
void destroySpwfSADevice()
{
}
/*Callbacks implementation*/
void ind_wifi_on()
{
device->signal_synch_wait(WiFi_MODULE_SUCCESS);
}
void ind_wifi_connected()
{
device->signal_synch_wait(WiFi_MODULE_SUCCESS);
}
void ind_wifi_connection_error(WiFi_Status_t code)
{
switch(code)
{
case WiFi_DISASSOCIATION:
device->signal_synch_wait(code);
break;
case WiFi_DE_AUTH:
break;
default:
break;
}
}
void ind_wifi_socket_data_received(uint8_t socket_id, uint8_t * data_ptr, uint32_t message_size, uint32_t chunk_size)
{
device->signal_data_receive(socket_id, data_ptr, message_size, chunk_size);
}
void ind_wifi_http_data_available(uint8_t * data_ptr, uint32_t message_size)
{
//spwf->debug("\r\nrx>>\r\n");
//memcpy(user_buffer, data_ptr, 511);
}
void ind_wifi_socket_client_remote_server_closed(uint8_t * socket_closed_id)
{
device->signal_synch_wait(WiFi_MODULE_SUCCESS);
}
#ifdef __cplusplus
}
#endif