Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
attdona committed Sep 23, 2017
1 parent d91dae1 commit 653c084
Show file tree
Hide file tree
Showing 20 changed files with 85 additions and 85 deletions.
4 changes: 2 additions & 2 deletions burba/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ BOCIAS_DIR ?= $(BOCIA_PYTHON)/samples/tmp
DIRS += $(BURBA)/sys

ifeq ($(BOARD), native)
USEMODULE += sbapp_native
USEMODULE += sbapi_native
endif
ifeq ($(BOARD), cc3200-launchxl)
USEMODULE += sbapp_cc3200 paho bocia protobuf-c
USEMODULE += sbapi_cc3200 paho bocia protobuf-c
INCLUDES += -I$(BURBA)/sys/protobuf-c -I$(BURBA)/sys/paho

endif
Expand Down
4 changes: 2 additions & 2 deletions burba/apps/hello-mqtt/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ int main(void) {
proto_uart_init();

// start the WLAN communication
sbapp_init(SBAPI_DEFAULT_CFG);
sbapi_init(SBAPI_DEFAULT_CFG);

sbapp_set_mode(ROLE_STA);
sbapi_set_mode(ROLE_STA);

while (1) {
msg_receive(&msg);
Expand Down
6 changes: 3 additions & 3 deletions burba/apps/hello-proto/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ int8_t proto_input_handler(channel_reader_t *rd, proto_msg_t command_id,
Profile *profile;
profile = (Profile *)obj;
DEBUG("ssid: %s - pwd: %s\n", profile->uid, profile->pwd);
sbapp_add_profile(profile->uid, profile->pwd);
sbapi_add_profile(profile->uid, profile->pwd);
rd->send(rd, ack_type, &ack);
break;
}
Expand Down Expand Up @@ -160,9 +160,9 @@ int main(void)
// start uart monitor
proto_uart_init();

sbapp_init(SBAPI_DEFAULT_CFG);
sbapi_init(SBAPI_DEFAULT_CFG);

sbapp_set_mode(ROLE_STA);
sbapi_set_mode(ROLE_STA);

while (1)
{
Expand Down
4 changes: 2 additions & 2 deletions burba/apps/tcp-simple-client/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ int main(void) {

msg_t msg;

sbapp_init(SBAPI_DEFAULT_CFG);
sbapi_init(SBAPI_DEFAULT_CFG);

simplelink_to_default_state();

sbapp_add_profile(ssid, password);
sbapi_add_profile(ssid, password);

while(1) {
msg_receive(&msg);
Expand Down
8 changes: 4 additions & 4 deletions burba/sys/bocia/bocia.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ int8_t proto_input_handler(channel_reader_t *rd, proto_msg_t command_id,
Profile *profile;
profile = (Profile *)obj;
DEBUG("ssid: %s - pwd: %s\n", profile->uid, profile->pwd);
sbapp_add_profile(profile->uid, profile->pwd);
sbapi_add_profile(profile->uid, profile->pwd);
rd->send(rd, ack_type, &ack);
break;
}
Expand Down Expand Up @@ -227,14 +227,14 @@ Config *bocia_toggle_board_mode(void) {

int16_t nprofiles;

nprofiles = sbapp_get_profiles();
nprofiles = sbapi_get_profiles();

// check if provisioned
config = bocia_get_config();
if (config && (nwp.role == ROLE_AP) && nprofiles > 0) {
sbapp_set_mode(ROLE_STA);
sbapi_set_mode(ROLE_STA);
} else if ((config == 0) && (nwp.role == ROLE_STA)) {
sbapp_set_mode(ROLE_AP);
sbapi_set_mode(ROLE_AP);
}

return config;
Expand Down
2 changes: 1 addition & 1 deletion burba/sys/bocia/bocia_mqtt.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ int16_t mqtt_connect(const char* hostname, uint16_t port, const char* id,
unsigned int uiCipher = SL_SEC_MASK_TLS_RSA_WITH_AES_256_CBC_SHA256;
#endif

//sbapp_init(SBAPI_DEFAULT_CFG);
//sbapi_init(SBAPI_DEFAULT_CFG);
ip_server = net_atoi(hostname);

// filling the TCP server socket address
Expand Down
2 changes: 1 addition & 1 deletion burba/sys/bocia/bocia_tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

#include <xtimer.h>

#include "sbapp.h"
#include "sbapi.h"
#include "bocia.h"

#define ENABLE_DEBUG (1)
Expand Down
2 changes: 1 addition & 1 deletion burba/sys/include/bocia.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#define SYS_INCLUDE_BOCIA_H_

#include "kernel_types.h"
#include "sbapp.h"
#include "sbapi.h"
#include "stdint.h"

#include "nais.h"
Expand Down
26 changes: 13 additions & 13 deletions burba/sys/include/sbapp.h → burba/sys/include/sbapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ enum conn_type_t {
typedef enum {
WLAN_SETTING,
SBAPI_STATUS,
} sbapp_opt_t;
} sbapi_opt_t;

/**
* @brief Default message queue size for the SBAPI thread
Expand Down Expand Up @@ -131,7 +131,7 @@ typedef void* sbh_t;
* @return PID of the UDP thread
* @return negative value on error
*/
int sbapp_init(uint32_t options);
int sbapi_init(uint32_t options);

long simplelink_to_default_state(void);

Expand All @@ -143,35 +143,35 @@ int16_t set_ap_password(char* pwd);

int16_t set_max_power(void);

int16_t sbapp_add_profile(const char* ssid, const char* pwd);
int16_t sbapi_add_profile(const char* ssid, const char* pwd);

uint16_t sbapp_get_profiles(void);
uint16_t sbapi_get_profiles(void);

int16_t sbapp_delete_all_profiles(void);
int16_t sbapi_delete_all_profiles(void);

/**
* @brief close the connection with the network processor
*/
int sbapp_stop(void);
int sbapi_stop(void);

/**
* @brief
*/
int16_t sbapp_set_mode(SlWlanMode_e mode);
int16_t sbapi_set_mode(SlWlanMode_e mode);


/**
* @brief
*/
int sbapp_configure(int32_t options);
int sbapi_configure(int32_t options);

/**
* @brief add a wifi profile
*/
int16_t sbapp_add_profile(const char* ssid, const char* pwd);
int16_t sbapi_add_profile(const char* ssid, const char* pwd);


int8_t sbapp_is_connected(uint16_t msec);
int8_t sbapi_is_connected(uint16_t msec);

/**
* @brief connect to a TCP or UDP server
Expand All @@ -184,7 +184,7 @@ int8_t sbapp_is_connected(uint16_t msec);
*
* @return the connection handle
*/
sbh_t sbapp_connect(uint8_t conn_type, uint32_t remote_ip, uint16_t port,
sbh_t sbapi_connect(uint8_t conn_type, uint32_t remote_ip, uint16_t port,
uint16_t local_port, kernel_pid_t pid);


Expand All @@ -197,7 +197,7 @@ sbh_t sbapp_connect(uint8_t conn_type, uint32_t remote_ip, uint16_t port,
*
* @return 1 on success -1 on error
*/
int sbapp_send(sbh_t fd, void* data, size_t len);
int sbapi_send(sbh_t fd, void* data, size_t len);


/**
Expand All @@ -210,7 +210,7 @@ int sbapp_send(sbh_t fd, void* data, size_t len);
*
* @return the number of transmitted bytes or -1 if an error occurred
*/
int sbapp_sendto(sbh_t fd, void* data, size_t len, SlSockAddrIn_t addr);
int sbapi_sendto(sbh_t fd, void* data, size_t len, SlSockAddrIn_t addr);


/**
Expand Down
File renamed without changes.

0 comments on commit 653c084

Please sign in to comment.