3.4
How does the API uses the DLL Export Function
The following steps show how to call the DLL export function to control the power of
the PoE and DCOUT Port on the PCIE-1182. Please refer to the sample program for
more details. (path: "C:\Advantech\PoEPowerControl\Example\")
3.4.1
Load DLL library
HMODULE hDLL = LoadLibrary(TEXT("PoEPowerControl.dll"));
3.4.2
Get DLL function
P_PPCGetNumPorts fpPPCGetNumPorts = NULL;
fpPPCGetNumPorts = (P_PPCGetNumPorts)GetProcAddress(hDLL,
"PPCGetNumPorts");
P_PPCSetPowerState fpPPCSetPowerState = NULL;
fpPPCSetPowerState = (P_PPCSetPowerState)GetProcAddress(hDLL,
"PPCSetPowerState");
P_PPCGetPowerState fpPPCGetPowerState = NULL;
fpPPCGetPowerState = (P_PPCGetPowerState)GetProcAddress(hDLL,
"PPCGetPowerState");
P_PPCSetDCPowerState fpPPCSetDCPowerState = NULL;
fpPPCDCSetPowerState = (P_PPCSetDCPowerState)GetProcAddress(hDLL,
"PPCSetDCPowerState");
P_PPCGetDCPowerState fpPPCGetDCPowerState = NULL;
fpPPCGetDCPowerState = (P_PPCGetDCPowerState)GetProcAddress(hDLL,
"PPCGetDCPowerState");
3.4.3
Set PoE Port 0 Power OFF
fpPPCSetPowerState (0, PPC_POWER_OFF);
3.4.4
Set PoE Port 0 Power ON
fpPPCSetPowerState (0, PPC_POWER_AUTO);
3.4.5
Get PoE Port 0 Power Status
State = fpPPCGetPowerState (0);
if(State == PPC_POWER_AUTO)
printf("PoE Port[0] State: Power ON\n");
else if(State == PPC_POWER_OFF)
printf("PoE Port[0] State: Power OFF\n");
3.4.6
Set Port 0 DCOUT Power OFF
fpPPCDCSetPowerState (0, PPC_POWER_OFF);
3.4.7
Set Port 0 DCOUT Power ON
fpPPCDCSetPowerState (0, PPC_POWER_AUTO);
3.4.8
Get Port 0 DCOUT Power Status
State = fpPPCGetDCPowerState (0);
if(State == PPC_POWER_AUTO)
printf("DCOUT Port[0] State: Power ON\n");
else if(State == PPC_POWER_OFF)
printf("DCOUT Port[0] State: Power OFF\n");
PCIE-1182 User Manual
14