Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question - Example wanted #1

Open
WanaGo opened this issue Sep 19, 2021 · 17 comments
Open

Question - Example wanted #1

WanaGo opened this issue Sep 19, 2021 · 17 comments

Comments

@WanaGo
Copy link

WanaGo commented Sep 19, 2021

Hello,

Just installed Argus Monitor 6.0.0.1 and saw in the change log a reference to this API.
Do you happen to have an example of using it?
Is this compatible with Arduino by chance, as it looks like it likely should be compatible or near compatible at least given its C++.

Just after an example to see how you figure out how to distinguish between the sensors etc, just how its done, its, so I have something to start with.

This is going to be brilliant rather than using AIDA64 into a display on HDMI etc, this is going to be much more convenient for what I was going to try and get AIDA64 to do over a serial UART to a Serial display I have, and given I pay for the license on Argus Monitor this is brilliant.

Thanks

@argotronic
Copy link
Owner

Well, there is no real example. I have implemented a data source for MSI AfterBurner (for RivaTuner Statistics Server) that I hope I can push upstream once I figure out how to do that (I could not find a public repo to submit a PR to yet). But I guess I am not allowed to share this code here. But it is very simple (I hope).

Basically you only need a main(), create a variable of type argus_monitor::data_api::ArgusMonitorDataAccessor, call Open on it and give it the callback function that should be called once new data is available. It is designed to be as simple as possible to get to the data like this (excerpt from the ArgusMontor test suite):

argus_monitor::data_api::ArgusMonitorDataAccessor data_accessor_{};
data_accessor_.Open();

bool       callback_called{ false };
auto const on_temperature_changed
    = [&callback_called](argus_monitor::data_api::ArgusMontorData const& new_sensor_data) { callback_called = true; };
data_accessor_.RegisterSensorCallbackOnDataChanged(on_temperature_changed);

So, the 'on_temperature_changed' callback lambda will be called new data is available via the data API. You can also adapt the code to register any other callback of course. But then you have the new data available in new_sensor_data. From that you 'only' have to extract the parts you need. ;)

Maybe I can create a small console application that opens the API connection and prints some values to the terminal to get people going. But using the lines above, pasting them in a small program and using the debugger to 'explore' what is inside new_sensor_data should already be a good starting point.

@shawnshekari
Copy link

Thank you for adding this API and the sample. This pushed me over the edge to purchase Argus Monitor!

@WanaGo
Copy link
Author

WanaGo commented Sep 19, 2021

Well, there is no real example. I have implemented a data source for MSI AfterBurner (for RivaTuner Statistics Server) that I hope I can push upstream once I figure out how to do that (I could not find a public repo to submit a PR to yet). But I guess I am not allowed to share this code here. But it is very simple (I hope).

Thanks for the reply, but this part has me confused. What does MSI Afterburner and RivaTuner Statistics Server have to do with Argus Monitor? Does this API not talk to Argus directly?

@argotronic
Copy link
Owner

Thanks for the reply, but this part has me confused. What does MSI Afterburner and RivaTuner Statistics Server have to do with Argus Monitor? Does this API not talk to Argus directly?

Yes, of course it does. RTSS or Afterburner are not connected or required in any way, sorry for the confusion.

But RTSS offers OSD functionality and I had added a new data source (using our API that of course gets the data directly from a running Argus Montor instance) for RTSS to be able to easily show Argus Monitor values in any OSD managed by RTSS.

So yes, the data API is stand alone and only needs Argus Monitor to run on the same PC to provide the data. The connection with RTSS/Afterburner is just an example where I myself wanted to USE our data API to implement functionality into another tool.

I mentioned it only because, once this is out officially, this could serve as the example you were asking for, because it uses the API in some real world application.

@WanaGo
Copy link
Author

WanaGo commented Sep 19, 2021

Ah yes that makes sense, thank you.
Yes having these values to the OSD from MSI Afterburner would also be helpful, to see what is going on in game etc, as it currently doesn't show things like my loop temperature and a few other things, which Argus does show.

I am still trying to work out how to use the API though. It seems this is designed to run on the PC in a customer application, and then it would be up to the app you make with this API to send it out the serial port, which is what I was wanting to achieve.
It would be super nice if Argus could stream values to the Serial port, using whatever sensors you want, so you can intercept them from some external serial device, be that an Arduino or other microcontroller, or a LCD display which you can program etc, and then display the values directly. Something simple like a byte stream at a set baud rate to a set serial port, say COM1 @9600 baud, stream Sensor1, Sensor2, Sensor3.... SensorN, or something, which another device can then read the serial port and chop the data up ready for display.

If I understand this API correctly, I still need to build another program to run in Windows which runs this API, and then have that export the values to the Serial port. Not sure I am capable of doing that myself sadly. when I first saw the API I thought Argus was going to send this out somehow, and an external device can tap into the serial port running this API to interpret the data, but it seems that is not the case.

@9600
Copy link

9600 commented Sep 20, 2021

You called?

@ArgusMonitor
Copy link

@9600
Sorry for the disturbance. WanaGo just meant the baud rate. 😄

@WanaGo
Our purpose for having the API is to enable third party applications to access Argus Monitor data and do whatever they want to do with it. But we can't program these third party applications for our self, that is by design the task of the third party 😢 .
I am sure you will find many examples for Windows in the web on how to send serial bytes over the COM interface to your Arduino.

@patrick-robin
Copy link

patrick-robin commented Dec 18, 2021

@argotronic if you could post a sample console app that would be great, I've tried to get it working in a console app using the code you posted above but the callback never gets called. I'm not a C++ develoer so I've probably missed something obvious, but I thought I'd have a go at creating a new RainMeter plugin. I've pushed my test code here: https://github.com/patrick-robin/ArgusConsole and I'm running the latest version of Argus Monitor and I'd be grateful if you could take a look and point out where I'm going wrong. Description of the issue is in the readme

@argotronic
Copy link
Owner

@patrick-robin Thank you for sharing your sample code. Except you did not check for the case when isOpen is false (e,g. ArgusMonitor not running as in this case, calling Open() will fail), the code looks good as a starting point.

But there was a MAJOR bug in my code that would have prevented the API from providing the callback with the proper copy of the data. I have just pushed a fix, so please first update the API file or do the 1 character fix yourself and replace
memcpy(&sensor_data_copy, &sensor_data, sizeof(argus_monitor::data_api::ArgusMontorData));
with
memcpy(&sensor_data_copy, sensor_data, sizeof(argus_monitor::data_api::ArgusMontorData));

If you have Argus Monitor running (first you have to enable sending data via the API by ticking the checkbox under Settings -> Stability associated with the API and restarting Argus for this to take effect), then your example should work and receive the data.

@patrick-robin
Copy link

@argotronic it was just test code so I wasn't checking isOpen as I knew Argus Monitor was running but will include it if I manage to write something that's releasable. I'm happy to say that I've made the suggested change and the code now works as expected :)

I'm primarily a C# developer, for my sins, but it would be good if the API code was available as a nuget package as then we'd just have to update the nuget package for fixes like this. Having said that I've not actually figured out how to consume a nuget package in a C++ project yet so I may be getting ahead of myself!

Anyway, thanks for your help 👍

@argotronic
Copy link
Owner

@patrick-robin I have added a simple and a bit more complete example on how to access sensor information to the repo. It is very similar to what you had, but I added waiting for connection and printing some of the data.

The file could be a drop-in replacement for your ArgusConsole.cpp and should hopefully work without further modifications (if you update the API as I also fixed an rather embarrassing typo ;/

I sadly don't have time to do the Rainmeter plugin myself, but I am available if you need more help accessing the Argus API or C++ questions in general. If you need assistance, you can also write to support (at) argotronic.com and we can follow up there.

@patrick-robin
Copy link

@argotronic that's perfect, thanks for that. I'm going to have a play around over the next few days and try and get something up and running. Thanks very much for you help, much appreciated :)

@petras-sukys
Copy link

Well, there is no real example. I have implemented a data source for MSI AfterBurner (for RivaTuner Statistics Server) that I hope I can push upstream once I figure out how to do that (I could not find a public repo to submit a PR to yet). But I guess I am not allowed to share this code here. But it is very simple (I hope).

Basically you only need a main(), create a variable of type argus_monitor::data_api::ArgusMonitorDataAccessor, call Open on it and give it the callback function that should be called once new data is available. It is designed to be as simple as possible to get to the data like this (excerpt from the ArgusMontor test suite):

argus_monitor::data_api::ArgusMonitorDataAccessor data_accessor_{};
data_accessor_.Open();

bool       callback_called{ false };
auto const on_temperature_changed
    = [&callback_called](argus_monitor::data_api::ArgusMontorData const& new_sensor_data) { callback_called = true; };
data_accessor_.RegisterSensorCallbackOnDataChanged(on_temperature_changed);

So, the 'on_temperature_changed' callback lambda will be called new data is available via the data API. You can also adapt the code to register any other callback of course. But then you have the new data available in new_sensor_data. From that you 'only' have to extract the parts you need. ;)

Maybe I can create a small console application that opens the API connection and prints some values to the terminal to get people going. But using the lines above, pasting them in a small program and using the debugger to 'explore' what is inside new_sensor_data should already be a good starting point.

Is there by any chance we could get source/binaries for that integration with RTSS (even without official release from msi/guru?)

If not, will have to bash together a bridge from this api sample and RTSS sample to send some stuff down there.

@patrick-robin
Copy link

@argotronic Thanks for your help, got a plugin up and running without too much hassle, codes here if you have any comments: https://gitlab.com/izio/izio.rainmeter.argusmonitorplugin

@patrick-robin
Copy link

@argotronic would you be able to share your RTSS plugin?

@argotronic
Copy link
Owner

Hi,

unfortunately, this is something I cannot do for legal/license reasons. I would very much like to have this as an official data source in RTSS of course, but right now there is only Afterburner, AIDA and HWINFO.
I have posted in their forums a while back and even wrote 2 PN to Unwinder, requesting information on the way how to contribute a new data source. I got no reply.

Even if I could, I personally don't want to send the DLLs out to every user that requests it and would have to manually keep this in sync with the most recent release of RTSS. This needs to be available upstream. I would be happy to help with the implementation, but right now I don't even know how to contribute.

I'd appreciate if you tell me how to do that and make the RTSS aware that this data source is something users actually want.

@patrick-robin
Copy link

Unfortunately I don't know myself, I'll have a look in to to it later this week when I've got some spare time as it would be good to get Argus Monitor as an official plugin.

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

No branches or pull requests

7 participants