uint16_t classic_cid_token_counter_ = 0x41;
-struct ClassicDynamicChannelInfo {
- uint16_t psm;
-};
-std::unordered_map<uint16_t, ClassicDynamicChannelInfo>
+std::unordered_map<uint16_t /* token */, uint16_t /* cid */>
classic_cid_token_to_channel_map_;
uint16_t add_classic_cid_token_entry(uint16_t psm) {
uint16_t new_token = classic_cid_token_counter_;
- classic_cid_token_to_channel_map_[new_token] = {psm};
+ classic_cid_token_to_channel_map_[new_token] = psm;
classic_cid_token_counter_++;
if (classic_cid_token_counter_ == 0) classic_cid_token_counter_ = 0x41;
return new_token;
}
bool bluetooth::shim::L2CA_DisconnectReq(uint16_t cid) {
- auto psm = classic_cid_token_to_channel_map_[cid].psm;
+ auto psm = classic_cid_token_to_channel_map_[cid];
if (classic_dynamic_channel_helper_map_.count(psm) == 0) {
LOG(ERROR) << __func__ << "Not registered psm: " << psm;
return false;
LOG(ERROR) << __func__ << "Invalid cid: " << cid;
return 0;
}
- auto psm = classic_cid_token_to_channel_map_[cid].psm;
+ auto psm = classic_cid_token_to_channel_map_[cid];
if (classic_dynamic_channel_helper_map_.count(psm) == 0) {
LOG(ERROR) << __func__ << "Not registered psm: " << psm;
return 0;
* Channel hygiene APIs
*/
bool bluetooth::shim::L2CA_GetRemoteCid(uint16_t lcid, uint16_t* rcid) {
- auto psm = classic_cid_token_to_channel_map_[lcid].psm;
+ auto psm = classic_cid_token_to_channel_map_[lcid];
if (classic_dynamic_channel_helper_map_.count(psm) == 0) {
LOG(ERROR) << __func__ << "Not registered psm: " << psm;
return false;