diff --git a/XBeeLibrary/AbstractXBeeDevice.cs b/XBeeLibrary/AbstractXBeeDevice.cs
index d89a439..ef33cc1 100644
--- a/XBeeLibrary/AbstractXBeeDevice.cs
+++ b/XBeeLibrary/AbstractXBeeDevice.cs
@@ -68,8 +68,6 @@ public abstract class AbstractXBeeDevice
protected DataReader dataReader = null;
- protected XBeeProtocol xbeeProtocol = XBeeProtocol.UNKNOWN;
-
protected OperatingMode operatingMode = OperatingMode.UNKNOWN;
protected XBee16BitAddress xbee16BitAddress = XBee16BitAddress.UNKNOWN_ADDRESS;
@@ -188,6 +186,7 @@ public AbstractXBeeDevice(IConnectionInterface connectionInterface)
{
Contract.Requires(connectionInterface != null, "ConnectionInterface cannot be null.");
+ XBeeProtocol = XBeeProtocol.UNKNOWN;
this.connectionInterface = connectionInterface;
this.logger = LogManager.GetLogger(this.GetType());
logger.DebugFormat(ToString() + "Using the connection interface {0}.",
@@ -257,6 +256,7 @@ public AbstractXBeeDevice(XBeeDevice localXBeeDevice, XBee64BitAddress addr64,
if (localXBeeDevice.IsRemote)
throw new ArgumentException("The given local XBee device is remote.");
+ XBeeProtocol = XBeeProtocol.UNKNOWN;
this.localXBeeDevice = localXBeeDevice;
this.connectionInterface = localXBeeDevice.GetConnectionInterface();
this.xbee64BitAddress = addr64;
@@ -346,12 +346,12 @@ public void readDeviceInfo() /*throws TimeoutException, XBeeException*/ {
firmwareVersion = HexUtils.ByteArrayToHexString(response);
// Obtain the device protocol.
- xbeeProtocol = XBeeProtocol.UNKNOWN.DetermineProtocol(hardwareVersion, firmwareVersion);
+ XBeeProtocol = XBeeProtocol.UNKNOWN.DetermineProtocol(hardwareVersion, firmwareVersion);
// Get the 16-bit address. This must be done after obtaining the protocol because
// DigiMesh and Point-to-Multipoint protocols don't have 16-bit addresses.
- if (GetXBeeProtocol() != XBeeProtocol.DIGI_MESH
- && GetXBeeProtocol() != XBeeProtocol.DIGI_POINT)
+ if (XBeeProtocol != XBeeProtocol.DIGI_MESH
+ && XBeeProtocol != XBeeProtocol.DIGI_POINT)
{
response = GetParameter("MY");
xbee16BitAddress = new XBee16BitAddress(response);
@@ -405,19 +405,11 @@ protected OperatingMode GetOperatingMode()
return operatingMode;
}
- /**
- * Returns the XBee Protocol of this XBee device.
- *
- * To refresh this value use the {@link #readDeviceInfo()} method.
- *
- * @return The XBee device protocol.
- *
- * @see com.digi.xbee.api.models.XBeeProtocol
- */
- public virtual XBeeProtocol GetXBeeProtocol()
- {
- return xbeeProtocol;
- }
+ ///
+ /// Gets the XBee protocol of this XBee device.
+ ///
+ /// To refresh this value, use the method.
+ public virtual XBeeProtocol XBeeProtocol { get; protected set; }
///
/// Gets or sets the node identifier of thix XBee device.
@@ -1800,7 +1792,7 @@ public IOSample readIOSample()/*throws TimeoutException, XBeeException */{
// The response to the IS command in local 802.15.4 devices is empty,
// so we have to create a packet listener to receive the IO sample.
- if (!IsRemote && GetXBeeProtocol() == XBeeProtocol.RAW_802_15_4)
+ if (!IsRemote && XBeeProtocol == XBeeProtocol.RAW_802_15_4)
{
ExecuteParameter("IS");
samplePayload = receiveRaw802IOPacket();
@@ -2125,7 +2117,7 @@ protected void Set16BitAddress(XBee16BitAddress xbee16BitAddress)/*throws Timeou
* @see #setPANID(byte[])
*/
public byte[] GetPANID()/*throws TimeoutException, XBeeException */{
- switch (GetXBeeProtocol())
+ switch (XBeeProtocol)
{
case XBeeProtocol.ZIGBEE:
return GetParameter("OP");
diff --git a/XBeeLibrary/Connection/DataReader.cs b/XBeeLibrary/Connection/DataReader.cs
index 32d4103..5814fb3 100644
--- a/XBeeLibrary/Connection/DataReader.cs
+++ b/XBeeLibrary/Connection/DataReader.cs
@@ -523,7 +523,7 @@ private RemoteXBeeDevice createRemoteXBeeDevice(XBee64BitAddress addr64,
{
RemoteXBeeDevice device = null;
- switch (xbeeDevice.GetXBeeProtocol())
+ switch (xbeeDevice.XBeeProtocol)
{
case XBeeProtocol.ZIGBEE:
device = new RemoteZigBeeDevice(xbeeDevice, addr64, addr16, ni);
@@ -751,14 +751,9 @@ private void NotifyModemStatusReceived(ModemStatusEvent modemStatusEvent)
}
}
- /**
- * Returns whether this Data reader is running or not.
- *
- * @return {@code true} if the Data reader is running, {@code false}
- * otherwise.
- *
- * @see #stopReader()
- */
+ ///
+ /// Indicates whether the data reader is running or not.
+ ///
public bool IsRunning
{
get
@@ -767,11 +762,9 @@ public bool IsRunning
}
}
- /**
- * Stops the Data reader thread.
- *
- * @see #isRunning()
- */
+ ///
+ /// Stops the data reader thread.
+ ///
public void StopReader()
{
running = false;
diff --git a/XBeeLibrary/DigiMeshDevice.cs b/XBeeLibrary/DigiMeshDevice.cs
index c946f4d..bf131b8 100644
--- a/XBeeLibrary/DigiMeshDevice.cs
+++ b/XBeeLibrary/DigiMeshDevice.cs
@@ -99,8 +99,8 @@ public DigiMeshDevice(IConnectionInterface connectionInterface)
public override void Open()/*throws XBeeException */{
base.Open();
- if (xbeeProtocol != XBeeProtocol.DIGI_MESH)
- throw new XBeeDeviceException("XBee device is not a " + GetXBeeProtocol().GetDescription() + " device, it is a " + xbeeProtocol.GetDescription() + " device.");
+ if (base.XBeeProtocol != XBeeProtocol.DIGI_MESH)
+ throw new XBeeDeviceException("XBee device is not a " + XBeeProtocol.GetDescription() + " device, it is a " + base.XBeeProtocol.GetDescription() + " device.");
}
public override XBeeNetwork GetNetwork()
@@ -112,9 +112,12 @@ public override XBeeNetwork GetNetwork()
return network;
}
- public override XBeeProtocol GetXBeeProtocol()
+ public override XBeeProtocol XBeeProtocol
{
- return XBeeProtocol.DIGI_MESH;
+ get
+ {
+ return XBeeProtocol.DIGI_MESH;
+ }
}
}
}
\ No newline at end of file
diff --git a/XBeeLibrary/DigiMeshNetwork.cs b/XBeeLibrary/DigiMeshNetwork.cs
index 35f647b..d0cf8c9 100644
--- a/XBeeLibrary/DigiMeshNetwork.cs
+++ b/XBeeLibrary/DigiMeshNetwork.cs
@@ -14,16 +14,11 @@ namespace Kveer.XBeeApi
*/
public class DigiMeshNetwork : XBeeNetwork
{
-
- /**
- * Instantiates a new DigiMesh Network object.
- *
- * @param device Local DigiMesh device to get the network from.
- *
- * @throws ArgumentNullException if {@code device == null}.
- *
- * @see DigiMeshDevice
- */
+ ///
+ /// Initializes a new instance of .
+ ///
+ /// A local DigiMesh device to get the network from.
+ /// if is null.
public DigiMeshNetwork(DigiMeshDevice device)
: base(device)
{
diff --git a/XBeeLibrary/DigiPointDevice.cs b/XBeeLibrary/DigiPointDevice.cs
index 6c0ac01..d66d1f4 100644
--- a/XBeeLibrary/DigiPointDevice.cs
+++ b/XBeeLibrary/DigiPointDevice.cs
@@ -92,10 +92,12 @@ public DigiPointDevice(IConnectionInterface connectionInterface)
public override void Open()/*throws XBeeException */{
base.Open();
+
if (IsRemote)
return;
- if (xbeeProtocol != XBeeProtocol.DIGI_POINT)
- throw new XBeeDeviceException("XBee device is not a " + GetXBeeProtocol().GetDescription() + " device, it is a " + xbeeProtocol.GetDescription() + " device.");
+
+ if (base.XBeeProtocol != XBeeProtocol.DIGI_POINT)
+ throw new XBeeDeviceException("XBee device is not a " + XBeeProtocol.GetDescription() + " device, it is a " + base.XBeeProtocol.GetDescription() + " device.");
}
/*
@@ -113,14 +115,12 @@ public override XBeeNetwork GetNetwork()
return network;
}
- /*
- * (non-Javadoc)
- * @see com.digi.xbee.api.XBeeDevice#getXBeeProtocol()
- */
- //@Override
- public override XBeeProtocol GetXBeeProtocol()
+ public override XBeeProtocol XBeeProtocol
{
- return XBeeProtocol.DIGI_POINT;
+ get
+ {
+ return XBeeProtocol.DIGI_POINT;
+ }
}
}
}
\ No newline at end of file
diff --git a/XBeeLibrary/DigiPointNetwork.cs b/XBeeLibrary/DigiPointNetwork.cs
index 145e16a..5f02c05 100644
--- a/XBeeLibrary/DigiPointNetwork.cs
+++ b/XBeeLibrary/DigiPointNetwork.cs
@@ -13,16 +13,11 @@ namespace Kveer.XBeeApi
*/
public class DigiPointNetwork : XBeeNetwork
{
-
- /**
- * Instantiates a new DigiPoint Network object.
- *
- * @param device Local DigiPoint device to get the network from.
- *
- * @throws ArgumentNullException if {@code device == null}.
- *
- * @see DigiPointDevice
- */
+ ///
+ /// Initializes a new instance of .
+ ///
+ /// A local DigiPoint device to get the network from.
+ /// if is null.
public DigiPointNetwork(DigiPointDevice device)
: base(device)
{
diff --git a/XBeeLibrary/NodeDiscovery.cs b/XBeeLibrary/NodeDiscovery.cs
index 1fb4981..8352570 100644
--- a/XBeeLibrary/NodeDiscovery.cs
+++ b/XBeeLibrary/NodeDiscovery.cs
@@ -178,8 +178,8 @@ public List discoverDevices(IList ids)/*throws XBeeExc
* @throws InterfaceNotOpenException if the device is not open.
* @throws ArgumentNullException if {@code listeners == null}.
*
- * @see #isRunning()
- * @see #stopDiscoveryProcess()
+ * @see #IsRunning()
+ * @see #StopDiscoveryProcess()
*/
public void startDiscoveryProcess(IList listeners)
{
@@ -211,26 +211,25 @@ public void startDiscoveryProcess(IList listeners)
/**
* Stops the discovery process if it is running.
*
- * @see #isRunning()
+ * @see #IsRunning()
* @see #startDiscoveryProcess(List)
*/
- public void stopDiscoveryProcess()
+ public void StopDiscoveryProcess()
{
discovering = false;
}
- /**
- * Retrieves whether the discovery process is running.
- *
- * @return {@code true} if the discovery process is running, {@code false}
- * otherwise.
- *
- * @see #startDiscoveryProcess(List)
- * @see #stopDiscoveryProcess()
- */
- public bool isRunning()
+ ///
+ /// Indicates whether the discovery process is running.
+ ///
+ ///
+ ///
+ public bool IsRunning
{
- return running;
+ get
+ {
+ return running;
+ }
}
/**
@@ -292,7 +291,7 @@ public async void PacketReceived(XBeePacket receivedPacket)
_node.deviceList.Add(rdevice);
}
// If the local device is 802.15.4 wait until the 'end' command is received.
- if (_node.xbeeDevice.GetXBeeProtocol() != XBeeProtocol.RAW_802_15_4)
+ if (_node.xbeeDevice.XBeeProtocol != XBeeProtocol.RAW_802_15_4)
_node.discovering = false;
}
}
@@ -327,12 +326,12 @@ private void DiscoverDevicesAPI(IList listeners, string id)/
// In 802.15.4 devices, the discovery finishes when the 'end' command
// is received, so it's not necessary to calculate the timeout.
- if (xbeeDevice.GetXBeeProtocol() != XBeeProtocol.RAW_802_15_4)
+ if (xbeeDevice.XBeeProtocol != XBeeProtocol.RAW_802_15_4)
deadLine += CalculateTimeout(listeners);
sendNodeDiscoverCommand(id);
- if (xbeeDevice.GetXBeeProtocol() != XBeeProtocol.RAW_802_15_4)
+ if (xbeeDevice.XBeeProtocol != XBeeProtocol.RAW_802_15_4)
{
// Wait for scan timeout.
while (discovering)
@@ -411,17 +410,17 @@ private long CalculateTimeout(IList listeners)
// In DigiMesh/DigiPoint the network discovery timeout is NT + the
// network propagation time. It means that if the user sends an AT
// command just after NT ms, s/he will receive a timeout exception.
- if (xbeeDevice.GetXBeeProtocol() == XBeeProtocol.DIGI_MESH)
+ if (xbeeDevice.XBeeProtocol == XBeeProtocol.DIGI_MESH)
{
timeout += 3000;
}
- else if (xbeeDevice.GetXBeeProtocol() == XBeeProtocol.DIGI_POINT)
+ else if (xbeeDevice.XBeeProtocol == XBeeProtocol.DIGI_POINT)
{
timeout += 8000;
}
}
- if (xbeeDevice.GetXBeeProtocol() == XBeeProtocol.DIGI_MESH)
+ if (xbeeDevice.XBeeProtocol == XBeeProtocol.DIGI_MESH)
{
try
{
@@ -513,7 +512,7 @@ private async Task ParseDiscoveryAPIData(byte[] data, XBeeDevi
addr64 = new XBee64BitAddress(await ByteUtils.ReadBytes(8, inputStream));
- switch (localDevice.GetXBeeProtocol())
+ switch (localDevice.XBeeProtocol)
{
case XBeeProtocol.ZIGBEE:
case XBeeProtocol.DIGI_MESH:
@@ -537,7 +536,7 @@ private async Task ParseDiscoveryAPIData(byte[] data, XBeeDevi
manufacturerID = await ByteUtils.ReadBytes(2, inputStream);
logger.DebugFormat("{0}Discovered {1} device: 16-bit[{2}], 64-bit[{3}], id[{4}], parent[{5}], profile[{6}], manufacturer[{7}].",
- xbeeDevice.ToString(), localDevice.GetXBeeProtocol().GetDescription(), addr16,
+ xbeeDevice.ToString(), localDevice.XBeeProtocol.GetDescription(), addr16,
addr64, id, parentAddress, HexUtils.ByteArrayToHexString(profileID),
HexUtils.ByteArrayToHexString(manufacturerID));
@@ -549,18 +548,18 @@ private async Task ParseDiscoveryAPIData(byte[] data, XBeeDevi
id = ByteUtils.ReadString(inputStream);
logger.DebugFormat("{0}Discovered {1} device: 16-bit[{2}], 64-bit[{3}], id[{4}], rssi[{5}].",
- xbeeDevice.ToString(), localDevice.GetXBeeProtocol().GetDescription(), addr16, addr64, id, signalStrength);
+ xbeeDevice.ToString(), localDevice.XBeeProtocol.GetDescription(), addr16, addr64, id, signalStrength);
break;
case XBeeProtocol.UNKNOWN:
default:
logger.DebugFormat("{0}Discovered {1} device: 16-bit[{2}], 64-bit[{3}].",
- xbeeDevice.ToString(), localDevice.GetXBeeProtocol().GetDescription(), addr16, addr64);
+ xbeeDevice.ToString(), localDevice.XBeeProtocol.GetDescription(), addr16, addr64);
break;
}
// Create device and fill with parameters.
- switch (localDevice.GetXBeeProtocol())
+ switch (localDevice.XBeeProtocol)
{
case XBeeProtocol.ZIGBEE:
device = new RemoteZigBeeDevice(localDevice, addr64, addr16, id/*, role*/);
diff --git a/XBeeLibrary/Raw802Device.cs b/XBeeLibrary/Raw802Device.cs
index 1003633..dfe18fd 100644
--- a/XBeeLibrary/Raw802Device.cs
+++ b/XBeeLibrary/Raw802Device.cs
@@ -103,8 +103,9 @@ public override void Open()/*throws XBeeException */{
if (IsRemote)
return;
- if (xbeeProtocol != XBeeProtocol.RAW_802_15_4)
- throw new XBeeDeviceException("XBee device is not a " + GetXBeeProtocol().GetDescription() + " device, it is a " + xbeeProtocol.GetDescription() + " device.");
+
+ if (base.XBeeProtocol != XBeeProtocol.RAW_802_15_4)
+ throw new XBeeDeviceException("XBee device is not a " + XBeeProtocol.GetDescription() + " device, it is a " + base.XBeeProtocol.GetDescription() + " device.");
}
/*
@@ -119,17 +120,16 @@ public override XBeeNetwork GetNetwork()
if (network == null)
network = new Raw802Network(this);
+
return network;
}
- /*
- * (non-Javadoc)
- * @see com.digi.xbee.api.XBeeDevice#getXBeeProtocol()
- */
- //@Override
- public override XBeeProtocol GetXBeeProtocol()
+ public override XBeeProtocol XBeeProtocol
{
- return XBeeProtocol.RAW_802_15_4;
+ get
+ {
+ return XBeeProtocol.RAW_802_15_4;
+ }
}
/**
diff --git a/XBeeLibrary/Raw802Network.cs b/XBeeLibrary/Raw802Network.cs
index 2e9cdb7..e0b2213 100644
--- a/XBeeLibrary/Raw802Network.cs
+++ b/XBeeLibrary/Raw802Network.cs
@@ -13,16 +13,11 @@ namespace Kveer.XBeeApi
*/
public class Raw802Network : XBeeNetwork
{
-
- /**
- * Instantiates a new 802.15.4 Network object.
- *
- * @param device Local 802.15.4 device to get the network from.
- *
- * @throws ArgumentNullException if {@code device == null}.
- *
- * @see Raw802Device
- */
+ ///
+ /// Initializes a new instance of to represents a 802.15.4 network.
+ ///
+ /// A local 802.15.4 device to get the network from.
+ /// if is null.
public Raw802Network(Raw802Device device)
: base(device)
{
diff --git a/XBeeLibrary/RemoteDigiMeshDevice.cs b/XBeeLibrary/RemoteDigiMeshDevice.cs
index 04e98d7..413eb4d 100644
--- a/XBeeLibrary/RemoteDigiMeshDevice.cs
+++ b/XBeeLibrary/RemoteDigiMeshDevice.cs
@@ -56,7 +56,7 @@ public RemoteDigiMeshDevice(XBeeDevice localXBeeDevice, XBee64BitAddress addr64)
{
// Verify the local device has DigiMesh protocol.
- if (localXBeeDevice.GetXBeeProtocol() != XBeeProtocol.DIGI_MESH)
+ if (localXBeeDevice.XBeeProtocol != XBeeProtocol.DIGI_MESH)
throw new ArgumentException("The protocol of the local XBee device is not " + XBeeProtocol.DIGI_MESH.GetDescription() + ".");
}
@@ -84,13 +84,16 @@ public RemoteDigiMeshDevice(XBeeDevice localXBeeDevice, XBee64BitAddress addr64,
{
// Verify the local device has DigiMesh protocol.
- if (localXBeeDevice.GetXBeeProtocol() != XBeeProtocol.DIGI_MESH)
+ if (localXBeeDevice.XBeeProtocol != Models.XBeeProtocol.DIGI_MESH)
throw new ArgumentException("The protocol of the local XBee device is not " + XBeeProtocol.DIGI_MESH.GetDescription() + ".");
}
- public override XBeeProtocol GetXBeeProtocol()
+ public override XBeeProtocol XBeeProtocol
{
- return XBeeProtocol.DIGI_MESH;
+ get
+ {
+ return XBeeProtocol.DIGI_MESH;
+ }
}
}
}
\ No newline at end of file
diff --git a/XBeeLibrary/RemoteDigiPointDevice.cs b/XBeeLibrary/RemoteDigiPointDevice.cs
index 2d7eabe..8136d45 100644
--- a/XBeeLibrary/RemoteDigiPointDevice.cs
+++ b/XBeeLibrary/RemoteDigiPointDevice.cs
@@ -58,7 +58,7 @@ public RemoteDigiPointDevice(XBeeDevice localXBeeDevice, XBee64BitAddress addr64
{
// Verify the local device has point-to-multipoint protocol.
- if (localXBeeDevice.GetXBeeProtocol() != XBeeProtocol.DIGI_POINT)
+ if (localXBeeDevice.XBeeProtocol != XBeeProtocol.DIGI_POINT)
throw new ArgumentException("The protocol of the local XBee device is not " + XBeeProtocol.DIGI_POINT.GetDescription() + ".");
}
@@ -87,13 +87,16 @@ public RemoteDigiPointDevice(XBeeDevice localXBeeDevice, XBee64BitAddress addr64
{
// Verify the local device has point-to-multipoint protocol.
- if (localXBeeDevice.GetXBeeProtocol() != XBeeProtocol.DIGI_POINT)
+ if (localXBeeDevice.XBeeProtocol != XBeeProtocol.DIGI_POINT)
throw new ArgumentException("The protocol of the local XBee device is not " + XBeeProtocol.DIGI_POINT.GetDescription() + ".");
}
- public override XBeeProtocol GetXBeeProtocol()
+ public override XBeeProtocol XBeeProtocol
{
- return XBeeProtocol.DIGI_POINT;
+ get
+ {
+ return XBeeProtocol.DIGI_POINT;
+ }
}
}
}
\ No newline at end of file
diff --git a/XBeeLibrary/RemoteRaw802Device.cs b/XBeeLibrary/RemoteRaw802Device.cs
index 7b4a21e..2e32497 100644
--- a/XBeeLibrary/RemoteRaw802Device.cs
+++ b/XBeeLibrary/RemoteRaw802Device.cs
@@ -62,7 +62,7 @@ public RemoteRaw802Device(XBeeDevice localXBeeDevice, XBee64BitAddress addr64,
{
// Verify the local device has 802.15.4 protocol.
- if (localXBeeDevice.GetXBeeProtocol() != XBeeProtocol.RAW_802_15_4)
+ if (localXBeeDevice.XBeeProtocol != XBeeProtocol.RAW_802_15_4)
throw new ArgumentException("The protocol of the local XBee device is not " + XBeeProtocol.RAW_802_15_4.GetDescription() + ".");
}
@@ -110,7 +110,7 @@ public RemoteRaw802Device(XBeeDevice localXBeeDevice, XBee16BitAddress addr16)
{
// Verify the local device has 802.15.4 protocol.
- if (localXBeeDevice.GetXBeeProtocol() != XBeeProtocol.RAW_802_15_4)
+ if (localXBeeDevice.XBeeProtocol != XBeeProtocol.RAW_802_15_4)
throw new ArgumentException("The protocol of the local XBee device is not " + XBeeProtocol.RAW_802_15_4.GetDescription() + ".");
this.xbee16BitAddress = addr16;
@@ -129,9 +129,12 @@ public void set64BitAddress(XBee64BitAddress addr64)
}
- public override XBeeProtocol GetXBeeProtocol()
+ public override XBeeProtocol XBeeProtocol
{
- return XBeeProtocol.RAW_802_15_4;
+ get
+ {
+ return XBeeProtocol.RAW_802_15_4;
+ }
}
}
}
\ No newline at end of file
diff --git a/XBeeLibrary/RemoteXBeeDevice.cs b/XBeeLibrary/RemoteXBeeDevice.cs
index b1b0a02..0918fb0 100644
--- a/XBeeLibrary/RemoteXBeeDevice.cs
+++ b/XBeeLibrary/RemoteXBeeDevice.cs
@@ -101,7 +101,7 @@ public override void reset()/*throws TimeoutException, XBeeException */{
catch (Kveer.XBeeApi.Exceptions.TimeoutException e)
{
// Remote 802.15.4 devices do not respond to the AT command.
- if (localXBeeDevice.GetXBeeProtocol() == XBeeProtocol.RAW_802_15_4)
+ if (localXBeeDevice.XBeeProtocol == XBeeProtocol.RAW_802_15_4)
return;
else
throw e;
diff --git a/XBeeLibrary/RemoteZigBeeDevice.cs b/XBeeLibrary/RemoteZigBeeDevice.cs
index 962e36a..13898b2 100644
--- a/XBeeLibrary/RemoteZigBeeDevice.cs
+++ b/XBeeLibrary/RemoteZigBeeDevice.cs
@@ -55,7 +55,7 @@ public RemoteZigBeeDevice(XBeeDevice localXBeeDevice, XBee64BitAddress addr64)
{
// Verify the local device has ZigBee protocol.
- if (localXBeeDevice.GetXBeeProtocol() != XBeeProtocol.ZIGBEE)
+ if (localXBeeDevice.XBeeProtocol != XBeeProtocol.ZIGBEE)
throw new ArgumentException("The protocol of the local XBee device is not " + XBeeProtocol.ZIGBEE.GetDescription() + ".");
}
@@ -87,13 +87,16 @@ public RemoteZigBeeDevice(XBeeDevice localXBeeDevice, XBee64BitAddress addr64,
{
// Verify the local device has ZigBee protocol.
- if (localXBeeDevice.GetXBeeProtocol() != XBeeProtocol.ZIGBEE)
+ if (localXBeeDevice.XBeeProtocol != XBeeProtocol.ZIGBEE)
throw new ArgumentException("The protocol of the local XBee device is not " + XBeeProtocol.ZIGBEE.GetDescription() + ".");
}
- public override XBeeProtocol GetXBeeProtocol()
+ public override XBeeProtocol XBeeProtocol
{
- return XBeeProtocol.ZIGBEE;
+ get
+ {
+ return XBeeProtocol.ZIGBEE;
+ }
}
}
}
\ No newline at end of file
diff --git a/XBeeLibrary/Version.cs b/XBeeLibrary/Version.cs
index 8fdb9ce..bd75f51 100644
--- a/XBeeLibrary/Version.cs
+++ b/XBeeLibrary/Version.cs
@@ -8,11 +8,9 @@ public class Version
// Constants.
public static string CURRENT_VERSION = typeof(Version).Assembly.GetName().Version.ToString();
- /**
- * Returns the current version of the XBee Java Library.
- *
- * @return The current version of the XBee Java Library.
- */
+ ///
+ /// Gets the current version of the XBee C# Library
+ ///
public static string CurrentVersion
{
get
diff --git a/XBeeLibrary/XBee.cs b/XBeeLibrary/XBee.cs
index 165d80f..cc21cbe 100644
--- a/XBeeLibrary/XBee.cs
+++ b/XBeeLibrary/XBee.cs
@@ -4,9 +4,9 @@
namespace Kveer.XBeeApi
{
- /**
- * Helper class used to create a serial port connection interface.
- */
+ ///
+ /// Helper class used to create a serial port connection interface.
+ ///
public class XBee
{
/**
diff --git a/XBeeLibrary/XBeeDevice.cs b/XBeeLibrary/XBeeDevice.cs
index ec1f9c9..ff03742 100644
--- a/XBeeLibrary/XBeeDevice.cs
+++ b/XBeeLibrary/XBeeDevice.cs
@@ -524,7 +524,7 @@ protected void SendDataAsync(XBee64BitAddress address, byte[] data)/*throws XBee
logger.DebugFormat(ToString() + "Sending data asynchronously to {0} >> {1}.", address, HexUtils.PrettyHexString(data));
XBeePacket xbeePacket;
- switch (GetXBeeProtocol())
+ switch (XBeeProtocol)
{
case XBeeProtocol.RAW_802_15_4:
xbeePacket = new TX64Packet(GetNextFrameID(), address, (byte)XBeeTransmitOptions.NONE, data);
@@ -663,7 +663,7 @@ protected void SendData(XBee64BitAddress address, byte[] data)/*throws TimeoutEx
logger.DebugFormat(ToString() + "Sending data to {0} >> {1}.", address, HexUtils.PrettyHexString(data));
XBeePacket xbeePacket;
- switch (GetXBeeProtocol())
+ switch (XBeeProtocol)
{
case XBeeProtocol.RAW_802_15_4:
xbeePacket = new TX64Packet(GetNextFrameID(), address, (byte)XBeeTransmitOptions.NONE, data);
@@ -768,7 +768,7 @@ public void SendData(RemoteXBeeDevice xbeeDevice, byte[] data)/*throws TimeoutEx
if (xbeeDevice == null)
throw new ArgumentNullException("Remote XBee device cannot be null");
- switch (GetXBeeProtocol())
+ switch (XBeeProtocol)
{
case XBeeProtocol.ZIGBEE:
case XBeeProtocol.DIGI_POINT:
diff --git a/XBeeLibrary/XBeeLibrary.sln b/XBeeLibrary/XBeeLibrary.sln
index 187d404..19549d8 100644
--- a/XBeeLibrary/XBeeLibrary.sln
+++ b/XBeeLibrary/XBeeLibrary.sln
@@ -5,6 +5,8 @@ VisualStudioVersion = 12.0.31101.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XBeeApi", "XBeeApi.csproj", "{65F68CE1-98B2-4D68-846C-C12668C8D00B}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApplication1", "..\ConsoleApplication1\ConsoleApplication1.csproj", "{5B5F5749-DEA3-4961-B271-62BAABC0F5D6}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -15,6 +17,10 @@ Global
{65F68CE1-98B2-4D68-846C-C12668C8D00B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{65F68CE1-98B2-4D68-846C-C12668C8D00B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{65F68CE1-98B2-4D68-846C-C12668C8D00B}.Release|Any CPU.Build.0 = Release|Any CPU
+ {5B5F5749-DEA3-4961-B271-62BAABC0F5D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {5B5F5749-DEA3-4961-B271-62BAABC0F5D6}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {5B5F5749-DEA3-4961-B271-62BAABC0F5D6}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {5B5F5749-DEA3-4961-B271-62BAABC0F5D6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/XBeeLibrary/XBeeNetwork.cs b/XBeeLibrary/XBeeNetwork.cs
index 1bbefd2..98a8065 100644
--- a/XBeeLibrary/XBeeNetwork.cs
+++ b/XBeeLibrary/XBeeNetwork.cs
@@ -29,15 +29,10 @@ public class XBeeNetwork
protected ILog logger;
- /**
- * Instantiates a new {@code XBeeNetwork} object.
- *
- * @param device Local XBee device to get the network from.
- *
- * @throws ArgumentNullException if {@code device == null}.
- *
- * @see XBeeDevice
- */
+ ///
+ /// Initializes a new instance of .
+ ///
+ /// A local XBee device to get the network from.
public XBeeNetwork(XBeeDevice device)
{
if (device == null)
@@ -191,11 +186,11 @@ public void removeDiscoveryListener(IDiscoveryListener listener)
* @throws InterfaceNotOpenException if the device is not open.
*
* @see #addDiscoveryListener(IDiscoveryListener)
- * @see #stopDiscoveryProcess()
+ * @see #StopDiscoveryProcess()
*/
public void startDiscoveryProcess()
{
- if (isDiscoveryRunning())
+ if (IsDiscoveryRunning)
throw new InvalidOperationException("The discovery process is already running.");
lock (discoveryListeners)
@@ -212,27 +207,25 @@ public void startDiscoveryProcess()
* any parameter during the discovery process you will receive a timeout
* exception.
*
- * @see #isDiscoveryRunning()
+ * @see #IsDiscoveryRunning()
* @see #removeDiscoveryListener(IDiscoveryListener)
* @see #startDiscoveryProcess()
*/
- public void stopDiscoveryProcess()
+ public void StopDiscoveryProcess()
{
- nodeDiscovery.stopDiscoveryProcess();
+ nodeDiscovery.StopDiscoveryProcess();
}
- /**
- * Retrieves whether the discovery process is running or not.
- *
- * @return {@code true} if the discovery process is running, {@code false}
- * otherwise.
- *
- * @see #startDiscoveryProcess()
- * @see #stopDiscoveryProcess()
- */
- public bool isDiscoveryRunning()
+ ///
+ /// Indicates whether the discovery process is running or not.
+ ///
+ /// true if the discovery process is running, false otherwise.
+ public bool IsDiscoveryRunning
{
- return nodeDiscovery.isRunning();
+ get
+ {
+ return nodeDiscovery.IsRunning;
+ }
}
/**
@@ -275,7 +268,7 @@ public void setDiscoveryOptions(ISet options)/*throws TimeoutE
if (options == null)
throw new ArgumentNullException("Options cannot be null.");
- int value = DiscoveryOptions.APPEND_DD.CalculateDiscoveryValue(localDevice.GetXBeeProtocol(), options);
+ int value = DiscoveryOptions.APPEND_DD.CalculateDiscoveryValue(localDevice.XBeeProtocol, options);
localDevice.SetParameter("NO", ByteUtils.IntToByteArray(value));
}
@@ -428,9 +421,9 @@ public RemoteXBeeDevice GetDevice(XBee64BitAddress address)
* @throws OperationNotSupportedException if the protocol of the local XBee device is DigiMesh or Point-to-Multipoint.
*/
public RemoteXBeeDevice GetDevice(XBee16BitAddress address)/*throws OperationNotSupportedException */{
- if (localDevice.GetXBeeProtocol() == XBeeProtocol.DIGI_MESH)
+ if (localDevice.XBeeProtocol == XBeeProtocol.DIGI_MESH)
throw new OperationNotSupportedException("DigiMesh protocol does not support 16-bit addressing.");
- if (localDevice.GetXBeeProtocol() == XBeeProtocol.DIGI_POINT)
+ if (localDevice.XBeeProtocol == XBeeProtocol.DIGI_POINT)
throw new OperationNotSupportedException("Point-to-Multipoint protocol does not support 16-bit addressing.");
if (address == null)
throw new ArgumentNullException("16-bit address cannot be null.");
@@ -756,7 +749,7 @@ private XBee16BitAddress Get16BitAddress(RemoteXBeeDevice device)
XBee16BitAddress address = null;
- switch (device.GetXBeeProtocol())
+ switch (device.XBeeProtocol)
{
case XBeeProtocol.RAW_802_15_4:
address = ((RemoteRaw802Device)device).Get16BitAddress();
diff --git a/XBeeLibrary/ZigBeeDevice.cs b/XBeeLibrary/ZigBeeDevice.cs
index cfb1f86..29ab8c5 100644
--- a/XBeeLibrary/ZigBeeDevice.cs
+++ b/XBeeLibrary/ZigBeeDevice.cs
@@ -91,8 +91,8 @@ public ZigBeeDevice(IConnectionInterface connectionInterface)
public override void Open()/*throws XBeeException */{
base.Open();
- if (xbeeProtocol != XBeeProtocol.ZIGBEE)
- throw new XBeeDeviceException("XBee device is not a " + GetXBeeProtocol().GetDescription() + " device, it is a " + xbeeProtocol.GetDescription() + " device.");
+ if (base.XBeeProtocol != XBeeProtocol.ZIGBEE)
+ throw new XBeeDeviceException("XBee device is not a " + XBeeProtocol.GetDescription() + " device, it is a " + base.XBeeProtocol.GetDescription() + " device.");
}
public override XBeeNetwork GetNetwork()
@@ -105,14 +105,12 @@ public override XBeeNetwork GetNetwork()
return network;
}
- /*
- * (non-Javadoc)
- * @see com.digi.xbee.api.XBeeDevice#getXBeeProtocol()
- */
- //@Override
- public override XBeeProtocol GetXBeeProtocol()
+ public override XBeeProtocol XBeeProtocol
{
- return XBeeProtocol.ZIGBEE;
+ get
+ {
+ return XBeeProtocol.ZIGBEE;
+ }
}
}
}
\ No newline at end of file