How do I know which container type to use when accessing one-wire devices programatically?

johnnynine

Active Member
1. I see the SDK has many container types... OneWireContainer01 , OneWireContainer02, OneWireContainer03...

If a user of my software asks for a driver for their one-wire temperature probe, how do I know which container to use? I do see that there is a TemperatureContainer subclass or interface that has several container classes implementing it, but is there some spreadsheet somewhere or some way to know which containers to use for which products?

2. Also, this is off topic but can the following be called more than once before calling freePort()?

[codebox]com.dalsemi.onewire.OneWireAccessProvider.getAdapter(_adapterName, _serialPortName);[/codebox]

In other words can I have 2 object instances (or 2 applications) running at the same time, both calling getAdapter() to access different devices on the adapter?

Or can there be only one getAdapter() --> freePort() session for any serial port at a time?

Thanks,
Johnny
 
Johnny,

You can look here for the family codes. Just find the device in the first column and the in the forth column names family you will find a 2 digit number. Just find the container that ends with the same two digits and that will be the one you would use for that chip.

I think multiple instances of the same app can get the adapter and just use the begin/endexclusive when you want to access the 1-Wire network. I'm not sure about two different applications using the same adapter though.

Eric
 
How can I tell what "device" to look up? For instance if someone is using an [H3-R1-A] Humidity Sensor and asks for a driver to that, how do I know what chip?/device id to use for the chart lookup?

I've been going about this from the point of view that the user would select which 1-wire device model they were using, the com port it was on, the adapter it was connected to and the serial # of the device... and the driver would provide only those properties and methods relative to the device model... but perhaps this is the wrong approach? I saw another driver approach that uses more of a shotgun approach, providing methods for what looked like most 1-wire devices but all on the same driver (but I'd prefer not to expose properties and methods to the user that are invalid for a device).

Am I able to determine what the device type (or device model) is by querying the device? If so I could create dynamic properties/methods based on the actual 1-wire device and just have one driver that can handle all 1-wire device types... that might actually be nicer. Does "adapter.getDeviceContainer()" return an object that I can determine the container type of for example?

Johnny

Johnny,

You can look here for the family codes. Just find the device in the first column and the in the forth column names family you will find a 2 digit number. Just find the container that ends with the same two digits and that will be the one you would use for that chip.

I think multiple instances of the same app can get the adapter and just use the begin/endexclusive when you want to access the 1-Wire network. I'm not sure about two different applications using the same adapter though.

Eric
 
Johnny,
I think you asked me that several times via PM.

In the documentation that comes with the SDK, there is a chart that shows you every device and what container to use.
Did you look at all the documentaion?
 
Johnny,
I think you asked me that several times via PM.

In the documentation that comes with the SDK, there is a chart that shows you every device and what container to use.
Did you look at all the documentaion?

Sorry I'm probably wording the question wrong. The question I sent you was meant to be a little different, and yes thanks for the link to the chart. I did look at it.

As I recall the chart (and container classes) are for the individual chips. My question here was mean to be a little higher level at more of the hobby boards level. From my understanding the hobby board devices are named "Humidity Sensor" for example and may actually have more than one type of chip (and therefore more than one container class).

So what I was wondering here when using the API, can I do something like:

C# code:

container = adapter.getDeviceContainer("000000000505801F");
if (container is OneWireContainer1D)
...
else if (container is OneWireContainer10)
...

Thanks,
Johnny
 
I don't have a list made up that I can give you but if you look on our site on the Kits page, each Hobby Boards device will say what 1-Wire chip they use.

Eric
 
I don't have a list made up that I can give you but if you look on our site on the Kits page, each Hobby Boards device will say what 1-Wire chip they use.

Eric

Looks good, thanks!

I guess for the coding technicallities I'm going to have to get my hands on some of these devices to see what approach best suits the device driver(s).

Thanks,
Johnny
 
Back
Top