The Functions for communication
The following ifdef block is the standard way of creating macros which make exporting
from a DLL simpler. All files within this DLL are compiled with the DLL_API
symbol defined on the command line. this symbol should not be defined on any project
that uses this DLL. This way any other project whose source files include this file see
DLL_API functions as being imported from a DLL, wheras this DLL sees symbols
defined with this macro as being exported.
#ifndef DLL_API
#define DLL_API extern "C" __declspec(dllimport)
#endif
Define __stdcall:
#define WIN_API __stdcall
WORD: unsigned short
BOOL: bool
ULONG: unsigned long
1. Set the device network parameters under USB communication
DLL_API WORD WINAPI dsoUSBModeSetIPAddr(WORD DeviceIndex,
ULONG nIP,
ULONG nSubnetMask,
ULONG nGateway,
USHORT nPort,
BYTE* pMac);
Return Value:
If the function succeeds, the return value is 1.
If the function fails, the return value is zero.
Parameters:
WORD DeviceIndex, The current device index
ULONG nIP, IP address,Example: 192.168.1.1 , IP = 0xC0A80101
ULONG nSubnetMask, subnetmask, Example : 255.255.255.0, nSubnetMask = 0xFFFFFF00
ULONG nGateway, gateway, Example 192.168.1.1, nGateway = 0Xc0A80101
USHORT nPort, the port , Range: 1 ~ 65535
BYTE* pMac, MAC address , MAC[6] = {FC,EF,A8,11,1F,5}
Remarks:
Set the device network parameters under USB communication
2. Get the device network parameters under USB communication
DLL_API WORD WINAPI dsoUSBModeGetIPAddr(WORD DeviceIndex,
ULONG* pIP,
ULONG* pSubMask,
ULONG* pGateway,
WORD* pPort,
BYTE* pMac);
Return Value:
If the function succeeds, the return value is 1.
If the function fails, the return value is zero.
Parameters:
WORD DeviceIndex, The current device index
ULONG* pIP, IP address,Example: 192.168.1.1, *pIP = 0xC0A80101
ULONG* pSubnetMask, Example: 255.255.255.0, *pSubnetMask = 0xFFFFFF00
ULONG* pGateway, Example: 192.168.1.1, *pGateway = 0Xc0A80101
USHORT* pPort, the port , Example: 1 ~ 65535
BYTE* pMac, MAC address
Remarks:
Get the device network parameters under USB communication
3. Change USB communication to NETWORK communication
DLL_API WORD WINAPI dsoOpenLan(WORD DeviceIndex,
WORD nMode);
Return Value:
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero.
Parameters:
WORD DeviceIndex, The current device index
WORD nMode, LAN or WIFI, if LAN, nMode = 0, if WIFI , nMode = 1
Remarks:
When switch to network mode, please invoke this function to notify the device to switch
communication mode first. If switching to WIFI mode, please wait for about 90 seconds after
invoke this function to ensure WIFI start –up already.
4. Set the device network parameters under network communication
DLL_API WORD WINAPI dsoLANModeSetIPAddr(WORD DeviceIndex,
ULONG nIP,
ULONG nSubnetMask,
ULONG nGateway,
USHORT nPort,
BYTE* pMac);
Remarks: the same as function dsoUSBModeSetIPAddr
5. Get the device network parameters under network communication