1-Wire API for Compact.NET Version 4.00
|
Abstract base class for all 1-Wire Adapter objects. More...
Inherited by SerialAdapter, SerialAdapterX, and TMEXLibAdapter.
Public Member Functions | |
abstract void | Dispose () |
Gets or sets the ISite associated with this component. | |
abstract bool | OpenPort (String PortName) |
Opens the specified port and verifies existance of the adapter. | |
void | FreePort () |
Closes the port and frees all resources from use. | |
bool | BeginExclusive (bool blocking) |
Obtain exclusive control of this adapter object. | |
void | EndExclusive () |
Release exclusive control of this adapter object. | |
abstract OWResetResult | Reset () |
Sends a Reset to the 1-Wire Network. | |
abstract void | PutBit (bool bitValue) |
Sends a bit to the 1-Wire Network. | |
abstract void | PutByte (int byteValue) |
Sends a byte to the 1-Wire Network. | |
abstract bool | GetBit () |
Gets a bit from the 1-Wire Network. | |
abstract int | GetByte () |
Gets a byte from the 1-Wire Network. | |
abstract byte[] | GetBlock (int len) |
Get a block of data from the 1-Wire Network. | |
abstract void | GetBlock (byte[] arr, int len) |
Get a block of data from the 1-Wire Network and write it into the provided array. | |
abstract void | GetBlock (byte[] arr, int off, int len) |
Get a block of data from the 1-Wire Network and write it into the provided array. | |
abstract void | DataBlock (byte[] data, int offset, int length) |
Sends a block of data and returns the data received in the same array. | |
abstract void | SetPowerDuration (OWPowerTime powerDur) |
Sets the duration to supply power to the 1-Wire Network. | |
abstract bool | StartPowerDelivery (OWPowerStart changeCondition) |
Sets the 1-Wire Network voltage to supply power to an iButton device. | |
abstract void | SetProgramPulseDuration (OWPowerTime pulseDur) |
Sets the duration for providing a program pulse on the 1-Wire Network. | |
abstract bool | StartProgramPulse (OWPowerStart changeCondition) |
Sets the 1-Wire Network voltage to eprom programming level. | |
abstract void | StartBreak () |
Sets the 1-Wire Network voltage to 0 volts. | |
abstract void | SetPowerNormal () |
Sets the 1-Wire Network voltage to normal level. | |
abstract bool | GetFirstDevice (byte[] address, int offset) |
Returns
true
if the first iButton or 1-Wire device is found on the 1-Wire Network. | |
abstract bool | GetNextDevice (byte[] address, int offset) |
Returns
true
| |
abstract bool | IsPresent (byte[] address, int offset) |
Verifies that the iButton or 1-Wire device specified is present on the 1-Wire Network. | |
abstract bool | IsAlarming (byte[] address, int offset) |
Verifies that the iButton or 1-Wire device specified is present on the 1-Wire Network and in an alarm state. | |
virtual bool | SelectDevice (byte[] address, int offset) |
Selects the specified iButton or 1-Wire device by broadcasting its address. | |
abstract void | SetSearchOnlyAlarmingDevices () |
Set the 1-Wire Network search to find only iButtons and 1-Wire devices that are in an 'Alarm' state that signals a need for attention. | |
abstract void | SetNoResetSearch () |
Set the 1-Wire Network search to not perform a 1-Wire reset before a search. | |
abstract void | SetSearchAllDevices () |
Set the 1-Wire Network search to find all iButtons and 1-Wire devices whether they are in an 'Alarm' state or not and restores the default setting of providing a 1-Wire reset command before each search. | |
virtual void | TargetAllFamilies () |
Removes any selectivity during a search for iButtons or 1-Wire devices by family type. | |
virtual void | TargetFamily (int family) |
Takes an integer to selectively search for this desired family type. | |
virtual void | TargetFamily (byte[] family) |
Takes an array of bytes to use for selectively searching for acceptable family codes. | |
virtual void | ExcludeFamily (int family) |
Takes an integer family code to avoid when searching for iButtons. | |
virtual void | ExcludeFamily (byte[] family) |
Takes an array of bytes containing family codes to avoid when finding iButtons or 1-Wire devices. | |
override int | GetHashCode () |
Get Hash Code (proxies to .ToString().GetHashCode()) | |
override bool | Equals (System.Object o) |
Tells if objects are equal (proxies to .ToString().Equals()) | |
override string | ToString () |
Returns a string representation of this adapter (i.e. | |
Protected Member Functions | |
abstract void | Dispose (bool disposing) |
Dispose's all resources for this object. | |
virtual void | onReset (OWResetResult rslt) |
onReset event, fires event for all listeners | |
virtual void | onSpeedChange (OWSpeed OldSpeed, OWSpeed NewSpeed) |
onSpeedChange event, fires event for all listeners | |
virtual void | onDataIO (bool isTransmit, byte[] data) |
onDataIO event, fires for all data IO | |
virtual internal bool | isValidFamily (byte familyCode) |
Checks to see if the family found is in the desired include group. | |
Protected Attributes | |
internal byte[] | exclude = null |
exclude family codes | |
internal byte[] | include = null |
include family codes | |
Properties | |
abstract OWSpeed | Speed [get, set] |
OWSpeed representing current speed of communication on 1-Wire network. | |
abstract bool | CanOverdrive [get] |
Returns whether adapter can physically support overdrive mode. | |
abstract bool | CanHyperdrive [get] |
Returns whether the adapter can physically support hyperdrive mode. | |
abstract bool | CanFlex [get] |
Returns whether the adapter can physically support flex speed mode. | |
abstract bool | CanProgram [get] |
Returns whether adapter can physically support 12 volt power mode. | |
abstract bool | CanDeliverPower [get] |
Returns whether the adapter can physically support strong 5 volt power mode. | |
abstract bool | CanDeliverSmartPower [get] |
Returns whether the adapter can physically support "smart" strong 5 volt power mode. | |
abstract bool | CanBreak [get] |
Returns whether adapter can physically support 0 volt 'break' mode. | |
abstract string | AdapterName [get] |
The name of this adapter type. | |
abstract string | PortName [get] |
The port name for this adapter type (i.e. | |
abstract string | PortTypeDescription [get] |
Detailed description for this port type. | |
abstract System.Collections.IList | PortNames [get] |
Collection of valid port names for this port type. | |
Events | |
ResetEventHandler | ResetEvent |
An event for indicating when a 1-Wire Reset occurs and what the result is. | |
SpeedChangeEventHandler | SpeedChangeEvent |
An event for indicating when a 1-Wire Reset occurs and what the result is. | |
DataIOEventHandler | DataIOEvent |
event for indicating when data is transmitted |
Abstract base class for all 1-Wire Adapter objects.
bool BeginExclusive | ( | bool | blocking | ) |
Obtain exclusive control of this adapter object.
blocking | if true, blocks until available |
abstract void DataBlock | ( | byte[] | data, |
int | offset, | ||
int | length | ||
) | [pure virtual] |
Sends a block of data and returns the data received in the same array.
This method is used when sending a block that contains reads and writes. The 'read' portions of the data block need to be pre-loaded with 0xFF's. It starts sending data from the index at offset 'off' for length 'len'.
data | array of data to transfer to and from the 1-Wire Network. |
offset | offset into the array of data to start |
length | length of data to send / receive starting at 'off' |
abstract void Dispose | ( | ) | [pure virtual] |
Gets or sets the ISite associated with this component.
Represents the method that handles the Disposed event of a component. Dispose's all resources for this object
abstract void Dispose | ( | bool | disposing | ) | [protected, pure virtual] |
Dispose's all resources for this object.
void EndExclusive | ( | ) |
Release exclusive control of this adapter object.
override bool Equals | ( | System.Object | o | ) |
virtual void ExcludeFamily | ( | int | family | ) | [virtual] |
Takes an integer family code to avoid when searching for iButtons.
or 1-Wire devices. If this method is used, then no devices of this family will be found by any of the search methods.
family | the code of the family type NOT to target in searches |
virtual void ExcludeFamily | ( | byte[] | family | ) | [virtual] |
Takes an array of bytes containing family codes to avoid when finding iButtons or 1-Wire devices.
If used, then no devices with family codes in this array will be found by any of the search methods.
family | array of family cods NOT to target for searches |
void FreePort | ( | ) |
Closes the port and frees all resources from use.
abstract bool GetBit | ( | ) | [pure virtual] |
Gets a bit from the 1-Wire Network.
abstract void GetBlock | ( | byte[] | arr, |
int | len | ||
) | [pure virtual] |
Get a block of data from the 1-Wire Network and write it into the provided array.
arr | array in which to write the received bytes |
len | length of data bytes to receive |
abstract void GetBlock | ( | byte[] | arr, |
int | off, | ||
int | len | ||
) | [pure virtual] |
Get a block of data from the 1-Wire Network and write it into the provided array.
arr | array in which to write the received bytes |
off | offset into the array to start |
len | length of data bytes to receive |
abstract byte [] GetBlock | ( | int | len | ) | [pure virtual] |
Get a block of data from the 1-Wire Network.
len | length of data bytes to receive |
abstract int GetByte | ( | ) | [pure virtual] |
Gets a byte from the 1-Wire Network.
abstract bool GetFirstDevice | ( | byte[] | address, |
int | offset | ||
) | [pure virtual] |
Returns
true
if the first iButton or 1-Wire device is found on the 1-Wire Network.
If no devices are found, then
false
will be returned.
address | device address found |
offset | offset into array where address begins |
true
override int GetHashCode | ( | ) |
Get Hash Code (proxies to .ToString().GetHashCode())
abstract bool GetNextDevice | ( | byte[] | address, |
int | offset | ||
) | [pure virtual] |
Returns
true
if the next iButton or 1-Wire device is found.
The previous 1-Wire device found is used as a starting point in the search. If no more devices are found then
false
will be returned.
address | device address found |
offset | offset into array where address begins |
true
abstract bool IsAlarming | ( | byte[] | address, |
int | offset | ||
) | [pure virtual] |
Verifies that the iButton or 1-Wire device specified is present on the 1-Wire Network and in an alarm state.
This does not affect the 'current' device state information used in searches (findNextDevice...).
address | device address to verify is present and alarming |
offset | offset into array where address begins |
true
false
abstract bool IsPresent | ( | byte[] | address, |
int | offset | ||
) | [pure virtual] |
Verifies that the iButton or 1-Wire device specified is present on the 1-Wire Network.
This does not affect the 'current' device state information used in searches (findNextDevice...).
address | device address to verify is present |
offset | offset into array where address begins |
true
false
virtual internal bool isValidFamily | ( | byte | familyCode | ) | [protected, virtual] |
Checks to see if the family found is in the desired include group.
true
virtual void onDataIO | ( | bool | isTransmit, |
byte[] | data | ||
) | [protected, virtual] |
onDataIO event, fires for all data IO
isTransmit | if true, this is a transmit event, otherwise it is echo |
data | The data transmitted or received |
virtual void onReset | ( | OWResetResult | rslt | ) | [protected, virtual] |
onReset event, fires event for all listeners
rslt | the result of the 1-Wire reset |
virtual void onSpeedChange | ( | OWSpeed | OldSpeed, |
OWSpeed | NewSpeed | ||
) | [protected, virtual] |
onSpeedChange event, fires event for all listeners
OldSpeed | the 1-Wire speed before change |
NewSpeed | the 1-Wire speed after change |
abstract bool OpenPort | ( | String | PortName | ) | [pure virtual] |
Opens the specified port and verifies existance of the adapter.
abstract void PutBit | ( | bool | bitValue | ) | [pure virtual] |
Sends a bit to the 1-Wire Network.
bitValue | the bit value to send to the 1-Wire Network. |
abstract void PutByte | ( | int | byteValue | ) | [pure virtual] |
Sends a byte to the 1-Wire Network.
byteValue | the byte value to send to the 1-Wire Network. |
abstract OWResetResult Reset | ( | ) | [pure virtual] |
Sends a Reset to the 1-Wire Network.
virtual bool SelectDevice | ( | byte[] | address, |
int | offset | ||
) | [virtual] |
Selects the specified iButton or 1-Wire device by broadcasting its address.
This operation is refered to a 'MATCH ROM' operation in the iButton and 1-Wire device data sheets. This does not affect the 'current' device state information used in searches (findNextDevice...).
Warning, this does not verify that the device is currently present on the 1-Wire Network (See isPresent).
address | iButton to select |
offset | offset into array where address begins |
true
false
abstract void SetNoResetSearch | ( | ) | [pure virtual] |
Set the 1-Wire Network search to not perform a 1-Wire reset before a search.
This feature is chiefly used with the DS2409 1-Wire coupler. The normal reset before each search can be restored with the 'setSearchAllDevices()' method.
abstract void SetPowerDuration | ( | OWPowerTime | powerDur | ) | [pure virtual] |
Sets the duration to supply power to the 1-Wire Network.
This method takes a time parameter that indicates the program pulse length when the method startPowerDelivery().
Note: to avoid getting an exception, use the canDeliverPower() and canDeliverSmartPower() method to check it's availability.
powerDur | time factor |
abstract void SetPowerNormal | ( | ) | [pure virtual] |
Sets the 1-Wire Network voltage to normal level.
This method is used to disable 1-Wire conditions created by startPowerDelivery and startProgramPulse. This method will automatically be called if a communication method is called while an outstanding power command is taking place.
OneWireIOException | on a 1-Wire communication error |
OneWireException | on a setup error with the 1-Wire adapter or the adapter does not support this operation |
abstract void SetProgramPulseDuration | ( | OWPowerTime | pulseDur | ) | [pure virtual] |
Sets the duration for providing a program pulse on the 1-Wire Network.
This method takes a time parameter that indicates the program pulse length when the method startProgramPulse().
Note: to avoid getting an exception, use the canDeliverPower() method to check it's availability.
pulseDur | time factor |
abstract void SetSearchAllDevices | ( | ) | [pure virtual] |
Set the 1-Wire Network search to find all iButtons and 1-Wire devices whether they are in an 'Alarm' state or not and restores the default setting of providing a 1-Wire reset command before each search.
(see setNoResetSearch() method).
abstract void SetSearchOnlyAlarmingDevices | ( | ) | [pure virtual] |
Set the 1-Wire Network search to find only iButtons and 1-Wire devices that are in an 'Alarm' state that signals a need for attention.
Not all iButton types have this feature. Some that do: DS1994, DS1920, DS2407. This selective searching can be canceled with the 'setSearchAllDevices()' method.
abstract void StartBreak | ( | ) | [pure virtual] |
Sets the 1-Wire Network voltage to 0 volts.
This method is used rob all 1-Wire Network devices of parasite power delivery to force them into a hard reset.
abstract bool StartPowerDelivery | ( | OWPowerStart | changeCondition | ) | [pure virtual] |
Sets the 1-Wire Network voltage to supply power to an iButton device.
This method takes a time parameter that indicates whether the power delivery should be done immediately, or after certain conditions have been met.
Note: to avoid getting an exception, use the canDeliverPower() and canDeliverSmartPower() method to check it's availability.
changeCondition | change condition |
true
false
abstract bool StartProgramPulse | ( | OWPowerStart | changeCondition | ) | [pure virtual] |
Sets the 1-Wire Network voltage to eprom programming level.
This method takes a time parameter that indicates whether the power delivery should be done immediately, or after certain conditions have been met.
Note: to avoid getting an exception, use the canProgram() method to check it's availability.
changeCondition | change condition |
true
if the voltage change was successful,
false
otherwise.
OneWireIOException on a 1-Wire communication error
OneWireException on a setup error with the 1-Wire adapter or the adapter does not support this operation
virtual void TargetAllFamilies | ( | ) | [virtual] |
Removes any selectivity during a search for iButtons or 1-Wire devices by family type.
The unique address for each iButton and 1-Wire device contains a family descriptor that indicates the capabilities of the device.
virtual void TargetFamily | ( | int | family | ) | [virtual] |
Takes an integer to selectively search for this desired family type.
If this method is used, then no devices of other families will be found by any of the search methods.
family | the code of the family type to target for searches |
virtual void TargetFamily | ( | byte[] | family | ) | [virtual] |
Takes an array of bytes to use for selectively searching for acceptable family codes.
If used, only devices with family codes in this array will be found by any of the search methods.
family | array of the family types to target for searches |
override string ToString | ( | ) |
Returns a string representation of this adapter (i.e.
"DS9097U COM1")
internal byte [] exclude = null [protected] |
exclude family codes
internal byte [] include = null [protected] |
include family codes
abstract string AdapterName [get] |
The name of this adapter type.
abstract bool CanBreak [get] |
Returns whether adapter can physically support 0 volt 'break' mode.
true
false
abstract bool CanDeliverPower [get] |
Returns whether the adapter can physically support strong 5 volt power mode.
true
false
abstract bool CanDeliverSmartPower [get] |
Returns whether the adapter can physically support "smart" strong 5 volt power mode.
"smart" power delivery is the ability to deliver power until it is no longer needed. The current drop it detected and power delivery is stopped.
true
false
abstract bool CanFlex [get] |
Returns whether the adapter can physically support flex speed mode.
true
false
abstract bool CanHyperdrive [get] |
Returns whether the adapter can physically support hyperdrive mode.
true
false
abstract bool CanOverdrive [get] |
Returns whether adapter can physically support overdrive mode.
true
false
abstract bool CanProgram [get] |
Returns whether adapter can physically support 12 volt power mode.
true
false
abstract string PortName [get] |
The port name for this adapter type (i.e.
COM1, LPT1, etc)
abstract System.Collections.IList PortNames [get] |
Collection of valid port names for this port type.
abstract string PortTypeDescription [get] |
Detailed description for this port type.
abstract OWSpeed Speed [get, set] |
OWSpeed representing current speed of communication on 1-Wire network.
DataIOEventHandler DataIOEvent |
event for indicating when data is transmitted