T_uezError IMSLoadDirectoryINI(TUInt32 aDrive) { T_uezINISession ini; TInt32 numShows; char filename[40]; char title[7]; char dir[5]; TUInt8 i; T_slideshowDefinition *p_list = G_ws->iSlideshowList.iList; sprintf(filename, "%d:/SLIDES/SLIDES.INI" , aDrive); if(UEZINIOpen(filename, &ini) == UEZ_ERROR_NONE){ if (UEZINIGotoSection(ini, UEZ_SLIDESHOW_NAME) == UEZ_ERROR_NONE){ UEZINIGetInteger32(ini, "numShows", 0, &numShows); if(!numShows){ UEZINIGotoSection(ini, "default"); UEZINIGetInteger32(ini, "numShows", 0, &numShows); } } if(numShows){ for( i = 1; i <= numShows; i++){ sprintf(title, "Title%d", i); if(UEZINIGetString(ini, title, "",p_list->iName, MAX_SLIDESHOW_DEF_NAME_LEN) == UEZ_ERROR_NONE){ sprintf(dir, "Dir%d", i); if(UEZINIGetString(ini, dir, "",p_list->iDirectory, MAX_SLIDESHOW_DEF_DIR_LEN) == UEZ_ERROR_NONE){ p_list->iDrive = aDrive; p_list++; G_ws->iSlideshowList.iCount++; } } else return UEZ_ERROR_EMPTY; } } else{ UEZINIClose(ini); return UEZ_ERROR_EMPTY; } return UEZINIClose(ini); } return UEZ_ERROR_EMPTY; }
/*---------------------------------------------------------------------------* * Routine: SetupTasks *---------------------------------------------------------------------------* * Description: * Setup tasks that run besides main or the main menu. *---------------------------------------------------------------------------*/ void INetworkConfigureWiredConnection(T_uezDevice network) { T_uezNetworkSettings network_settings = { UEZ_NETWORK_TYPE_INFRASTRUCTURE, /* -------------- General Network configuration ---------------- */ // MAC Address (if not hardware defined) { 0, 0, 0, 0, 0, 0 }, // IP Address { 0, 0, 0, 0 }, // Subnet mask { 255, 255, 255, 0 }, // Gateway address { 0, 0, 0, 0 }, /* ------------- Wireless network specific settings -------------- */ // Auto scan channel (0=Auto) 0, // Transmit rate (0=Auto) 0, // Transmit power (usually UEZ_NETWORK_TRANSMITTER_POWER_HIGH) UEZ_NETWORK_TRANSMITTER_POWER_HIGH, // DHCP Enabled? EFalse, // Security mode UEZ_NETWORK_SECURITY_MODE_OPEN, // SSID (if ad-hoc) 0, // DHCP Server is disabled EFalse, /** ------------- Network Type: IBSS (Peer to peer) ----------------*/ // IBSS Channel 0, /** If network type is UEZ_NETWORK_TYPE_IBSS (Peer to Peer), * declare if this network is creating or joining. */ UEZ_NETWORK_IBSS_ROLE_NONE, }; #if 0 // Use settings from 0:CONFIG.INI file T_uezINISession ini; UEZINIOpen("0:CONFIG.INI", &ini); UEZINIGotoSection(ini, "Network"); UEZINIGetString(ini, "ip", "192.168.10.20", buffer, sizeof(buffer) - 1); UEZNetworkIPV4StringToAddr(buffer, &settings.iIPAddress); UEZINIGetString(ini, "netmask", "255.255.255.0", buffer, sizeof(buffer) - 1); UEZNetworkIPV4StringToAddr(buffer, &settings.iSubnetMask); UEZINIGetString(ini, "gateway", "192.168.10.1", buffer, sizeof(buffer) - 1); UEZNetworkIPV4StringToAddr(buffer, &settings.iGatewayAddress); UEZINIClose(ini); #elif 0 UEZNetworkIPV4StringToAddr("192.168.10.2", &network_settings.iIPAddress); UEZNetworkIPV4StringToAddr("255.255.255.0", &network_settings.iSubnetMask); UEZNetworkIPV4StringToAddr("192.168.10.0", &network_settings.iGatewayAddress); #else // Use non-volatile settings // Wired network uses the settings in NVSettings memcpy(&network_settings.iMACAddress, G_nonvolatileSettings.iMACAddr, 6); memcpy(&network_settings.iIPAddress.v4, G_nonvolatileSettings.iIPAddr, 4); memcpy(&network_settings.iGatewayAddress.v4, G_nonvolatileSettings.iIPGateway, 4); memcpy(&network_settings.iSubnetMask.v4, G_nonvolatileSettings.iIPMask, 4); #endif printf("IP Address: %d.%d.%d.%d\n", G_nonvolatileSettings.iIPAddr[0], G_nonvolatileSettings.iIPAddr[1], G_nonvolatileSettings.iIPAddr[2], G_nonvolatileSettings.iIPAddr[3]); UEZNetworkInfrastructureConfigure(network, &network_settings); }
void INetworkConfigureWirelessAccessPoint(T_uezDevice network) { T_uezNetworkSettings network_settings = { // Network type UEZ_NETWORK_TYPE_LIMITED_AP, /* -------------- General Network configuration ---------------- */ // MAC Address (if not hardware defined) { 0, 0, 0, 0, 0, 0 }, // IP Address { 0, 0, 0, 0 }, // Subnet mask { 255, 255, 255, 0 }, // Gateway address { 0, 0, 0, 0 }, /* ------------- Wireless network specific settings -------------- */ // Auto scan channel (0=Auto) 0, // Transmit rate (0=Auto) 0, // Transmit power (usually UEZ_NETWORK_TRANSMITTER_POWER_HIGH) UEZ_NETWORK_TRANSMITTER_POWER_HIGH, // DHCP Enabled? EFalse, // Security mode UEZ_NETWORK_SECURITY_MODE_WPA2, // UEZ_NETWORK_SECURITY_MODE_WPA, // SSID (for WAP) "uEZGUI", // DHCPServer Enable ETrue, /** ------------- Network Type: IBSS (Peer to peer) ----------------*/ // IBSS Channel 0, /** If network type is UEZ_NETWORK_TYPE_IBSS (Peer to Peer), * declare if this network is creating or joining. */ UEZ_NETWORK_IBSS_ROLE_CREATE, }; #if 0 // Use settings from 0:CONFIG.INI file T_uezINISession ini; UEZINIOpen("0:CONFIG.INI", &ini); UEZINIGotoSection(ini, "WAP"); UEZINIGetString(ini, "ip", "192.168.1.1", buffer, sizeof(buffer) - 1); UEZNetworkIPV4StringToAddr(buffer, &settings.iIPAddress); UEZINIGetString(ini, "netmask", "255.255.255.0", buffer, sizeof(buffer) - 1); UEZNetworkIPV4StringToAddr(buffer, &settings.iSubnetMask); UEZINIGetString(ini, "gateway", "192.168.1.0", buffer, sizeof(buffer) - 1); UEZNetworkIPV4StringToAddr(buffer, &settings.iGatewayAddress); UEZINIClose(ini); #elif 1 // Use hard coded settings UEZNetworkIPV4StringToAddr("192.168.1.1", &network_settings.iIPAddress); UEZNetworkIPV4StringToAddr("255.255.255.0", &network_settings.iSubnetMask); UEZNetworkIPV4StringToAddr("192.168.1.0", &network_settings.iGatewayAddress); #elif 0 // Use non-volatile settings memcpy(&network_settings.iMACAddress, G_nonvolatileSettings.iMACAddr, 6); memcpy(&network_settings.iIPAddress.v4, G_nonvolatileSettings.iIPAddr, 4); memcpy(&network_settings.iGatewayAddress.v4, G_nonvolatileSettings.iIPGateway, 4); memcpy(&network_settings.iSubnetMask.v4, G_nonvolatileSettings.iIPMask, 4); #endif UEZNetworkInfrastructureConfigure(network, &network_settings); }
T_uezError AudioPlayerSelectionLoad(TUInt32 aDrive) { T_uezINISession ini; char key[10]; char section[64]; char filename[40]; char type[20]; TUInt8 i=0; T_uezError error = UEZ_ERROR_NONE; G_topFileIndex = 0; G_ws->iNumVideos = 0; sprintf(filename, "%d:/VIDEOS.INI" , aDrive); if(UEZINIOpen(filename, &ini) == UEZ_ERROR_NONE){ for(i=0; i<MAX_VIDEOS; i++) { error = UEZINIGotoSection(ini, "Videos"); if(!error) { sprintf(key, "video%d", i+1); if(UEZINIGetString(ini, key, "", section, 63) != UEZ_ERROR_NONE) break; // Reached the end of the video list } if(!error) error = UEZINIGotoSection(ini, section); if(!error) error = UEZINIGetString(ini, "title", "", G_ws->iVideos[i].iTitle, 63); if(!error) { error = UEZINIGetString(ini, "type", "", type, 19); if(strcmp("BIN",type) == 0) { G_ws->iVideos[i].iType = VIDEO_TYPE_BIN; } else { G_ws->iVideos[i].iType = VIDEO_TYPE_FRAMES; } } if(!error) { if(UEZ_LCD_DEFAULT_COLOR_DEPTH == UEZLCD_COLOR_DEPTH_I15_BIT) error = UEZINIGetString(ini, "video555", "", G_ws->iVideos[i].iVideoPath, 127); else error = UEZINIGetString(ini, "video565", "", G_ws->iVideos[i].iVideoPath, 127); } if(!error) error = UEZINIGetString(ini, "audio", "", G_ws->iVideos[i].iAudioPath, 127); if(!error) error = UEZINIGetInteger32(ini, "fps", 10, (TInt32*)&G_ws->iVideos[i].iFPS); if(!error) error = UEZINIGetInteger32(ini, "height", 10, (TInt32*)&G_ws->iVideos[i].iVideoHeight); if(!error) error = UEZINIGetInteger32(ini, "width", 10, (TInt32*)&G_ws->iVideos[i].iVideoWidth); // Check for text lines. Ignore error. UEZINIGetString(ini, "TextLine1", "", G_ws->iVideos[i].iTextLine1, 127); UEZINIGetString(ini, "TextLine2", "", G_ws->iVideos[i].iTextLine2, 127); if(error != UEZ_ERROR_NONE) break; G_ws->iNumVideos++; } UEZINIClose(ini); } return error; }