question about one master connect to multiple slave

9个帖子/ 0新
Last post
RandyYu
Offline
Last seen:2年10个月前
Joined:2015-01-28 08:49
question about one master connect to multiple slave

dear dialog
first ,I'll describe my project,My slave is the SNM Module,after connected ,master should write request to slave,then the sensor data is transmit.
second, my master is modified from DSPS project.
Q1:当主站连接到Slave_1时,主站向其发送写请求(我将代码放在user_sps_client_enable_cfm_handler中)。然后主站可以接收传感器数据。
then connected to Slave_2,but master can't write request to Slave_2.
After debug I find after connected to Slave_1,then master change to SPS_CLIENT_CONNECTED.
所以我想问一下,如何处理sps_client_connected(我的意思是设置它?连接的slave_1或连接所有从属的)和app_connectable?或者是由其他原因引起的。
Q2:当主站连接到SLAVE_1并具有数据传输时,可以掌握发送控制CMD(通知)到SLAVE_2?
Q3:can master transmit data with Slave_1 and Slave_2 at the same time?or must exchange data by turn,if by turn how to change Slave_1 to Slave_2
Q4:do you have a better method to check master is at scaning state or not

thank for your reply

设备:
MT_dialog
Offline
Last seen:2个月2周前
Staff
Joined:2015-06-08 11:34
嗨兰迪宇,

嗨兰迪宇,

Q1。关于SPS_CLIENT_CONNECTED只是应用程序检查的配置文件的状态,以便知道设备是否已连接。建立连接时,调用user_on_connection回调以通知应用程序,在user_on_connection函数中,app_prf_enable()函数通过,并启用所有项目涉及的配置文件。在DSP项目中,由于DSP配置文件是唯一一个现有的配置文件,App_prf_enable()仅呼叫特定连接的user_sps_enable()。当在客户端中启用配置文件时,启动中央的发现过程,当发现过程结束时,DSPS客户端将应用程序的状态置于SPS_CLIENT_CONNECTION中。在将设备设置为连接时,在常规应用程序中取决于用户应用程序。

Q2. Q3. Regarding the multiple connections, as mentioned on this posthttp://support.dialog-semicondiondiond.com/ multiple-slaveda14580-connection ...DSPS doesn't support multiple connections on different peripherals, you would need heavy customization in order to achieve something like this, handling the SPS_CLIENT_CONNECTED isn't your problem. The DSPS assumes only one connection (conidx 0, which is the first connection you made). Please check the following posthttp://support.dialog-semicondiondiond.com/ multiple-slaveda14580-connection ...regarding the modifications one should consider in order to perform multiple transmition with the DSPS.

Q4. Since DSPS supports only one connection, after the connection is made the device considers it self connected, whenever you invoke the scanning operation the state of the TASK_APP becomes APP_CONNECTABLE and when a device gets connected it changes to APP_CONNECTED. In a multiple connections scenario after a connection is made the invocation of the user_scan_start() would change the TASK_APP state to APP_CONNECTABLE again, so thats a fair indication that the device is scanning.

Thanks MT_dialog

RandyYu
Offline
Last seen:2年10个月前
Joined:2015-01-28 08:49
Q2/Q3 The first URL is "This

Q2/Q3 The first URL is "This Page Could Not Be Found"

RandyYu
Offline
Last seen:2年10个月前
Joined:2015-01-28 08:49
I need the below functions to

我需要以下函数来启用从站发送数据

uint8_t measure_start[3] = {0x20, 0x03, 0x01};
/*write request*/
prf_gatt_write_ntf_ind(con_info, 0x16, PRF_CLI_START_NTF); //custom2 notify enable
prf_gatt_write_ntf_ind(con_info,0x13,prf_cli_start_ntf);// custom1通知启用
prf_gatt_write(con_info,0x18,measule_start,sizeof(uint8_t)* 3,gattc_write_no_response);

现在我有一个问题,
Q1:how many con_info in SPS Host environment variable?
Q2:how can I change the con_info for enable next slave?

MT_dialog
Offline
Last seen:2个月2周前
Staff
Joined:2015-06-08 11:34
嗨兰迪宇,

嗨兰迪宇,

In the DSPS, as it is structured, every time you perform a connection and a sps service discovery, the data related to a profile (the handles of your connection, the database structure that is discovered from the discovery procedure, and other information) are stored in an eviroment variable (that variable is initiated in the sps_client_init). In DSPS since its implemented to support only one connection that enviroment variable is tightly related to one SPS_TASK. When you perform for example a write to the peripheral, the macro PRF_CLIENT_GET_ENV is called in order to claim that data and fill in a local spsc_env_tag type variable. Since its made to support only one connection when the PRF_CLIENT_GET_ENV is called it retrives the only one spsc_env_tag which holds only one connection thus only one con_info.

You can try to use the app_env variable that stores the available connections made on the device and you can check how the con_info in the spsc enviroment is populated (in the sps_client_enable_req_handler), perhaps you can use only one enviroment and change only the connection information, but this is only a temporary solution since asi mentioned having the DSPS support multiple slaves需要沉重的定制而不仅仅是在原始代码上的调整.

Thanks MT_dialog

RandyYu
Offline
Last seen:2年10个月前
Joined:2015-01-28 08:49
Now I'm a little confusion on

现在我对这个多次连接的过程有点混乱,下面的过程是对吗?

->user_scan_start
- >将app_state更改为app_scanning(App_scanning由MySLEF的App_state添加)
- >转到连接所需的奴隶
->change APP_STATE to APP_CONNECTABLE
->user_on_scanning_completed
-> user_on_connection
->user_sps_enable
->send write request to the connected slave
->then repeat this process

MT_dialog
Offline
Last seen:2个月2周前
Staff
Joined:2015-06-08 11:34
嗨兰迪宇,

嗨兰迪宇,

拥有多个连接可能需要一个完全不同的方案才能知道设备的状态,我的意思是,当连接到第一个时可能会将您的设备状态有连接,但在此之后,您将再次开始扫描。这取决于申请如何处理其州。例如,在接近监视器应用中,处理多个连接时,当连接和扫描时,应用程序不会将其状态更改为扫描,但状态保持为连接。

Thanks MT_dialog

RandyYu
Offline
Last seen:2年10个月前
Joined:2015-01-28 08:49
the state you said is

1.the state you said is application state or task state?my task state is set to CONNECTED after connected。
2.如果主站连接到一个从站并具有数据交换,可以扫描主北峰吗?
3.if I want to set all the task index of TASK_APP state to CONNECTABLE,how can I modify ke_state_set(TASK_APP,APP_CONNECTABLE);

MT_dialog
Offline
Last seen:2个月2周前
Staff
Joined:2015-06-08 11:34
嗨兰迪宇,

嗨兰迪宇,

1. The state i refer to is the application state and not the profile state, if that is what you mean. If you are allready connected to a device and you are scanning for the next one the state of your profile should be connected, since on the DSPS accoring to the state of the profile the appropriate handlers are triggered. For example there are different handlers when the device is connected and different handlers available when the device is in discovering state.

2.我没有看到任何问题in that, you can be connected to one slave and keep on scanning.

3. Yes you change the state of a TASK by using the ke_state_set(application_task, state_of_the_task)

Thanks MT_dialog