Skip to content

GitHub cs fw#376

Open
zhangyuan376 wants to merge 8 commits intoopen-vela:devfrom
zhangyuan376:github-cs-fw
Open

GitHub cs fw#376
zhangyuan376 wants to merge 8 commits intoopen-vela:devfrom
zhangyuan376:github-cs-fw

Conversation

@zhangyuan376
Copy link
Contributor

No description provided.

}

memcpy(bt_addr.addr, addr->a.val, sizeof(bt_address_t));
cs_msg_t* msg = cs_msg_new(CAPBLITIES_RECEIVED_EVT, &bt_addr);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Record address type as well.

BTW, cs_msg_t and CAPBLITIES_RECEIVED_EVT are not defined in this patch. We need to ensure each patch performs at least some function without critical issues.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, make message definition as the very first commit, followed by SAL interface definitions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This policy didn't exist during development; such detailed breakdowns were too manpower-intensive.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cs uses le for addr, and modifying this would involve significant changes. A separate section will be provided later to standardize the use of le addr.

memcpy(bt_addr.addr, addr->a.val, sizeof(bt_address_t));
cs_msg_t* msg = cs_msg_new(CAPBLITIES_RECEIVED_EVT, &bt_addr);
bt_srv_conn_le_cs_capabilities_t *capabilities = malloc(sizeof(bt_srv_conn_le_cs_capabilities_t));
memcpy(capabilities, params, sizeof(bt_srv_conn_le_cs_capabilities_t));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. bt_srv_conn_le_cs_capabilities_t is not defined in this commit.
  2. There should be a converson from struct bt_conn_le_cs_capabilities to bt_srv_conn_le_cs_capabilities_t. We can not ensure these two structure always the same.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. This policy didn't exist during development; such detailed breakdowns were too manpower-intensive.
  2. done

}

memcpy(bt_addr.addr, addr->a.val, sizeof(bt_address_t));
cs_msg_t* msg = cs_msg_new(PROCEDURE_DONE_EVT, &bt_addr);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cs_msg_t* msg = cs_msg_new(PROCEDURE_DONE_EVT, (bt_address_t*)addr->a.val);
No need to copy the address one more time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bt_addr_le_t is defined in zephyr, bt_address_t is defined in vela, It is not recommended to send the address directly.

/** Number of antenna paths used during the phase measurement stage.
*/
uint8_t num_antenna_paths;
/** Number of CS steps in the subevent.
Copy link
Contributor

@gzh-terry gzh-terry Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

num_steps_reported should be enough to describe the data contained in step_data_buf,
Why do we need an abort_step?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dito

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Step number, on which the subevent was aborted

uint8_t abort_step;
} header;

uint16_t len;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there only one step_data_buf in each sal_cs_subevent_result_t?
If so, num_steps_reported and len are redundant;
If not, we need multiple len + step_data_buf

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dito

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

num_steps_reported and len are not the same thing.


uint16_t len;
uint8_t *step_data_buf;
} sal_cs_subevent_result_t;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have Num_Antenna_Paths, Step_Mode[i], Step_Channel[i]?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dito


bt_status_t bt_sal_cs_read_remote_supported_capabilities(bt_controller_id_t id, bt_address_t* addr);
bt_status_t bt_sal_cs_set_default_settings(bt_controller_id_t id, bt_address_t* addr,
bt_le_srv_cs_set_default_settings_param_t* params);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add const for all the pointers, they should not be modified at SAL

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's necessary; other documents do the same.


CS_DBG_EVENT(sm, &cs_sm->addr, event);
switch (event) {
case CONNECTED_EVT:
Copy link
Contributor

@gzh-terry gzh-terry Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which event should be received when distance measure finished? CONNECTED_EVT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PROCEDURE_DONE_EVT

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no PROCEDURE_DONE_EVT in started_process_event


/** Procedure done status */
typedef enum {
GATTS_LE_CS_PROCEDURE_COMPLETE = 0x0,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These events are not belongs to GATT.


static bt_srv_conn_le_cs_capabilities_t* zblue_convert_cs_capabilities_to_service(struct bt_conn_le_cs_capabilities* params)
{

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this line.

memcpy(bt_addr.addr, addr->a.val, sizeof(bt_address_t));
msg = cs_msg_new(CAPABILITIES_RECEIVED_EVT, &bt_addr);
capabilities = zblue_convert_cs_capabilities_to_service(params);
msg->cs_data.data = (void*)capabilities;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually nobody is using this data?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leave it to the future


SAL_CHECK_RET_WITH_CONN(bt_le_cs_read_local_supported_capabilities(capabilities), 0, conn);

convert_cs_capabilities_to_service(params, capabilities);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bt_le_cs_read_local_supported_capabilities is assigned directly.
service->zephyr->service

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remember CMakeLists.txt

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modified by jialu later

bug: v/80281

Rootcause: CS needs to report config, subevent, and other callbacks.

Signed-off-by: zhangyuan20 <zhangyuan20@xiaomi.com>
bug: v/80281

Rootcause: Add control interfaces such as CS config to the SAL layer.

Signed-off-by: zhangyuan20 <zhangyuan20@xiaomi.com>
bug: v/80281

Rootcuase: add cs state machine to manager cs procedure.

Signed-off-by: zhangyuan20 <zhangyuan20@xiaomi.com>
bug: v/80281

Rootcause: Add a CS service to manage CS.

Signed-off-by: zhangyuan20 <zhangyuan20@xiaomi.com>
bug: v/80281

Rootcuase: this file used for ras server.

Signed-off-by: zhangyuan20 <zhangyuan20@xiaomi.com>
bug: v/80281

Rootcause: Add a socket server and client to enable communication between the user and Bluetooth.

Signed-off-by: zhangyuan20 <zhangyuan20@xiaomi.com>
bug: v/80281

Rootcause: Add bttool to test CS functionality

Signed-off-by: zhangyuan20 <zhangyuan20@xiaomi.com>
bug: v/80281

Rootcause: Add CS configuration and makefile to manage CS compilation.

Signed-off-by: zhangyuan20 <zhangyuan20@xiaomi.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants