Spark Cloud Event Viewer

Having added a second Spark Core to my collection, I found that it was becoming a hassle to connect two serial ports to monitor debug information. I decided to have my programs publish debug events to the Cloud. I then turned to my SparkIODotNet linrary to create a Spark Cloud Event Viewer! This way I can run a capture on the event stream for my Cores, specific event names, etc. All in a nice clean GUI.

As the listener is collecting the events, the left most tree view fills with the distinct CoreIDs it sees and the related event names. Selecting a CoreID or EventName will filter the Event List. Selecting an event in the Event List will send it to the JSON Viewer if it is JSON Data.

Right now the code is in protoype/alpha condition. I am working on cleaning it up right now and getting the operation tight. I will certainly be releasing it soon. Keep an eye out here for updates.


I am trying to use this library in a project and I am getting an error in this line:

Dim core As New EventsAPI("core", "token")

The error reads “Overload resolution failed because no accessible ‘New’ is most specific for these arguments”

I got that code from your documentation your documentation

I managed to reference your DLL without problems, so much so that the code below runs without problems.

Dim MyCore As CoreAPI
MyCore = New CoreAPI("token", "core")

What am I missing?

I think the reason for this error is that the parameter list you are providing allows for ambiguitiy.
It might be that the docs code snippet predates the addition of a new overload for the constructor.

This is the relevant section of the library code

#region Constructors
public EventsAPI(String accessToken, String coreID = "", WebProxy webProxy = null,
                 bool acceptAllCertificates = false, string urlSparkCloud = sparkAddress) 
: base(accessToken, coreID, webProxy, acceptAllCertificates, urlSparkCloud) { }

public EventsAPI(String userName, String password, String coreID = "", WebProxy webProxy = null,
                 bool acceptAllCertificates = false, string urlSparkCloud = sparkAddress) 
: base(userName, password, coreID, webProxy, acceptAllCertificates, urlSparkCloud) { }

And as you see a call with two string parameters would fit both overloads, so the compiler does not know which to choose.
To overcome this, you could

  • explicitly go for the second overload and provide the three strings, or
  • you accept to get the events of all your devices and only provide the access token (which would then only fit the first overload), or
  • you hack the library by just commenting out the second overload.
1 Like

Thanks. I went for the first option and it works, although it seems to ignore the coreID parameter and trigger for publishes made by everyone of my devices. It’s not a big issue though, since each event has its own CoreID argument and I can use it to identify where the event is coming from.

Hmm, that device ID thing might be something to open an issue about in @cloris GitHib repo.

I’m not sure if he’s still maintaining/updating the lib tho’.

But good to hear that you can get on with your own project now.

1 Like

From above:

Dim MyCore As CoreAPI
MyCore = New CoreAPI("token", "core")

Should those 3 lines of code still work? I guess i am missing something because if I run them I get the following error"

SparkIO.WebServices.Exceptions.UsernameOrPasswordIncorrectException was unhandled
  Message=Error in the application.

Do I need to add in a username & password somewhere? I don’t see much action on this library since end of 2014 so wondering whether it works so well no changes are needed or whether it might no longer be compatible after some changes from Particle…

I had this same problem, but solved it.
The problem I had was when I called the inital constructor the accessToken and coreID were swapped.
This is how I have it now and I can turn Leds on and off nicely with buttons in c#

mycore = new CoreAPI( accessToken,coreID);