Code Monkey home page Code Monkey logo

Comments (3)

lukaszradziak avatar lukaszradziak commented on August 21, 2024

try add:

BluetoothA2DPSink.h:

public:
  virtual void set_AVRC_metadata(void (*callBack)(uint8_t, const uint8_t*));

protected:
  void (*AVRC_metadata)(uint8_t, const uint8_t*) = NULL;

BluetoothA2DPSink.cpp

void BluetoothA2DPSink::set_AVRC_metadata(void (*callBack)(uint8_t, const uint8_t*)){
   this->AVRC_metadata = callBack;
}

and replace:

case ESP_AVRC_CT_METADATA_RSP_EVT: {
ESP_LOGI(BT_AV_TAG, "AVRC metadata rsp: attribute id 0x%x, %s", rc->meta_rsp.attr_id, rc->meta_rsp.attr_text);
free(rc->meta_rsp.attr_text);
break;
}

 case ESP_AVRC_CT_METADATA_RSP_EVT: {
        if (AVRC_metadata!=NULL){
            AVRC_metadata(rc->meta_rsp.attr_id, rc->meta_rsp.attr_text);
        }
        ESP_LOGI(BT_AV_TAG, "AVRC metadata rsp: attribute id 0x%x, %s", rc->meta_rsp.attr_id, rc->meta_rsp.attr_text);
        free(rc->meta_rsp.attr_text);
        break;
}

and in project:

void avrc_metadata_callback(uint8_t data1, const uint8_t *data2)
{
  Serial.printf("AVRC metadata rsp: attribute id 0x%x, %s\n", data1, data2);
}
a2dp_sink.set_AVRC_metadata(avrc_metadata_callback);
a2dp_sink.start("BT");

from esp32-a2dp.

biglee991228 avatar biglee991228 commented on August 21, 2024

@lukasilestam
thanks a lot !
I got it and successed
ESP_LOGD(BT_AV_TAG, "%s", func);
//Register notifications and request metadata
esp_avrc_ct_send_metadata_cmd(0, ESP_AVRC_MD_ATTR_TITLE | ESP_AVRC_MD_ATTR_ARTIST | ESP_AVRC_MD_ATTR_ALBUM | ESP_AVRC_MD_ATTR_GENRE | ESP_AVRC_MD_ATTR_PLAYING_TIME);//
esp_avrc_ct_send_register_notification_cmd(1, ESP_AVRC_RN_TRACK_CHANGE, 0);
and I added "ESP_AVRC_MD_ATTR_PLAYING_TIME"

from esp32-a2dp.

pschatzmann avatar pschatzmann commented on August 21, 2024

I have add this logic to the basic code.
Please note that the method to register the callback is called:

a2dp_sink.set_avrc_metadata_callback

from esp32-a2dp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.