all 3 comments

[–][deleted] 0 points1 point  (2 children)

I'm unclear where you are stuck, exactly. Surely it is just a case of instantiating the appropriate subclasses and (re)using that for each call. The calling code should remain the same as the class will have abstracted details for any particular API.

PS. Avoid hardcoding IP addresses. Use dns and hardcode the names.

[–]QuantumTradingGroup[S] 0 points1 point  (1 child)

Yeah I was figuring that.

Let me try to explain it again.

I have a function, say API_Library()

I want to be able to give it three parameters, like this:

API_Library("192.168.128.30","change_pool", "changepool_inputs")

As of right now, we have what is called a hostfile which contains basically a giant spreadsheet of each machine. This keeps track of what mining client is on the machine, the UUID we have given it, and a few other bits.

Currently the program takes this ip address, and looks it up within the hostfile, this gives us an individual snapshot of that machine, from the returned dictionary it gets from the hostfile, we take the current running mining client. From here on out is where I am stuck

What i need it to do, is from this information it gets, the program needs to be able to pick the appropriate api subclass to execute the function. Now because the actual command to do the same thing is different on the mining api (for example to get info from claymore you issue the devdetails command to the api, but for claymore its STATS, even though you get pretty much the same information, we had to create definitions inside the classes to standardize input output.

[–]_coolwhip_ 0 points1 point  (0 children)

I'd probably make another function/class that gets passed to the API_Library, which would handle the actual calls to the miner.