I want to know how to send with CYBT-213043-MESH any messages to mesh provision client

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
jama_4535901
Level 3
Level 3
10 sign-ins 5 sign-ins 25 replies posted

hello can you help me

I have a program that scans ble devices like cell phones and I can show them in uart but I want to send this data by ble mesh to a cybt-213043. mesh provision client

Can you tell me what examples can I use or give me some advice?

this image shows the application

TRJ.png

0 Likes
1 Solution
5 Replies
DheerajPK_41
Moderator
Moderator
Moderator
750 replies posted 500 likes received 500 replies posted

Hi,

You can try modifying your mesh_provisioner_client application to receive the "scan data from the program" through UART. 

And if you want to share this data over mesh you can create a vendor specific model (vendor_specific_app) and share the data using it.

Thanks,

-Dheeraj

For example

I have a card (A) CYBT-213043-MESH with a scan code that can be seen by the host of the cell phones I want this card to send a message from the host of the cell phone to card (B) CYBT-213043-MESH with the PRISIONT CLIENT code,

Do you recommend that I combine the scan code that I already have with the mesh_vendor code on card (A) CYBT-213043-MESH?

and then

Does card (A) CYBT-213043-MESH mesh send a message with the host of the cell phone to card (B) CYBT-213043-MESH with provisiont_cient program?

if this is correct, can you tell me what things I can modify and how I can combine my scan code with that of mesh-vendor

please

Can you send the premade codes with the modifications?

here is the scan code

------------------------------------------------------------------------------

#include "wiced_bt_ble.h"

#include "wiced_bt_gatt.h"

#include "wiced_bt_mesh_models.h"

#include "wiced_bt_trace.h"

#include "wiced_bt_cfg.h"

#include "wiced_bt_mesh_app.h"

#include "wiced_platform.h"

#include "wiced_bt_cfg.h"

#include "app_bt_cfg.h"

#include "sparcommon.h"

#include "wiced_bt_dev.h"

#include "wiced_hal_puart.h"

#include "wiced_bt_stack.h"

#include "wiced_rtos.h"

#include "string.h"

#include "cycfg.h"

#include "wiced_timer.h"

static void     mesh_app_init(wiced_bool_t is_provisioned);

static void     mesh_hsl_server_message_handler(uint8_t element_idx, uint16_t event, void *p_data);

static void     mesh_light_hsl_process_set(uint8_t element_idx, wiced_bt_mesh_light_hsl_status_data_t *p_status);

extern const wiced_bt_cfg_settings_t wiced_bt_cfg_settings;

extern const wiced_bt_cfg_buf_pool_t wiced_bt_cfg_buf_pools[];

/******************************************************

*          Constants

******************************************************/

/* Convenient defines for thread sleep times */

#define SLEEP_1MS (1)       /* 1 segundo */

#define SLEEP_5MS (5)       /* 5 segundos */

#define SLEEP_10MS (10)       /* 10 segundos */

#define SLEEP_15MS (15)       /* 15 segundos */

/* Globally define wiced_timer_t structure */

wiced_timer_t timer;

wiced_timer_t timer2;

uint8_t Scanning = 1;

uint8_t Stop = 0;

uint8_t    i = 0;

/******************************************************

*          Structures

******************************************************/

/******************************************************

*          Function Prototypes

******************************************************/

wiced_bt_dev_status_t app_bt_management_callback      ( wiced_bt_management_evt_t event, wiced_bt_management_evt_data_t *p_event_data );

wiced_bt_gatt_status_t app_bt_gatt_callback            ( wiced_bt_gatt_evt_t event, wiced_bt_gatt_event_data_t *p_event_data );

void                    timer_cback                     ( uint32_t data );   // TIEMPO DE ESCANEO

void                    timer2_cback                    ( uint32_t data2 );  // TIEMPO DE PARO

/******************************************************

*          Variables Definitions

******************************************************/

/******************************************************

*               Function Definitions

******************************************************/

void application_start( void )

{

#if ((defined WICED_BT_TRACE_ENABLE) || (defined HCI_TRACE_OVER_TRANSPORT))

/* Select Debug UART setting to see debug traces on the appropriate port */

wiced_set_debug_uart( WICED_ROUTE_DEBUG_TO_PUART );

#endif

WICED_BT_TRACE( "**** CYW20819 App Start **** \r\n\n" );

/* Initialize Stack and Register Management Callback */

wiced_bt_stack_init( app_bt_management_callback, &wiced_bt_cfg_settings, wiced_bt_cfg_buf_pools );

}

/*******************************************************************************

* Function Name: wiced_bt_dev_status_t app_bt_management_callback(

* wiced_bt_management_evt_t event,

* wiced_bt_management_evt_data_t *p_event_data )

********************************************************************************/

wiced_result_t app_bt_management_callback( wiced_bt_management_evt_t event, wiced_bt_management_evt_data_t *p_event_data )

{

wiced_result_t status = WICED_BT_SUCCESS;

switch( event )

{

case BTM_ENABLED_EVT: // Bluetooth Controller and Host Stack Enabled

if( WICED_BT_SUCCESS == p_event_data->enabled.status )

{

WICED_BT_TRACE( "Bluetooth Enabled\r\n\n" );

/* Use Application Settings dialog to set BT_DEVICE_ADDRESS = random */

                  wiced_bt_device_address_t static_addr;

        wiced_bt_dev_read_local_addr(static_addr );

WICED_BT_TRACE( "Local Bluetooth Device Address: [%B]\r\n", static_addr );

             /* Start a periodic timer */

                wiced_init_timer( &timer, timer_cback, 0, WICED_SECONDS_TIMER );

                wiced_init_timer( &timer2, timer2_cback, 0, WICED_SECONDS_TIMER );

                wiced_start_timer( &timer, SLEEP_1MS);

}

break;

case BTM_LOCAL_IDENTITY_KEYS_REQUEST_EVT:

break;

case BTM_BLE_SCAN_STATE_CHANGED_EVT:

switch( p_event_data->ble_scan_state_changed )

{

case BTM_BLE_SCAN_TYPE_NONE:

WICED_BT_TRACE( " DISPOSITIVOS ESCANEADOS: %d\r\n",i);

WICED_BT_TRACE( "Scanning stopped.\r\n\n" );

                    i=0;

break;

case BTM_BLE_SCAN_TYPE_HIGH_DUTY:

WICED_BT_TRACE( "High duty scanning.\r\n" );

break;

}

break;

default:

WICED_BT_TRACE( "Unhandled Bluetooth Management Event: 0x%x (%d)\n", event, event );

break;

}

return status;

}

wiced_bt_gatt_status_t app_bt_gatt_callback( wiced_bt_gatt_evt_t event, wiced_bt_gatt_event_data_t *p_event_data )

{

wiced_result_t status = WICED_BT_SUCCESS;

switch( event )

{

case GATT_CONNECTION_STATUS_EVT:

break;

default:

WICED_BT_TRACE( "Unhandled GATT Event: 0x%x (%d)\n", event, event );

break;

}

return status;

}

/*******************************************************************************

* Function Name: void myScanCallback(

* wiced_bt_ble_scan_results_t *p_scan_result,

* uint8_t *p_adv_data )

********************************************************************************/

void myScanCallback( wiced_bt_ble_scan_results_t *p_scan_result, uint8_t *p_adv_data )

{

    WICED_BT_TRACE( "Hosty = %B RSSIy : %d\r\n", p_scan_result->remote_bd_addr,p_scan_result->rssi );

             i+=1;

}

/*******************************************************************************

* Function Name: void timer_cback( uint32_t *data )

********************************************************************************/

void timer_cback( uint32_t data )

{

if(( Scanning==1) & (Stop==0 ))  //LED AZUL

{

wiced_hal_gpio_set_pin_output(WICED_GPIO_PIN_LED_1,0);

wiced_hal_gpio_set_pin_output(WICED_GPIO_PIN_LED_2,1);

    wiced_bt_ble_scan(BTM_BLE_SCAN_TYPE_HIGH_DUTY, WICED_TRUE, myScanCallback );

    Scanning=0;

    Stop=1;

    wiced_start_timer( &timer2, SLEEP_1MS);

}

}

void timer2_cback( uint32_t data )

{

if(( Scanning==0) & (Stop==1 ))  //LED ROJO

{

wiced_hal_gpio_set_pin_output(WICED_GPIO_PIN_LED_2,0);

wiced_hal_gpio_set_pin_output(WICED_GPIO_PIN_LED_1,1);

    Scanning=1;

    Stop=0;

    wiced_start_timer( &timer, SLEEP_10MS);

}

}

0 Likes

Hi,

You can modify and combine the mesh application.

Currently, mesh uses "wiced_bt_ble_observe()" for scanning advertisement in an observer role. Mesh provisioner is the node which is capable of scanning advertisement from other devices. Please check mesh_application.c for more information.

What do you mean by " host of the cell phones" ?

What application will be running on the cell phone which connect to meshkits other than the provisioner node?

Thanks,

-Dheeraj

The CYBT-213043-MESH = A uses the code mesh_privision_client

and sends the message helloworld1 to the cards CYBT-213043-MESH = B AND CYBT-213043-MESH = C, This example already works

CYBT-213043-MESH = B and CYBT-213043-MESH = C boards use the example code mesh_vendor_specific_app

but i want this

I want CYBT-213043-MESH = B AND CYBT-213043-MESH = C boads reply or send a message hello world2 or another message to  CYBT-213043-MESH = A

please help me

this pictour shows the aplication

tree.png

0 Likes