# Embed Accelerator Transfer plugin in another plugin?

**URL:** https://discourse.orthanc-server.org/t/embed-accelerator-transfer-plugin-in-another-plugin/3083
**Category:** Google Groups archive
**Created:** [September 30, 2022, 4:18pm UTC](https://discourse.orthanc-server.org/t/embed-accelerator-transfer-plugin-in-another-plugin/3083 "2022-09-30T16:18:44Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Audrey\_Gross](https://discourse.orthanc-server.org/letter_avatar_proxy/v4/letter/a/b487fb/32.png) [@Audrey\_Gross](https://discourse.orthanc-server.org/u/Audrey_Gross)
#### Post date: [September 30, 2022, 4:18pm UTC](https://discourse.orthanc-server.org/t/embed-accelerator-transfer-plugin-in-another-plugin/3083/1 "2022-09-30T16:18:44Z")

</div>

Hi all,

I am new to Orthanc framework.

I try to make a new plugin that need the transfer accelerator plugin functionalities.

For that purpose I have put the code of the [plugin](https://hg.orthanc-server.com/orthanc-transfers/file/tip) inside mine.  
When I post a pull request with one resource, I have the following error : **“Bad sequence of calls”.** It happens when the code pass in the “\*\*OrthancPlugins::\*\ ***PullJob** ” constructor.  
Is there any hint about this error?

Other question : **Is there a way to communicate between already install orthanc plugins?**

If you need more information please let me know.

Kind regards,

Audrey

---

<div class="post-metadata">

### Author: ![alainmazy](https://discourse.orthanc-server.org/user_avatar/discourse.orthanc-server.org/alainmazy/32/1576_2.png) [@alainmazy](https://discourse.orthanc-server.org/u/alainmazy)
#### Post date: [October 3, 2022, 7:41am UTC](https://discourse.orthanc-server.org/t/embed-accelerator-transfer-plugin-in-another-plugin/3083/2 "2022-10-03T07:41:01Z")

</div>

Hi Audrey,

The Bad Sequence of calls exception can trigger at many places, it always means that there’s some required initialization code that has not been run. Just add a breakpoint and you’ll see what’s missing.

The best way to communicate between plugins is to use the Rest API and use RestApiGet **AfterPlugins** and its siblings ([doc](https://sdk.orthanc-server.com/group__Orthanc.html#ga05206ca54960536a65caee32118c42f5))

HTH

Alain.

---

<div class="post-metadata">

### Author: ![Audrey\_Gross](https://discourse.orthanc-server.org/letter_avatar_proxy/v4/letter/a/b487fb/32.png) [@Audrey\_Gross](https://discourse.orthanc-server.org/u/Audrey_Gross)
#### Post date: [October 3, 2022, 9:10am UTC](https://discourse.orthanc-server.org/t/embed-accelerator-transfer-plugin-in-another-plugin/3083/3 "2022-10-03T09:10:33Z")

</div>

Hi Alain,

Thanks a lot, the RestApiPostAfterPlugins solved my problem!

Regards,

Audrey

---

<div class="post-metadata">

### Author: ![Audrey\_Gross](https://discourse.orthanc-server.org/letter_avatar_proxy/v4/letter/a/b487fb/32.png) [@Audrey\_Gross](https://discourse.orthanc-server.org/u/Audrey_Gross)
#### Post date: [October 5, 2022, 8:10am UTC](https://discourse.orthanc-server.org/t/embed-accelerator-transfer-plugin-in-another-plugin/3083/4 "2022-10-05T08:10:33Z")

</div>

Hi Alain,

In your previous answer you said I can add a breakpoint in my plugin code.  
**Is that possible to debug inside a plugin?**

For now, I process like this :

- I have build Orthanc Server on my disk

- I add the plugin path to my Orthanc Server Configuration.json file

- I build my c++ plugin

- I relaunch Orthanc, passing the json configuration file in parameter

I can use gdb but my breakpoints are not fired by vscode.  
I am on Ubuntu Jammy Jellyfish.

**Can you tell me if there is a documentation about that?**

Regards

Audrey

---

<div class="post-metadata">

### Author: ![alainmazy](https://discourse.orthanc-server.org/user_avatar/discourse.orthanc-server.org/alainmazy/32/1576_2.png) [@alainmazy](https://discourse.orthanc-server.org/u/alainmazy)
#### Post date: [October 5, 2022, 1:29pm UTC](https://discourse.orthanc-server.org/t/embed-accelerator-transfer-plugin-in-another-plugin/3083/5 "2022-10-05T13:29:52Z")

</div>

Hi Audrey,

There’s no specific documentation for that. But here’s how I work (I’m also using VSCode).

Make sure to build Orthanc and the plugins in Debug. Here’s my settings.json for Orthanc (used by CMake extension):  
 ![image.png](https://discourse.orthanc-server.org/uploads/default/original/2X/9/93ee7223163f858561b9514dfc44b65adea2a87d.png)

And, the one from my dicom-web plugin:  
 ![image.png](https://discourse.orthanc-server.org/uploads/default/original/2X/b/b4ca91eaf32b6bbcdfba645118d1154ad193a8b9.png)

Then, here’s my launch.json for dicom-web plugin:

![image.png](https://discourse.orthanc-server.org/uploads/default/original/2X/8/86de8036b2e78d0d82812917f425f434ee0482da.png)

And an extract from my orthanc.json file:  
 ![image.png](https://discourse.orthanc-server.org/uploads/default/original/2X/5/50c7d27b315f0a006a14a765263e85bc2af838c3.png)

Then, if I set a breakpoint in the dicom-web plugin code and debug from the dicom-web project in VSCode, the debugger stops on my breakpoint.  
Note that it seems that the debugger will only stops on breakpoints that you have set in the project you are currently debugging → if you debug the dicom-web plugin, the debugger won’t always stop on breakpoints that you have set in Orthanc. Depending on what I need to debug, I’m launching Orthanc or the plugin project.

HTH

Alain.

---

<div class="post-metadata">

### Author: ![Audrey\_Gross](https://discourse.orthanc-server.org/letter_avatar_proxy/v4/letter/a/b487fb/32.png) [@Audrey\_Gross](https://discourse.orthanc-server.org/u/Audrey_Gross)
#### Post date: [October 6, 2022, 9:10am UTC](https://discourse.orthanc-server.org/t/embed-accelerator-transfer-plugin-in-another-plugin/3083/6 "2022-10-06T09:10:14Z")

</div>

Hi Alain,

Thanks a lot for these explanations.  
I’ve just tried to reproduce your configuration with my projets.  
I have the “ms-vscode.cpptools” installed.  
Could you please show me the content of your tasks.json files?  
I think my problem is when I build and launch the Orthanc project.

Regards

Audrey

---

<div class="post-metadata">

### Author: ![alainmazy](https://discourse.orthanc-server.org/user_avatar/discourse.orthanc-server.org/alainmazy/32/1576_2.png) [@alainmazy](https://discourse.orthanc-server.org/u/alainmazy)
#### Post date: [October 6, 2022, 10:54am UTC](https://discourse.orthanc-server.org/t/embed-accelerator-transfer-plugin-in-another-plugin/3083/7 "2022-10-06T10:54:13Z")

</div>

Well, I don’t have a tasks.json file ☹

FYI, here are the relevant extensions that I have:  
 ![image.png](https://discourse.orthanc-server.org/uploads/default/original/2X/0/0329b7407be46e7ffa8a6a41be22a78d040b7fbe.png)

---

<div class="post-metadata">

### Author: ![Audrey\_Gross](https://discourse.orthanc-server.org/letter_avatar_proxy/v4/letter/a/b487fb/32.png) [@Audrey\_Gross](https://discourse.orthanc-server.org/u/Audrey_Gross)
#### Post date: [October 6, 2022, 2:21pm UTC](https://discourse.orthanc-server.org/t/embed-accelerator-transfer-plugin-in-another-plugin/3083/8 "2022-10-06T14:21:22Z")

</div>

Thanks for your reply.  
Now I can debug at same time on Orthanc Server and my plugin!  
I have the same C/C++ extensions.

I have now almost the same launch et settings json files as you, expect that :

- I do not use {WorkspaceRoot} variable (for the plugin launch.json) but only WorkspaceFolder
- I’ve defined the “miDebuggerPath” in launch.json

My plugin is in the same workspace as the server.  
I had to update my gdb to 12.1 to be able to put breakpoints (i[ssue here)](https://github.com/microsoft/vscode-cpptools/issues/9253).

Regards

Audrey
