// GetDeviceInformation.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include "windows.h" #include "PACSDK.h" void info(); void scan_slot(); int main(int argc, char* argv[]) { printf("ICPDAS (R) SDK Demo for XP-8000\n"); info(); scan_slot(); return 0; } void info() { char SerialNumber[32]; char sdk_version[32]; char backplane_version[32]; pac_GetSerialNumber(SerialNumber); pac_GetSDKVersion(sdk_version); pac_GetBackplaneID(backplane_version); if((strcmp(SerialNumber, "") == 0)) { strcpy(SerialNumber, "Get Serial Number failure!"); } printf("Device's information:\n"); printf("Serial number is %s\n", SerialNumber); printf("SDK version is %s\n", sdk_version); printf("Backplane version is %s\n", backplane_version); printf("Slot count is %d\n", pac_GetSlotCount()); printf("Battery 1 is %s.\n", pac_GetBatteryLevel(1)? "high voltage":"low voltage"); printf("Battery 2 is %s.\n", pac_GetBatteryLevel(2)? "high voltage":"low voltage"); } void scan_slot() { char strName[32]; for(int i = 1; i <= pac_GetSlotCount(); i++) { strcpy(strName, ""); int mt = pac_GetModuleName((BYTE)i, strName); if(mt != 255) printf("Slot %d is %s\n", i, strName); if(mt == 255) //I-87K modules { HANDLE hPort = uart_Open(""); pac_ChangeSlot((BYTE)i); uart_SendCmd(hPort, "$00M", strName); uart_Close(hPort); printf("Slot %d is %s\n", i, strName+3); } } }