コード例 #1
0
void palm_installer_base::get_user_name_array( wxArrayString& user_name_array)
{    
    if ( get_number_of_users() != 0 )
    {
        for ( int count = 0; count < get_number_of_users(); count++ ) 
        {
            user_name_array.Add( get_user_name( count ) );           
        }
    }
}
コード例 #2
0
ファイル: sysinfo_screen.c プロジェクト: boerge42/rpi_gui
// ********************************************
void systeminfo_output(void)
{
	int y = 30;
	int dy = 20;
	struct sysinfo si;
	char  s[40] = "";

	sysinfo(&si);
	// Uptime
	sprintf (s, "system uptime  : %ld days, %ld:%02ld:%02ld", 
			 si.uptime / SEC_DAY, 
			(si.uptime % SEC_DAY) / SEC_HOUR, 
			(si.uptime % SEC_HOUR) / SEC_MINUTE, 
		 	 si.uptime % SEC_MINUTE);
	
	put_string(10, y, s, LIGHT_GREY, FONT_8X16);
	y+=dy;
	// Loads
	sprintf (s, "load avg.      : %4.2f %4.2f %4.2f", 
			si.loads[0] / LINUX_SYSINFO_LOADS_SCALE, 
			si.loads[1] / LINUX_SYSINFO_LOADS_SCALE, 
			si.loads[2] / LINUX_SYSINFO_LOADS_SCALE);
	put_string(10, y, s, LIGHT_GREY, FONT_8X16);
	y+=dy;
	// RAM
	sprintf (s, "ram [MByte]    : %5.1f/%5.1f", 
			(si.totalram - si.freeram) / ONE_MBYTE,
			si.totalram / ONE_MBYTE);	
	put_string(10, y, s, LIGHT_GREY, FONT_8X16);
	y+=dy;
	// SWAP
	sprintf (s, "swap [MByte]   : %5.1f/%5.1f", 
			(si.totalswap - si.freeswap) / ONE_MBYTE,
			si.totalswap / ONE_MBYTE);
	put_string(10, y, s, LIGHT_GREY, FONT_8X16);
	y+=dy;
	// Processes/User
	sprintf (s, "proc./user     : %5i/%i",
			si.procs,
			get_number_of_users());
	put_string(10, y, s, LIGHT_GREY, FONT_8X16);
	y+=dy;
	// Netzwerk Rx/Tx-Statistik
	sprintf (s, "rx/tx [kByte/s]: %5.1f/%5.1f", rx_kbs, tx_kbs);
	put_string(10, y, s, LIGHT_GREY, FONT_8X16);
}
コード例 #3
0
int palm_installer_base::get_user_index_from_user_name( const wxString& user_name )
{
    int array_index = 0;
    
    wxLogDebug( wxT( "Looking up user_index for user_name=" ) + user_name );
    
    for ( int i=0; i < get_number_of_users(); i++ )
    {
        if ( user_name == m_users_array[ i ]->name ) 
        {
            wxLogDebug( wxT( "user_name=%s found at user_index=%d" ), 
                        m_users_array[ i ]->name.c_str(), i );
            array_index = i;
            break;
        }
    } 
    
    return array_index;
}
コード例 #4
0
void SMsgUsrPushedUserList::pack_multiple_message_specific_data()
	{
	// Sanity check that the output user array has been set to a non-null value

	if (m_p_output_userarray_for_unpacking)
		{
		// Append the data source id

		AppendLong(m_i_data_source_id);

		// Append the data source specific status information

		AppendShort(static_cast<short>(m_data_source_specific_status));

		// Append the issue number

		AppendLong(m_i_issue_number);

		// Append the number of users found

		AppendLong(get_number_of_users());

		// Cycle through the vector of users, and append each user

		for (unsigned long counter = m_user_objects_begin;
		     counter < m_user_objects_end;
			 counter++)
			{
			// Pack the user data

			((*m_p_output_userarray_for_unpacking)[counter]).m_user.pack_data(*this);

			// Pack the purpose

			AppendLong(((*m_p_output_userarray_for_unpacking)[counter]).m_update_purpose);
			}
		}
	}
コード例 #5
0
void SMsgUsrGetPolledUserListReplyEx::pack_multiple_message_specific_data()
	{
	// Append the data source id

	AppendLong(m_i_data_source_id);

	// Append the data source specific status information

	AppendShort(static_cast<short>(m_data_source_specific_status));

	// Append the number of users found

	AppendLong(get_number_of_users());

	// Cycle through the vector of users, and append each user

	for (UserArray::const_iterator user_iterator = m_a_users.begin();
		 user_iterator != m_a_users.end();
		 user_iterator++)
		{
		user_iterator->pack_data(*this);
		}
	}
コード例 #6
0
bool palm_installer::install_files_by_handheld_dest( handheld_dest_type& handheld_dest,
        wxArrayString& install_fullnames )
{
    wxString    destination_fullname;
    wxString    destination_path;
    wxString    destination_rootpath;
    wxString    destination_basename;
    wxString    destination_extension;
    int         user_index;
    wxString    install_fullname;
    bool        install_fullname_exists = false;
    bool        successful              = false;

    // This is a dummy to induce a translatable string, when we want the original to stay as untranslated.
    wxString 	dummy1 = _( "SecureDigital (SD) Card" );

    wxLogDebug( wxT( "Entering palm_installer::install_files_by_handheld_dest function" ) );

    // If wxArrayString is empty, then abort
    if ( install_fullnames.IsEmpty() )
    {
        wxLogDebug( "Error: no filenames sent to install_files_by_handheld_dest. Aborting..." );
        return false;
    }

    // Look up the user_index of this user_name
    user_index = get_user_index_from_user_name( handheld_dest.user_name );

    if ( get_number_of_users() > 0 )
    {
        destination_rootpath = get_palm_desktop_path() + "/"
                               + get_user_subdirectory( user_index );

        // If installing to card, use that path...
        switch (  handheld_dest.handheld_target_storage_mode )
        {
        case plkrHANDHELD_TARGET_STORAGE_MODE_SD_CARD:
            destination_path = get_translated_handheld_destination_path( destination_rootpath,
                               "SecureDigital (SD) Card",
                               "SecureDigital"
                                                                       );
            break;
        case plkrHANDHELD_TARGET_STORAGE_MODE_MEMORY_STICK:
            destination_path = destination_rootpath + "/Files to Install/Memory Stick";
            break;
        case plkrHANDHELD_TARGET_STORAGE_MODE_COMPACT_FLASH:
            destination_path = destination_rootpath + "/Files to Install/Compact Flash Card";
            break;
        // default is the normal RAM one.
        default:
            destination_path = destination_rootpath + "/Files to Install";
            break;
        }

        // Check the destination rootpath exists. It may not, if it was a newly created
        // user, it may not have its directory yet
        wxLogDebug( "destination_rootpath=" + destination_rootpath );

        // If this is a brand new user, won't have an "Install" subdirectory
        // in his/her directory yet, so create it, if not there yet.
        if ( ! wxDirExists( destination_path ) )
        {
            wxLogDebug( "destination_path not exist, so making..." );

            // If the "Files to Install" doesn't exist, then need to make that, before can
            // make a dir such as "Memory Stick" inside of that.
            if ( ! wxDirExists ( destination_rootpath + "/Files to Install" ) )
            {
                wxMkdir( destination_rootpath + "/Files to Install", 0777 );
            }

            // OK: can now make the SecureDigital (SD) Card or Memory Stick dir
            // if destination is a card (or the "Files to Install" dir if not card).
            wxMkdir( destination_path, 0777 );
        }

        for ( size_t n = 0; n < install_fullnames.GetCount(); n++ )
        {
            wxLogDebug( "Starting loop to install" );
            install_fullname = install_fullnames.Item( n );
            wxLogDebug( "install_fullname=" + install_fullname );
            install_fullname_exists = wxFileExists( install_fullname );

            if ( install_fullname_exists )
            {
                // Get the basename and extension, so it can have the same basename + extension
                // in the install directory.
                wxSplitPath( install_fullname.c_str(), NULL, &destination_basename,
                             &destination_extension );

                destination_fullname = destination_path + "/" + destination_basename
                                       + '.' + destination_extension;

                // Copy the file over.
                if ( wxCopyFile( install_fullname, destination_fullname, TRUE ) )
                {
                    successful = TRUE;
                }
                else
                {
                    wxLogError( "Error: couldn't copy " + install_fullname + " to " + destination_fullname );
                }

            }
            else
            {
                wxLogDebug( "Error: install_fullname " + install_fullname + " doesn't exist" );
            }
        }
    }

    return successful;
}