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.
问题1:当主设备连接到从设备1时,主设备向它发送一个写请求(我把代码放在user\u sps\u client\u enable\u cfm\u 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\u CLIENT\u CONNECTED(我的意思是什么时候设置?CONNECTED Slave\u 1还是CONNECTED all Slave)和APP\u CONNECTABLE?或者是其他原因造成的。
问题2:当主设备连接到从设备1并进行数据传输时,主设备能向从设备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
你好RandyYu,
问题1。关于SPS_CLIENT_CONNECTED只是应用程序检查配置文件的一种状态,以了解设备是否已连接。当建立连接时,将调用用户\u on \u连接回调来通知应用程序,在用户\u on \u连接函数中,app \u prf \u enable()函数将遍历并启用所有涉及项目的配置文件。在DSPS项目中,由于DSPS配置文件是唯一的现有配置文件,因此app\u prf\u enable()仅为特定连接调用用户\u sps\u enable()。在客户机中启用配置文件时,您将启动central的查找过程,当查找过程结束时,dsps客户机将应用程序的状态转换为SPS\U client\U CONNECTED。在一般应用程序中,将设备设置为已连接取决于用户应用程序。
Q2. Q3. Regarding the multiple connections, as mentioned on this posthttp://support.dialog-semiconductor.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-semiconductor.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
Q2/Q3 The first URL is "This Page Could Not Be Found"
我需要以下功能,使从机发送数据
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\u gatt\u write\u ntf\u ind(con\u info,0x13,prf\u CLI\u START\u ntf)//自定义1通知启用
prf\u gatt\u write(con\u info,0x18,measure\u start,sizeof(uint8\u t)*3,GATTC\u write\u NO\u RESPONSE);
现在我有一个问题,
Q1:how many con_info in SPS Host environment variable?
Q2:how can I change the con_info for enable next slave?
你好RandyYu,
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
现在我对这个多重连接的过程有点困惑,下面的过程对吗?
->user_scan_start
->将APP\u状态更改为APP\u SCANNING(APP\u SCANNING由myslef添加到APP\u状态)
->连接所需的从设备
->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
你好RandyYu,
拥有多个连接可能需要一个完全不同的方案,以便了解您的设备的状态,我的意思是,当连接到第一个连接时,您可能会将设备的状态设置为已连接,但之后您将再次开始扫描。应用程序将如何处理其状态取决于您。例如,在处理多个连接的接近监视器应用程序中,当连接并扫描时,应用程序不会将其状态更改为“扫描”,但状态保持为“已连接”。
Thanks MT_dialog
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);
你好RandyYu,
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