OceanDirect  2.4.0
OceanDirect C++/C API
oceandirect::api::Ipv4AddressAPI Class Reference

Public Member Functions

void addStaticIpAddress (long deviceID, int *errorCode, unsigned char ifNum, unsigned char *ipAddress, int ipAddressLength, unsigned int netmask)
 
void deleteStaticIpAddress (long deviceID, int *errorCode, unsigned char ifNum, unsigned char addressIndex)
 
void getDefaultGatewayIpAddress (long deviceID, int *errorCode, unsigned char ifNum, unsigned char *outIpAddress, int ipAddressLength)
 
int getNumberOfIpAddresses (long deviceID, int *errorCode, unsigned char ifNum)
 
bool isDHCPEnabled (long deviceID, int *errorCode, unsigned char ifNum)
 
void readIpAddress (long deviceID, int *errorCode, unsigned char ifNum, unsigned char addressIndex, unsigned char *ipAddress, int ipAddressLength, unsigned int *netmask)
 
void setDefaultGatewayIpAddress (long deviceID, int *errorCode, unsigned char ifNum, unsigned char *ipAddress, int ipAddressLength)
 
void setDHCPEnable (long deviceID, int *errorCode, unsigned char ifNum, unsigned char enabled)
 

Static Public Member Functions

static Ipv4AddressAPIgetInstance ()
 
static void shutdown ()
 

Member Function Documentation

◆ addStaticIpAddress()

void oceandirect::api::Ipv4AddressAPI::addStaticIpAddress ( long  deviceID,
int *  errorCode,
unsigned char  ifNum,
unsigned char *  ipAddress,
int  ipAddressLength,
unsigned int  netmask 
)

Add a static IP address to the specified interface. The IP address is specified as 4 bytes in an array. The leading part of the IP address must contain the first element of the array, followed by the remaining parts in order to the last part of the IP address in the fourth element of the array.

Parameters
deviceIDthe ID of the device returned by getDeviceIDs.
errorCodea code indicating the result of the operation: ERROR_SUCCESS on success; ERROR_NO_DEVICE if the device does not exist; ERROR_FEATURE_NOT_FOUND the feature is not enabled on the specified device; ERROR_TRANSFER_ERROR the device protocol for the feature could not be found; ERROR_CODE_INVALID_ARGUMENT the interface number is not 0 or 1 or the ipAddress array size is less than 4.
ifNumthe interface number: 0 for Ethernet, 1 for wi-fi.
ipAddressthe static IP address to be added.
netmaskthe netmask specifying the subnet of the network the device is on.

◆ deleteStaticIpAddress()

void oceandirect::api::Ipv4AddressAPI::deleteStaticIpAddress ( long  deviceID,
int *  errorCode,
unsigned char  ifNum,
unsigned char  addressIndex 
)

Delete a static IP address on the specified interface.

Parameters
deviceIDthe ID of the device returned by getDeviceIDs.
errorCodea code indicating the result of the operation: ERROR_SUCCESS on success; ERROR_NO_DEVICE if the device does not exist; ERROR_FEATURE_NOT_FOUND the feature is not enabled on the specified device; ERROR_TRANSFER_ERROR the device protocol for the feature could not be found; ERROR_CODE_INVALID_ARGUMENT the interface number is not 0 or 1.
ifNumthe interface number: 0 for Ethernet, 1 for wi-fi.
addressIndexthe index of the address to be deleted.

◆ getDefaultGatewayIpAddress()

void oceandirect::api::Ipv4AddressAPI::getDefaultGatewayIpAddress ( long  deviceID,
int *  errorCode,
unsigned char  ifNum,
unsigned char *  outIpAddress,
int  ipAddressLength 
)

Get the gateway ip address for the device on the specified interface.

Parameters
deviceIDthe ID of the device returned by getDeviceIDs.
errorCodea code indicating the result of the operation: ERROR_SUCCESS on success; ERROR_NO_DEVICE if the device does not exist; ERROR_FEATURE_NOT_FOUND the feature is not enabled on the specified device; ERROR_TRANSFER_ERROR the device protocol for the feature could not be found; ERROR_CODE_INVALID_ARGUMENT the interface number is not 0 or 1 or the ipAddress array size is less than 4.
ifNumthe interface number: 0 for Ethernet, 1 for wi-fi.
outIpAddressthe output buffer for gateway IP address.
ipAddressLengththe output buffer length.

◆ getNumberOfIpAddresses()

int oceandirect::api::Ipv4AddressAPI::getNumberOfIpAddresses ( long  deviceID,
int *  errorCode,
unsigned char  ifNum 
)

Get the number of IP addresses available on the specified interface. If DHCP is enabled on the specified interface then index 0 represents the DHCP address and the following addresses will be any static IP addresses.

Parameters
deviceIDthe ID of the device returned by getDeviceIDs.
errorCodea code indicating the result of the operation: ERROR_SUCCESS on success; ERROR_NO_DEVICE if the device does not exist; ERROR_FEATURE_NOT_FOUND the feature is not enabled on the specified device; ERROR_TRANSFER_ERROR the device protocol for the feature could not be found; ERROR_CODE_INVALID_ARGUMENT the interface number is not 0 or 1.
ifNumthe interface number: 0 for Ethernet, 1 for wi-fi.
Returns
the number of IP addresses on the specified interface.

◆ isDHCPEnabled()

bool oceandirect::api::Ipv4AddressAPI::isDHCPEnabled ( long  deviceID,
int *  errorCode,
unsigned char  ifNum 
)

Check to see if DHCP (client) is enabled on the specified interface. If DHCP is enabled then the device will be able to receive and IP address from a DHCP server oin the network it is connected to.

Parameters
deviceIDthe ID of the device returned by getDeviceIDs.
errorCodea code indicating the result of the operation: ERROR_SUCCESS on success; ERROR_NO_DEVICE if the device does not exist; ERROR_FEATURE_NOT_FOUND the feature is not enabled on the specified device; ERROR_TRANSFER_ERROR the device protocol for the feature could not be found; ERROR_CODE_INVALID_ARGUMENT the interface number is not 0 or 1.
ifNumthe interface number: 0 for Ethernet, 1 for wi-fi.
Returns
true if DHCP is enabled on the specified interface, false otherwise.

◆ readIpAddress()

void oceandirect::api::Ipv4AddressAPI::readIpAddress ( long  deviceID,
int *  errorCode,
unsigned char  ifNum,
unsigned char  addressIndex,
unsigned char *  ipAddress,
int  ipAddressLength,
unsigned int *  netmask 
)

Retrieve the IP address and netmask on the specified interface. If DHCP is enabled on the specified interface then index 0 represents the DHCP address and the following addresses will be any static IP addresses. The IP address is returned as 4 bytes into a user supplied array. The leading part of the IP address will be in the first element of the array, followed by the remaining parts in order to the last part of the IP address in the fourth element of the array.

Parameters
deviceIDthe ID of the device returned by getDeviceIDs.
errorCodea code indicating the result of the operation: ERROR_SUCCESS on success; ERROR_NO_DEVICE if the device does not exist; ERROR_FEATURE_NOT_FOUND the feature is not enabled on the specified device; ERROR_TRANSFER_ERROR the device protocol for the feature could not be found; ERROR_CODE_INVALID_ARGUMENT the interface number is not 0 or 1 or the ipAddress array size is less than 4.
ifNumthe interface number: 0 for Ethernet, 1 for wi-fi.
addressIndexthe index of the address to be retrieved.
ipAddressa pointer to the array that will receive the IP address.
ipAddressLengththe size of the array ipAddress.
netmaska pointer to the netmask specifying the subnet of the network the device is on.

◆ setDefaultGatewayIpAddress()

void oceandirect::api::Ipv4AddressAPI::setDefaultGatewayIpAddress ( long  deviceID,
int *  errorCode,
unsigned char  ifNum,
unsigned char *  ipAddress,
int  ipAddressLength 
)

Set the gateway ip address for the device on the specified interface.

Parameters
deviceIDthe ID of the device returned by getDeviceIDs.
errorCodea code indicating the result of the operation: ERROR_SUCCESS on success; ERROR_NO_DEVICE if the device does not exist; ERROR_FEATURE_NOT_FOUND the feature is not enabled on the specified device; ERROR_TRANSFER_ERROR the device protocol for the feature could not be found; ERROR_CODE_INVALID_ARGUMENT the interface number is not 0 or 1 or the ipAddress array size is less than 4.
ifNumthe interface number: 0 for Ethernet, 1 for wi-fi.
ipAddressthe gateway IP address.
ipAddressLengththe gateway IP address length.

◆ setDHCPEnable()

void oceandirect::api::Ipv4AddressAPI::setDHCPEnable ( long  deviceID,
int *  errorCode,
unsigned char  ifNum,
unsigned char  enabled 
)

Turn the DHCP client on or off for the device on the specified interface.

Parameters
deviceIDthe ID of the device returned by getDeviceIDs.
errorCodea code indicating the result of the operation: ERROR_SUCCESS on success; ERROR_NO_DEVICE if the device does not exist; ERROR_FEATURE_NOT_FOUND the feature is not enabled on the specified device; ERROR_TRANSFER_ERROR the device protocol for the feature could not be found; ERROR_CODE_INVALID_ARGUMENT the interface number is not 0 or 1.
ifNumthe interface number: 0 for Ethernet, 1 for wi-fi.
enableda value of 0 turns the DHCP client off, a value greater than 0 turns the DHCP client on.

The documentation for this class was generated from the following file: