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: ATParser
Fork of ESP8266 by
hwnamedriver.h
- Committer:
- sam_grove
- Date:
- 2015-06-17
- Revision:
- 5:a517950927fe
- Parent:
- 4:844719bff1b1
File content as of revision 5:a517950927fe:
/* NetworkInterface Base Class
* Copyright (c) 2015 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.
*/
#ifndef HWNAME_DRIVER_H
#define HWNAME_DRIVER_H
/*
These functions are a reference / sample implimentation.
The functions usedcan vary greatly between networking devices.
The only requirement is they provide the functionality needed by the Socket and Interface API's.
*/
/*
Functions to impliment
- Initialize(SingleConnection/MultiConnection) // return object to track current endpoint?
- Reset() // its initialize but as a handy human readable implimentation
- OpenConnection(Type TCP/UDP, IPV4/6, blocking/non-blocking)
- CloseConnection() // empty if single mode, provide return from initialize if in multi mode
- Send(data) // make a vector to have implicit size?
- Recieve(dataBuffer, blocking timeout?) // recieve data with a blocking timeout
*/
//class HWNameDriver :
//{
//public:
//
// /**
// * This enum defines the possible connect types.
// */
// enum connectType {
// TCP,
// UDP,
// };
//
// /**
// * Initialize the network hardware.
// *
// * \returns 1 on success, 0 on failure
// */
// virtual init (void ) const {
// return 0;
// }
//
// /**
// * Reset the newtwork hardware
// *
// * \returns 1 on success, 0 on failure
// */
// virtual int reset(void) const {
// return 0;
// }
//
// /**
// * Start a connection, either TCP or UDP
// *
// * \returns 1 on success, 0 on failure
// */
// virtual int connect(connectType type) const {
// return 0;
// }
//
// /**
// * Send data over the open connection
// *
// * @param data The data to send.
// * @param dataLen The number of bytes of data to send.
// * @param timeout The timeout time to wait in ms, default to 1500ms.
// *
// * \returns # of bytes sent on success, -1 on failure
// */
// virtual int send(uint8_t *data, int dataLen, int timeout = 1500) const {
// return 0;
// }
//
// /**
// * Receive data over the open connection
// *
// * @param data Buffer to put received data into.
// * @param dataMaxSize The maximum size of the data buffer to put received data into.
// * @param timeout The timeout time to wait in ms, default to 1500ms.
// *
// * \returns # of bytes recieved on success, -1 on failure
// */
// virtual int receive(uint8_t *data, int dataMaxSize,int timeout = 1500) const {
// return 0;
// }
//
// /**
// * Stop the interface, bringing down dhcp if necessary.
// *
// * \returns 1 on success, 0 on failure
// */
// virtual int disconnect(void) const {
// return 0;
// }
//
// /**
// * Put the hardware to sleep / low power mode.
// *
// * \returns 1 on success, 0 on failure
// */
// virtual int sleep(void) const {
// return 0;
// }
//
// /**
// * Wakeup the hardware.
// *
// * \returns 1 on success, 0 on failure
// */
// virtual int wakeup(void) const {
// return 0;
// }
//
// /**
// * Set the current IP address.
// *
// * @param ip The IP Address to use.
// *
// * \returns 1 on success, 0 on failure
// */
// virtual int setIPAddress(const char *ip) const {
// return 0;
// }
//
// /**
// * Get the current IP address.
// *
// * \returns a pointer to a string containing the IP address on success, 0 on failure.
// */
// virtual char *getIPAddress(void) const {
// return 0;
// }
//
// /**
// * Set the current gateway address.
// *
// * @param gateway The Gateway to use.
// *
// * \returns 1 on success, 0 on failure
// */
// virtual int setGateway(const char *gateway) const {
// return 0;
// }
//
// /**
// * Get the current gateway address.
// *
// * \returns a pointer to a string containing the gateway address on success, 0 on failure.
// */
// virtual char *getGateway(void) const {
// return 0;
// }
//
// /**
// * Set the Network of the HWDevice
// *
// * @param netmask The networkMask to use.
// *
// * \returns 1 on success, 0 on failure
// */
// virtual int setNetworkMask(const char *netmask) const {
// return 0;
// };
//
// /**
// * Get the current network mask.
// *
// * \returns a pointer to a string containing the network mask on success, 0 on failure.
// */
// virtual char *getNetworkMask(void) const {
// return 0;
// }
//
// /**
// * Set the MAC Address of the HWDevice
// *
// * @param mac The static IP address to use
// *
// * \returns 1 on success, 0 on failure
// */
// virtual int setMACAddress(const char *mac) const {
// return 0;
// };
//
// /**
// * Get the devices MAC address.
// *
// * \returns a pointer to a string containing the mac address on success, 0 on failure.
// */
// virtual char *getMACAddress(void) const {
// return 0;
// }
//
// /**
// * Get the current status of the interface connection.
// *
// * \returns true if connected, false otherwise.
// */
// virtual bool isConnected(void) const {
// return false;
// }
//
//private:
// char IPAddress[15]; // "xxx.xxx.xxx.xxx" IPV4
// char NetworkMask[15]; // "xxx.xxx.xxx.xxx"
// char Gateway[15]; // "xxx.xxx.xxx.xxx"
// char MacAddress[17]; // "xx:xx:xx:xx:xx:xx"
// bool connected;
//
//};
#endif // HWNAME_DRIVER_H
