cc3000 hostdriver with the mbed socket interface
Fork of cc3000_hostdriver_mbedsocket by
Diff: cc3000.h
- Revision:
- 29:c40918cd9b6d
- Parent:
- 27:5118ab0f6aa4
- Child:
- 30:251a0a7d88de
--- a/cc3000.h Sat Oct 05 20:29:39 2013 +0200 +++ b/cc3000.h Sun Oct 06 17:17:48 2013 +0200 @@ -76,7 +76,7 @@ #else #define DBG_SOCKET(x, ...) std::printf("[CC3000 : SOCKET] "x"\r\n", ##__VA_ARGS__); #endif - + #else #define DBG_SOCKET(x, ...) #endif @@ -88,7 +88,7 @@ #else #define DBG_HCI(x, ...) std::printf("[CC3000 : HCI RX] "x"\r\n", ##__VA_ARGS__); #endif - + #else #define DBG_HCI(x, ...) #endif @@ -100,7 +100,7 @@ #else #define DBG_HCI_CMD(x, ...) std::printf("[CC3000 : HCI TX] "x"\r\n", ##__VA_ARGS__); #endif - + #else #define DBG_HCI_CMD(x, ...) #endif @@ -113,7 +113,7 @@ #else #define DBG_CC(x, ...) std::printf("[CC3000] "x"\r\n", ##__VA_ARGS__); #endif - + #else #define DBG_CC(x, ...) #endif @@ -166,68 +166,149 @@ */ bool get_tx_complete_signal(); /** + * \brief + * \param + * \return */ void set_tx_complete_signal(bool value); /** + * \brief + * \param + * \return */ uint8_t *get_received_buffer(); /** + * \brief + * \param + * \return */ void set_received_buffer(uint8_t value); /** + * \brief + * \param + * \return */ uint8_t *get_transmit_buffer(); /** + * \brief + * \param + * \return */ void set_transmit_buffer(uint8_t value); /** + * \brief + * \param + * \return */ uint16_t get_number_free_buffers(); /** + * \brief + * \param + * \return */ void set_number_free_buffers(uint16_t value); /** + * \brief + * \param + * \return */ uint16_t get_buffer_length(); /** + * \brief + * \param + * \return */ void set_buffer_length(uint16_t value); /** + * \brief + * \param + * \return */ uint16_t get_pending_data(); /** + * \brief + * \param + * \return */ void set_pending_data(uint16_t value); /** + * \brief + * \param + * \return */ uint16_t get_op_code(); /** + * \brief + * \param + * \return */ void set_op_code(uint16_t code); /** + * \brief + * \param + * \return */ uint16_t get_released_packets(); /** + * \brief + * \param + * \return */ void set_number_of_released_packets(uint16_t value); /** + * \brief + * \param + * \return */ uint16_t get_sent_packets(); /** + * \brief + * \param + * \return */ void set_sent_packets(uint16_t value); - + /** + * \brief + * \param + * \return + */ int32_t get_transmit_error(); + /** + * \brief + * \param + * \return + */ void set_transmit_error(int32_t value); - + /** + * \brief + * \param + * \return + */ uint16_t get_buffer_size(void); + /** + * \brief + * \param + * \return + */ void set_buffer_size(uint16_t value); - + /** + * \brief + * \param + * \return + */ void *get_func_pointer(FunctionNumber function); - + /** + * \brief + * \param + * \return + */ uint8_t *get_received_data(void); + /** + * \brief + * \param + * \return + */ void set_received_data(uint8_t *pointer); - private: uint8_t _data_received_flag; bool _tx_complete_signal; @@ -259,20 +340,83 @@ */ class cc3000_event { public: + /** + * \brief + * \param + * \return + */ cc3000_event(cc3000_simple_link &simplelink, cc3000_hci &hci, cc3000_spi &spi, cc3000 &cc3000); - ~cc3000_event(); - + /** + * \brief + * \param + * \return + */ + ~cc3000_event(); + /** + * \brief + * \param + * \return + */ void hci_unsol_handle_patch_request(uint8_t *event_hdr); + /** + * \brief + * \param + * \return + */ uint8_t *hci_event_handler(void *ret_param, uint8_t *from, uint8_t *fromlen); + /** + * \brief + * \param + * \return + */ int32_t hci_unsol_event_handler(uint8_t *event_hdr); + /** + * \brief + * \param + * \return + */ int32_t hci_unsolicited_event_handler(void); + /** + * \brief + * \param + * \return + */ int32_t get_socket_active_status(int32_t sd); + /** + * \brief + * \param + * \return + */ void set_socket_active_status(int32_t sd, int32_t status); + /** + * \brief + * \param + * \return + */ int32_t hci_event_unsol_flowcontrol_handler(uint8_t *event); + /** + * \brief + * \param + * \return + */ void update_socket_active_status(uint8_t *resp_params); + /** + * \brief + * \param + * \return + */ void simplelink_wait_event(uint16_t op_code, void *ret_param); + /** + * \brief + * \param + * \return + */ void simplelink_wait_data(uint8_t *buffer, uint8_t *from, uint8_t *fromlen); - + /** + * \brief + * \param + * \return + */ void received_handler(uint8_t *buffer); private: uint32_t socket_active_status; @@ -284,16 +428,66 @@ class cc3000_netapp { public: + /** + * \brief + * \param + * \return + */ cc3000_netapp(cc3000_simple_link &simple_link, cc3000_nvmem &nvmem, cc3000_hci &hci, cc3000_event &event); + /** + * \brief + * \param + * \return + */ ~cc3000_netapp(); + /** + * \brief + * \param + * \return + */ int32_t config_mac_adrress(uint8_t *mac); + /** + * \brief + * \param + * \return + */ int32_t dhcp(uint32_t *ip, uint32_t *subnet_mask,uint32_t *default_gateway, uint32_t *dns_server); #ifndef CC3000_TINY_DRIVER + /** + * \brief + * \param + * \return + */ void ipconfig(tNetappIpconfigRetArgs *ipconfig); + /** + * \brief + * \param + * \return + */ int32_t timeout_values(uint32_t *dhcp, uint32_t *arp,uint32_t *keep_alive, uint32_t *inactivity); + /** + * \brief + * \param + * \return + */ int32_t ping_send(uint32_t *ip, uint32_t ping_attempts, uint32_t ping_size, uint32_t ping_timeout); + /** + * \brief + * \param + * \return + */ void ping_report(); + /** + * \brief + * \param + * \return + */ int32_t ping_stop(); + /** + * \brief + * \param + * \return + */ int32_t arp_flush(); #endif private: @@ -306,13 +500,53 @@ #ifndef CC3000_UNENCRYPTED_SMART_CONFIG class cc3000_security { public: + /** + * \brief + * \param + * \return + */ void expandKey(uint8_t *expanded_key, uint8_t *key); + /** + * \brief + * \param + * \return + */ uint8_t galois_mul2(uint8_t value); + /** + * \brief + * \param + * \return + */ void aes_encr(uint8_t *state, uint8_t *expanded_key); + /** + * \brief + * \param + * \return + */ void aes_decr(uint8_t *state, uint8_t *expanded_key); + /** + * \brief + * \param + * \return + */ void aes_encrypt(uint8_t *state, uint8_t *key); + /** + * \brief + * \param + * \return + */ void aes_decrypt(uint8_t *state, uint8_t *key); + /** + * \brief + * \param + * \return + */ int32_t aes_read_key(uint8_t *key); + /** + * \brief + * \param + * \return + */ int32_t aes_write_key(uint8_t *key); private: uint8_t _expanded_key[176]; @@ -321,26 +555,121 @@ class cc3000_socket { public: + /** + * \brief + * \param + * \return + */ cc3000_socket(cc3000_simple_link &simplelink, cc3000_hci &hci, cc3000_event &event); + /** + * \brief + * \param + * \return + */ ~cc3000_socket(); + /** + * \brief + * \param + * \return + */ int32_t socket(int32_t domain, int32_t type, int32_t protocol); + /** + * \brief + * \param + * \return + */ int32_t accept(int32_t sd, sockaddr *addr, socklen_t *addrlen); + /** + * \brief + * \param + * \return + */ int32_t bind(int32_t sd, const sockaddr *addr, int32_t addrlen); + /** + * \brief + * \param + * \return + */ int32_t HostFlowControlConsumeBuff(int32_t sd); + /** + * \brief + * \param + * \return + */ int32_t closesocket(int32_t sd); + /** + * \brief + * \param + * \return + */ int32_t listen(int32_t sd, int32_t backlog); + /** + * \brief + * \param + * \return + */ int32_t connect(int32_t sd, const sockaddr *addr, int32_t addrlen); + /** + * \brief + * \param + * \return + */ int32_t select(int32_t nfds, fd_set *readsds, fd_set *writesds, fd_set *exceptsds, struct timeval *timeout); + /** + * \brief + * \param + * \return + */ int32_t getsockopt (int32_t sd, int32_t level, int32_t optname, void *optval, socklen_t *optlen); + /** + * \brief + * \param + * \return + */ int32_t simple_link_recv(int32_t sd, void *buf, int32_t len, int32_t flags, sockaddr *from, socklen_t *fromlen, int32_t opcode); + /** + * \brief + * \param + * \return + */ int32_t simple_link_send(int32_t sd, const void *buf, int32_t len, int32_t flags, const sockaddr *to, int32_t tolen, int32_t opcode); + /** + * \brief + * \param + * \return + */ int32_t recv(int32_t sd, void *buf, int32_t len, int32_t flags); + /** + * \brief + * \param + * \return + */ int32_t recvfrom(int32_t sd, void *buf, int32_t len, int32_t flags, sockaddr *from, socklen_t *fromlen); + /** + * \brief + * \param + * \return + */ int32_t send(int32_t sd, const void *buf, int32_t len, int32_t flags); + /** + * \brief + * \param + * \return + */ int32_t sendto(int32_t sd, const void *buf, int32_t len, int32_t flags, const sockaddr *to, socklen_t tolen); + /** + * \brief + * \param + * \return + */ int32_t mdns_advertiser(uint16_t mdns_enabled, uint8_t * device_service_name, uint16_t device_service_name_length); #ifndef CC3000_TINY_DRIVER int32_t gethostbyname(uint8_t *hostname, uint16_t name_length, uint32_t *out_ip_addr); + /** + * \brief + * \param + * \return + */ int32_t setsockopt(int32_t sd, int32_t level, int32_t optname, const void *optval, socklen_t optlen); #endif private: @@ -376,33 +705,63 @@ */ uint32_t first_write(uint8_t *buffer, uint16_t length); /** + * \brief + * \param + * \return */ uint32_t write(uint8_t *buffer, uint16_t length); /** + * \brief + * \param + * \return */ void write_synchronous(uint8_t *data, uint16_t size); /** + * \brief + * \param + * \return */ void read_synchronous(uint8_t *data, uint16_t size); /** + * \brief + * \param + * \return */ uint32_t read_data_cont(); /** + * \brief + * \param + * \return */ void wlan_irq_enable(); /** + * \brief + * \param + * \return */ void wlan_irq_disable(); /** + * \brief + * \param + * \return */ void wlan_irq_set(uint8_t value); /** + * \brief + * \param + * \return */ uint32_t wlan_irq_read(); /** + * \brief + * \param + * \return */ void WLAN_IRQHandler(); /** + * \brief + * \param + * \return */ void write_wlan_en(uint8_t value); private: @@ -419,13 +778,56 @@ class cc3000_hci { public: + /** + * \brief Ctor + * \param spi Reference to spi object. + * \return none + */ cc3000_hci(cc3000_spi &spi); + /** + * \brief Dtor + * \param none + * \return none + */ ~cc3000_hci(); + /** + * \brief Initiate an HCI command. + * \param op_code command operation code + * \param buffer pointer to the command's arguments buffer + * \param length length of the arguments + * \return ??? + */ uint16_t command_send(uint16_t op_code, uint8_t *buffer, uint8_t length); + /** + * \brief Initiate an HCI data write operation + * \param op_code command operation code + * \param args pointer to the command's arguments buffer + * \param arg_length length of the arguments + * \param data_length length od data + * \param tail pointer to the data buffer + * \param tail_length buffer length + * \return ??? + */ uint32_t data_send(uint8_t op_code, uint8_t *args, uint16_t arg_length, uint16_t data_length, const uint8_t *tail, uint16_t tail_length); + /** + * \brief Prepare HCI header and initiate an HCI data write operation. + * \param op_code command operation code + * \param buffer pointer to the data buffer + * \param arg_length arguments length + * \param data_length data length + * \return none + */ void data_command_send(uint16_t op_code, uint8_t *buffer, uint8_t arg_length, uint16_t data_length); + /** + * \brief Prepare HCI header and initiate an HCI patch write operation. + * \param op_code command operation code + * \param buffer pointer to the command's arguments buffer + * \param patch pointer to patch content buffer + * \param data_length data length + * \return none + */ void patch_send(uint8_t op_code, uint8_t *buffer, uint8_t *patch, uint16_t data_length); private: cc3000_spi &_spi; @@ -433,15 +835,82 @@ class cc3000_nvmem { public: - cc3000_nvmem(cc3000_hci &hci, cc3000_event &_event,cc3000_simple_link &simple_link); + /** + * \brief Ctor + * \param hci Reference to hci object. + * \param event Reference to event object. + * \param simple_link Reference to simple link object. + * \return none + */ + cc3000_nvmem(cc3000_hci &hci, cc3000_event &event, cc3000_simple_link &simple_link); + /** + * \brief Dtor + * \param none + * \return none + */ ~cc3000_nvmem(); + /** + * \brief Reads data from the file referred by the file_id parameter. + * Reads data from file offset till length. Err if the file can't be used, + * is invalid, or if the read is out of bounds. + * \param file_id nvmem file id. + * \param length number of bytes to read. + * \param offset offset in file from where to read. + * \param buff output buffer pointer. + * \return + * Number of bytes read, otherwise error. + */ int32_t read(uint32_t file_id, uint32_t length, uint32_t offset, uint8_t *buff); + /** + * \brief Write data to nvmem. + * \param file_id Nvmem file id + * \param length number of bytes to write + * \param entry_offset offset in file to start write operation from + * \param buff data to write + * \return + * On success 0, error otherwise. + */ int32_t write(uint32_t file_id, uint32_t length, uint32_t entry_offset, uint8_t *buff); + /** + * \brief Write MAC address to EEPROM. + * \param mac Mac address to be set + * \return + * On success 0, error otherwise. + */ uint8_t set_mac_address(uint8_t *mac); + /** + * \brief Read MAC address from EEPROM. + * \param mac Mac address + * \return + * on success 0, error otherwise. + */ uint8_t get_mac_address(uint8_t *mac); + /** + * \brief Program a patch to a specific file ID. The SP data is assumed to be organized in 2-dimensional. + * Each line is SP_PORTION_SIZE bytes long. + * \param file_id nvmem file id/ + * \param length number of bytes to write + * \param data SP data to write + * \return + * On success 0, error otherwise. + */ uint8_t write_patch(uint32_t file_id, uint32_t length, const uint8_t *data); + /** + * \brief Create new file entry and allocate space on the NVMEM. Applies only to user files. + * \param file_id nvmem file Id + * \param new_len entry ulLength + * \return + */ int32_t create_entry(uint32_t file_id, uint32_t new_len); #ifndef CC3000_TINY_DRIVER + /** + * \brief Read patch version. read package version (WiFi FW patch, river-supplicant-NS patch, + * bootloader patch) + * \param patch_ver First number indicates package ID and the second number indicates + * package build number + * \return + * On success 0, error otherwise. + */ uint8_t read_sp_version(uint8_t* patch_ver); #endif private: @@ -452,46 +921,200 @@ class cc3000_wlan { public: + /** + * \brief Ctor + * \param simple_link Reference to simple link object. + * \param event Reference to event object. + * \param spi Reference to spi object. + * \param hci Reference to hci object. + * \return none + */ cc3000_wlan(cc3000_simple_link &simple_link, cc3000_event &event, cc3000_spi &spi, cc3000_hci &hci); + /** + * \brief Dtor + * \param none + * \return none + */ ~cc3000_wlan(); - /** Send SIMPLE LINK START to cc3000 - * \param patches_available_host Flag to indicate if patches are available + /** + * \brief Send SIMPLE LINK START to cc3000. + * \param patches_available_host Flag to indicate if patches are available. * \return none */ void simpleLink_init_start(uint16_t patches_available_host); - /** Start wlan device. Blocking call until init is completed - * \param patches_available_host Flag to indicate if patches are available + /** + * \brief Start wlan device. Blocking call until init is completed. + * \param patches_available_host Flag to indicate if patches are available. * \return none */ void start(uint16_t patches_available_host); - /** Stop wlan device + /** + * \brief Stop wlan device * \param none * \return none */ void stop(void); #ifndef CC3000_TINY_DRIVER + /** + * \brief Connect to AP. + * \param sec_type Security option. + * \param ssid up to 32 bytes, ASCII SSID + * \param ssid_length length of SSID + * \param b_ssid 6 bytes specified the AP bssid + * \param key up to 16 bytes specified the AP security key + * \param key_len key length + * \return + * On success, zero is returned. On error, negative is returned. + */ int32_t connect(uint32_t sec_type, const uint8_t *ssid, int32_t ssid_length, uint8_t *b_ssid, uint8_t *key, int32_t key_len); + /** + * \brief Add profile. Up to 7 profiles are supported. + * \param sec_type Security option. + * \param ssid Up to 32 bytes, ASCII SSID + * \param ssid_length Length of SSID + * \param b_ssid 6 bytes specified the AP bssid + * \param priority Up to 16 bytes specified the AP security key + * \param pairwise_cipher_or_tx_key_len Key length + * \param group_cipher_tx_key_index Key length for WEP security + * \param key_mgmt KEY management + * \param pf_or_key Security key + * \param pass_phrase_length Security key length for WPA\WPA2 + * \return + * On success, zero is returned. On error, negative is returned. + */ int32_t add_profile(uint32_t sec_type, uint8_t* ssid, uint32_t ssid_length, uint8_t *b_ssid, uint32_t priority, uint32_t pairwise_cipher_or_tx_key_len, uint32_t group_cipher_tx_key_index, uint32_t key_mgmt, uint8_t* pf_or_key, uint32_t pass_phrase_length); + /** + * \brief Gets entry from scan result table. The scan results are returned + * one by one, and each entry represents a single AP found in the area. + * \param scan_timeout Not supported yet + * \param results Scan result + * \return + * On success, zero is returned. On error, -1 is returned + */ int32_t ioctl_get_scan_results(uint32_t scan_timeout, uint8_t *results); + /** + * \brief Start and stop scan procedure. Set scan parameters. + * \param enable Start/stop application scan + * \param min_dwell_time Minimum dwell time value to be used for each channel, in ms. (Default: 20) + * \param max_dwell_time Maximum dwell time value to be used for each channel, in ms. (Default: 30) + * \param num_probe_requests Max probe request between dwell time. (Default:2) + * \param channel_mask Bitwise, up to 13 channels (0x1fff). + * \param rssi_threshold RSSI threshold. Saved: yes (Default: -80) + * \param snr_threshold NSR threshold. Saved: yes (Default: 0) + * \param default_tx_power probe Tx power. Saved: yes (Default: 205) + * \param interval_list Pointer to array with 16 entries (16 channels) + * \return + * On success, zero is returned. On error, -1 is returned. + */ int32_t ioctl_set_scan_params(uint32_t enable, uint32_t min_dwell_time, uint32_t max_dwell_time, uint32_t num_probe_requests, uint32_t channel_mask, int32_t rssi_threshold, uint32_t snr_threshold, uint32_t default_tx_power, uint32_t *interval_list); + /** + * \brief Get wlan status: disconnected, scanning, connecting or connected + * \param none + * \return + * WLAN_STATUS_DISCONNECTED, WLAN_STATUS_SCANING, STATUS_CONNECTING or WLAN_STATUS_CONNECTED + */ int32_t ioctl_statusget(void); #else + /** + * \brief Connect to AP + * \param ssid Up to 32 bytes and is ASCII SSID of the AP + * \param ssid_length Length of the SSID + * \return + * On success, zero is returned. On error, negative is returned. + */ int32_t connect(const uint8_t *ssid, int32_t ssid_length); + /** + * \brief When auto start is enabled, the device connects to station from the profiles table. + * If several profiles configured the device choose the highest priority profile. + * \param sec_type WLAN_SEC_UNSEC,WLAN_SEC_WEP,WLAN_SEC_WPA,WLAN_SEC_WPA2 + * \param ssid SSID up to 32 bytes + * \param ssid_length SSID length + * \param b_ssid bssid 6 bytes + * \param priority Profile priority. Lowest priority:0. + * \param pairwise_cipher_or_tx_key_len Key length for WEP security + * \param group_cipher_tx_key_index Key index + * \param key_mgmt KEY management + * \param pf_or_key Security key + * \param pass_phrase_length Security key length for WPA\WPA2 + * \return + * On success, zero is returned. On error, -1 is returned + */ int32_t add_profile(uint32_t sec_type, uint8_t *ssid, uint32_t ssid_length, uint8_t *b_ssid, uint32_t priority, uint32_t pairwise_cipher_or_tx_key_len, uint32_t group_cipher_tx_key_index, uint32_t key_mgmt, uint8_t* pf_or_key, uint32_t pass_phrase_length); #endif #ifndef CC3000_UNENCRYPTED_SMART_CONFIG + /** + * \brief Process the acquired data and store it as a profile. + * \param none + * \return + * On success, zero is returned. On error, -1 is returned. + */ int32_t smart_config_process(void); #endif + /** + * \brief Disconnect connection from AP. + * \param none + * \return + * 0 if disconnected done, other CC3000 already disconnected. + */ int32_t disconnect(); + /** + * \brief When auto is enabled, the device tries to connect according the following policy: + * 1) If fast connect is enabled and last connection is valid, the device will try to + * connect to it without the scanning procedure (fast). The last connection will be + * marked as invalid, due to adding/removing profile. + * 2) If profile exists, the device will try to connect it (Up to seven profiles). + * 3) If fast and profiles are not found, and open mode is enabled, the device + * will try to connect to any AP. + * Note that the policy settings are stored in the CC3000 NVMEM. + * \param should_connect_to_open_ap Enable(1), disable(0) connect to any available AP. + * \param use_fast_connect Enable(1), disable(0). if enabled, tries to + * connect to the last connected AP. + * \param use_profiles Enable(1), disable(0) auto connect after reset. + * and periodically reconnect if needed. + * \return + * On success, zero is returned. On error, -1 is returned + */ int32_t ioctl_set_connection_policy(uint32_t should_connect_to_open_ap, uint32_t use_fast_connect, uint32_t use_profiles); + /** + * \brief Delete WLAN profile + * \param index Number of profile to delete + * \return + * On success, zero is returned. On error, -1 is returned + */ int32_t ioctl_del_profile(uint32_t index); + /** + * \brief Mask event according to bit mask. In case that event is + * masked (1), the device will not send the masked event to host. + * \param mask event mask + * \return + * On success, zero is returned. On error, -1 is returned + */ int32_t set_event_mask(uint32_t mask); + /** + * \brief Start to acquire device profile. The device acquire its own + * profile, if profile message is found. + * \param encrypted_flag Indicates whether the information is encrypted + * \return + * On success, zero is returned. On error, -1 is returned. + */ int32_t smart_config_start(uint32_t encrypted_flag); + /** + * \brief Stop the acquire profile procedure. + * \param none + * \return + * On success, zero is returned. On error, -1 is returned + */ int32_t smart_config_stop(void); + /** + * \brief Configure station ssid prefix. + * \param new_prefix 3 bytes identify the SSID prefix for the Smart Config. + * \return + * On success, zero is returned. On error, -1 is returned. + */ int32_t smart_config_set_prefix(uint8_t *new_prefix); private: cc3000_simple_link &_simple_link; @@ -566,16 +1189,18 @@ */ class cc3000 { public: + /** status structure */ typedef struct { - bool dhcp; - bool connected; + bool dhcp; + bool connected; uint8_t socket; - bool smart_config_complete; - bool stop_smart_config; - bool dhcp_configured; - bool ok_to_shut_down; + bool smart_config_complete; + bool stop_smart_config; + bool dhcp_configured; + bool ok_to_shut_down; } tStatus; - /** ctor for cc3000 class. + /** + * \brief Ctor. * \param cc3000_irq IRQ pin * \param cc3000_en Enable pin * \param cc3000_cs Chip select pin @@ -583,93 +1208,111 @@ * \param irq_port IRQ pin's port */ cc3000(PinName cc3000_irq, PinName cc3000_en, PinName cc3000_cs, SPI cc3000_spi, IRQn_Type irq_port); - /** dtor + /** + * \brief Dtor. */ ~cc3000(); - /** Initiate cc3000. It starts the wlan communication and deletes profiles. + /** + * \brief Initiate cc3000. It starts the wlan communication and deletes profiles. * \param patch Patch */ void start(uint8_t patch); - /** Stops the wlan communication. + /** + * \brief Stops the wlan communication. */ void stop(); - /** Restarts the wlan communication. + /** + * \brief Restarts the wlan communication. */ void restart(uint8_t patch); - /** Disconnect wlan device + /** + * \brief Disconnect wlan device * */ bool disconnect(void); - /** Callback which is called from the event class. This updates status of cc3000. + /** + * \brief Callback which is called from the event class. This updates status of cc3000. * \param event_type Type of the event * \param data Pointer to data * \param length Length of data * \return none */ void usync_callback(int32_t event_type, uint8_t *data, uint8_t length); - /** Connect to SSID (open/secured) with timeout (10ms). + /** + * \brief Connect to SSID (open/secured) with timeout (10ms). * \param ssid SSID name * \param key Security key (if key = 0, open connection) * \param security_mode Security mode * \return true if connection was established, false otherwise. */ bool connect_to_AP(const uint8_t *ssid, const uint8_t *key, int32_t security_mode); - /** Connect to SSID which is secured + /** + * \brief Connect to SSID which is secured * \param ssid SSID name * \param key Security key * \param security_mode Security mode * \return true if connection was established, false otherwise. */ bool connect_secure(const uint8_t *ssid, const uint8_t *key, int32_t security_mode); - /** Connect to SSID which is open (no security) + /** + * \brief Connect to SSID which is open (no security) * \param ssid SSID name * \return true if connection was established, false otherwise. */ bool connect_open(const uint8_t *ssid); - /** Status of the cc3000 connection. + /** + * \brief Status of the cc3000 connection. * \return true if it's connected, false otherwise. */ bool is_connected(); - /** Status of DHCP. + /** + * \brief Status of DHCP. * \param none * \return true if DCHP is configured, false otherwise. */ bool is_dhcp_configured(); - /** Status of smart confing completation. + /** + * \brief Status of smart confing completation. * \param none * \return smart config was set, false otherwise. */ bool is_smart_confing_completed(); - /** Return the cc3000's mac address. + /** + * \brief Return the cc3000's mac address. * \param address Retreived mac address. * \return */ uint8_t get_mac_address(uint8_t address[6]); - /** Set the cc3000's mac address - * \param address Mac address to be set + /** + * \brief Set the cc3000's mac address. + * \param address Mac address to be set. * \return */ uint8_t set_mac_address(uint8_t address[6]); - /** Get user file info - * \param info_file Pointer where info will be stored - * \param size Available size + /** + * \brief Get user file info. + * \param info_file Pointer where info will be stored. + * \param size Available size. * \return none */ void get_user_file_info(uint8_t *info_file, size_t size); - /** Set user filo info - * \param info_file Pointer to user's info + /** + * \brief Set user filo info. + * \param info_file Pointer to user's info. * \return none */ void set_user_file_info(uint8_t *info_file, size_t size); - /** Start smart config - * \param smart_config_key Pointer to smart config key + /** + * \brief Start smart config. + * \param smart_config_key Pointer to smart config key. * \return none */ void start_smart_config(const uint8_t *smart_config_key); /* TODO enable AES ? */ #ifndef CC3000_TINY_DRIVER - /** Return ip configuration - * \param ip_config Pointer to ipconfig data - * \return true if it's connected and info was retrieved, false otherwise. + /** + * \brief Return ip configuration. + * \param ip_config Pointer to ipconfig data. + * \return true if it's connected and info was retrieved, false otherwise. */ bool get_ip_config(tNetappIpconfigRetArgs *ip_config); #endif @@ -685,22 +1328,32 @@ * \return server with socket != -1 */ cc3000_server create_tcp_server(uint32_t ip_address, uint16_t port); - /** Creates udp client + /** + * \brief Creates udp client * \param ip_address Server's IP address * \param port Server's PORT * \return client with socket != -1 */ cc3000_client create_udp_client(uint32_t ip_address, uint16_t port); - /** Delete all stored profiles - * \param none + /** + * \brief Delete all stored profiles + * \param none * \return none */ void delete_profiles(void); /** - * + * \brief Ping an ip address + * \param ip Destination IP address + * \param attempts Number of attempts + * \param timeout Time to wait for a response,in milliseconds. + * \param size Send buffer size which may be up to 1400 bytes */ uint32_t ping(uint32_t ip, uint8_t attempts, uint16_t timeout, uint8_t size); - + /** + * \brief Returns cc3000 instance + * \param none + * \return Pointer to cc3000 object + */ static cc3000 *get_instance() { return _inst; } @@ -725,35 +1378,35 @@ }; /** -* Copy 32 bit to stream while converting to little endian format. -* @param p pointer to the new stream -* @param u32 pointer to the 32 bit -* @return pointer to the new stream -*/ + * Copy 32 bit to stream while converting to little endian format. + * @param p pointer to the new stream + * @param u32 pointer to the 32 bit + * @return pointer to the new stream + */ uint8_t *UINT32_TO_STREAM_f (uint8_t *p, uint32_t u32); /** -* Copy 16 bit to stream while converting to little endian format. -* @param p pointer to the new stream -* @param u32 pointer to the 16 bit -* @return pointer to the new stream -*/ + * Copy 16 bit to stream while converting to little endian format. + * @param p pointer to the new stream + * @param u32 pointer to the 16 bit + * @return pointer to the new stream + */ uint8_t *UINT16_TO_STREAM_f (uint8_t *p, uint16_t u16); /** -* Copy received stream to 16 bit in little endian format. -* @param p pointer to the stream -* @param offset offset in the stream -* @return pointer to the new 16 bit -*/ + * Copy received stream to 16 bit in little endian format. + * @param p pointer to the stream + * @param offset offset in the stream + * @return pointer to the new 16 bit + */ uint16_t STREAM_TO_UINT16_f(uint8_t* p, uint16_t offset); /** -* Copy received stream to 32 bit in little endian format. -* @param p pointer to the stream -* @param offset offset in the stream -* @return pointer to the new 32 bit -*/ + * Copy received stream to 32 bit in little endian format. + * @param p pointer to the stream + * @param offset offset in the stream + * @return pointer to the new 32 bit + */ uint32_t STREAM_TO_UINT32_f(uint8_t* p, uint16_t offset); } /* end of mbed_cc3000 namespace */