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

Public Member Functions

bool getEthernetAddOnAvailable (long deviceID, int *errorCode)
 
bool getEthernetLoopBackTest (long deviceID, int *errorCode)
 
void getEthernetMACAddress (long deviceID, int *errorCode, std::uint8_t *outMACAddress, std::uint32_t outMACAddressSize)
 
bool getIPAddressAssignedMode (long deviceID, int *errorCode)
 
void getManualNetworkConfiguration (long deviceID, int *errorCode, std::uint8_t *outIpv4Address, std::uint32_t ipv4AddressSize, std::uint8_t *outSubnetMask, std::uint32_t subnetMaskSize, std::uint8_t *outDefaultGateway, std::uint32_t defaultGatewaySize, std::uint8_t *outDNSServer, std::uint32_t dnsServerSize)
 
bool getMulticastGroupEnabled (long deviceID, int *errorCode, std::uint32_t interfaceIndex)
 
void getNetworkConfiguration (long deviceID, int *errorCode, bool &outManualAssignment, std::uint8_t *outIpv4Address, std::uint32_t ipv4AddressSize, std::uint8_t *outSubnetMask, std::uint32_t subnetMaskSize, std::uint8_t *outDefaultGateway, std::uint32_t defaultGatewaySize, std::uint8_t *outDNSServer, std::uint32_t dnsServerSize)
 
std::uint32_t getNetworkInterfaceCount (long deviceID, int *errorCode)
 
bool getNetworkInterfaceStatus (long deviceID, int *errorCode, std::uint32_t interfaceIndex)
 
std::uint32_t getNetworkInterfaceType (long deviceID, int *errorCode, std::uint32_t interfaceIndex)
 
void saveNetworkInterfaceSetting (long deviceID, int *errorCode, std::uint32_t interfaceIndex)
 
void setEthernetMACAddress (long deviceID, int *errorCode, const std::uint8_t *macAddress, std::uint32_t macAddressSize)
 
void setIPAddressAssignedMode (long deviceID, int *errorCode, bool useStaticIP)
 
void setManualNetworkConfiguration (long deviceID, int *errorCode, const std::uint8_t *ipv4Address, std::uint32_t ipv4AddressSize, const std::uint8_t *subnetMask, std::uint32_t subnetMaskSize, const std::uint8_t *defaultGateway, std::uint32_t defaultGatewaySize, const std::uint8_t *dnsServer, std::uint32_t dnsServerSize)
 
void setMulticastGroupEnabled (long deviceID, int *errorCode, std::uint32_t interfaceIndex, bool enabled)
 
void setNetworkInterfaceStatus (long deviceID, int *errorCode, std::uint32_t interfaceIndex, bool enable)
 

Static Public Member Functions

static NetworkConfigurationAPIgetInstance ()
 
static void shutdown ()
 

Member Function Documentation

◆ getEthernetAddOnAvailable()

bool oceandirect::api::NetworkConfigurationAPI::getEthernetAddOnAvailable ( long  deviceID,
int *  errorCode 
)

Return True or False on whether an ethernet add-on package is available in the OBP2 enabled device.

Parameters
deviceID[in]the ID of the device returned by getDeviceIDs.
errorCode[out]a 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.
Returns
True if the add-on is available otherwise False.

◆ getEthernetLoopBackTest()

bool oceandirect::api::NetworkConfigurationAPI::getEthernetLoopBackTest ( long  deviceID,
int *  errorCode 
)

Run a loop back and return true if it's successful.

Parameters
deviceID[in]the ID of the device returned by getDeviceIDs.
errorCode[out]a 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.
Returns
True for successful loop back testing otherwise its False.

◆ getEthernetMACAddress()

void oceandirect::api::NetworkConfigurationAPI::getEthernetMACAddress ( long  deviceID,
int *  errorCode,
std::uint8_t *  outMACAddress,
std::uint32_t  outMACAddressSize 
)

Read the ethernet 6-byte mac address from an OBP2 enabled device.

Parameters
deviceID[in]the ID of the device returned by getDeviceIDs.
errorCode[out]a 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.
outMACAddress[in]The output buffer for mac address.
outMACAddressSize[in]The output buffer size which must be at least 6 bytes long.

◆ getManualNetworkConfiguration()

void oceandirect::api::NetworkConfigurationAPI::getManualNetworkConfiguration ( long  deviceID,
int *  errorCode,
std::uint8_t *  outIpv4Address,
std::uint32_t  ipv4AddressSize,
std::uint8_t *  outSubnetMask,
std::uint32_t  subnetMaskSize,
std::uint8_t *  outDefaultGateway,
std::uint32_t  defaultGatewaySize,
std::uint8_t *  outDNSServer,
std::uint32_t  dnsServerSize 
)

Read the network configuration parameters (static ip address) from an OBP2 enabled device.

Parameters
deviceID[in]the ID of the device returned by getDeviceIDs.
errorCode[out]a 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.
outIpv4Address[out]Output buffer for the static IP address.
ipv4AddressSize[in]The static IP address buffer length.
outSubnetMask[out]Output buffer for the subnet mask.
subnetMaskSize[in]The subnet mask buffer length.
outDefaultGateway[out]Output buffer for the default gateway IP address.
defaultGatewaySize[in]The default gateway buffer length.
outDNSServer[out]Output buffer for the DNS server IP address.
dnsServerSize[in]The DNS server buffer length.

◆ getMulticastGroupEnabled()

bool oceandirect::api::NetworkConfigurationAPI::getMulticastGroupEnabled ( long  deviceID,
int *  errorCode,
std::uint32_t  interfaceIndex 
)

Return true if the multicast group message is enabled otherwise it's false.

Parameters
deviceID[in]the ID of the device returned by getDeviceIDs.
errorCode[out]a 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.
interfaceIndex[in]The interface to look at.
Returns
True if it's enabled otherwise it's False.

◆ getNetworkConfiguration()

void oceandirect::api::NetworkConfigurationAPI::getNetworkConfiguration ( long  deviceID,
int *  errorCode,
bool &  outManualAssignment,
std::uint8_t *  outIpv4Address,
std::uint32_t  ipv4AddressSize,
std::uint8_t *  outSubnetMask,
std::uint32_t  subnetMaskSize,
std::uint8_t *  outDefaultGateway,
std::uint32_t  defaultGatewaySize,
std::uint8_t *  outDNSServer,
std::uint32_t  dnsServerSize 
)

Read the network configuration parameters from an OBP2 enabled device.

Parameters
deviceID[in]the ID of the device returned by getDeviceIDs.
errorCode[out]a 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.
outManualAssignment[out]An output argument that contains the IP Address mode. True if it's static IP address otherwise it's False (dynamic IP).
outIpv4Address[out]Output buffer for the static IP address.
ipv4AddressSize[in]The static IP address buffer size.
outSubnetMask[out]Output buffer for the subnet mask.
subnetMaskSize[in]The subnet mask buffer size.
outDefaultGateway[out]Output buffer for the default gateway IP address.
defaultGatewaySize[in]The default gateway buffer size.
outDNSServer[out]Output buffer for the DNS server IP address.
dnsServerSize[in]The DNS server buffer size.

◆ getNetworkInterfaceCount()

std::uint32_t oceandirect::api::NetworkConfigurationAPI::getNetworkInterfaceCount ( long  deviceID,
int *  errorCode 
)

Read the number of supported communication 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.
Returns
The number of interface.

◆ getNetworkInterfaceStatus()

bool oceandirect::api::NetworkConfigurationAPI::getNetworkInterfaceStatus ( long  deviceID,
int *  errorCode,
std::uint32_t  interfaceIndex 
)

Return true if the interface is enabled otherwise it's false.

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.
interfaceIndexThe interface to look at.
Returns
True if the interface if enabled otherwise it's False.

◆ getNetworkInterfaceType()

std::uint32_t oceandirect::api::NetworkConfigurationAPI::getNetworkInterfaceType ( long  deviceID,
int *  errorCode,
std::uint32_t  interfaceIndex 
)

Return the interface type of the given interface index.

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.
interfaceIndexThe interface to look at.
Returns
The interface type which could be one 0(Loopback), 1(wired ethernet), 2 (WIFI), and 3 (USB - CDC Ethernet).

◆ saveNetworkInterfaceSetting()

void oceandirect::api::NetworkConfigurationAPI::saveNetworkInterfaceSetting ( long  deviceID,
int *  errorCode,
std::uint32_t  interfaceIndex 
)

Save the network interface settings to the device.

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.
interfaceIndexThe interface to save to.

◆ setEthernetMACAddress()

void oceandirect::api::NetworkConfigurationAPI::setEthernetMACAddress ( long  deviceID,
int *  errorCode,
const std::uint8_t *  macAddress,
std::uint32_t  macAddressSize 
)

Writes a new ethernet 6-byte mac address into an OBP2 enabled device.

Parameters
deviceID[in]the ID of the device returned by getDeviceIDs.
errorCode[out]a 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.
macAddress[in]The new mac address.
macAddress[in]The new mac address buffer size which is 6-byte long.
Returns
The mac address.

◆ setManualNetworkConfiguration()

void oceandirect::api::NetworkConfigurationAPI::setManualNetworkConfiguration ( long  deviceID,
int *  errorCode,
const std::uint8_t *  ipv4Address,
std::uint32_t  ipv4AddressSize,
const std::uint8_t *  subnetMask,
std::uint32_t  subnetMaskSize,
const std::uint8_t *  defaultGateway,
std::uint32_t  defaultGatewaySize,
const std::uint8_t *  dnsServer,
std::uint32_t  dnsServerSize 
)

Write the network configuration parameters (static ip address) on OBP2 enabled device.

Parameters
deviceID[in]the ID of the device returned by getDeviceIDs.
errorCode[out]a 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.
ipv4Address[in]The static IP address.
ipv4AddressSize[in]The static IP address buffer length.
subnetMask[in]The subnet mask.
subnetMaskSize[in]The subnet mask buffer length.
defaultGateway[in]The default gateway IP address.
defaultGatewaySize[in]The default gateway buffer length.
dnsServer[in]The DNS server IP address.
dnsServerSize[in]The DNS server buffer length.

◆ setMulticastGroupEnabled()

void oceandirect::api::NetworkConfigurationAPI::setMulticastGroupEnabled ( long  deviceID,
int *  errorCode,
std::uint32_t  interfaceIndex,
bool  enabled 
)

Enable or disable the multicast message group.

Parameters
deviceID[in]the ID of the device returned by getDeviceIDs.
errorCode[out]a 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.
interfaceIndex[in]The interface to look at.
enable[in]True will enable the multicast group message. False will disable it.

◆ setNetworkInterfaceStatus()

void oceandirect::api::NetworkConfigurationAPI::setNetworkInterfaceStatus ( long  deviceID,
int *  errorCode,
std::uint32_t  interfaceIndex,
bool  enable 
)

Enable or disable the 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.
interfaceIndexThe interface to look at.
enableTrue will enable the interface. False will disable it.

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