Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 10 of 10
  1. #1
    Join Date
    Jan 2008
    Posts
    52

    detect if phone is plugged in.

    is there anyway to kno if a phone or device is plugged in , any dlls or plugins ??

    thanks.

  2. #2
    Join Date
    Apr 2006
    Posts
    127
    Depends what it is plugged into. If it is a USB device, then Windows should see it as a drive. If so, you can simply search a reasonable range of drive letters for a known filename. For example

    bFileExists = File.DoesExist("G:\\MyFile.txt");

    if (bFileExists == true) -- the device is there

  3. #3
    Join Date
    Jul 2009
    Posts
    122
    If your mobile generates a SerialPort, you can use serial port action plugin to detects it, also if this is connected by usb you can get all devices in a list with vid&pid with dll, this unique numbers of usb descriptors can help you

  4. #4
    Join Date
    Jan 2008
    Posts
    52
    Well, what if say i didnt know the same of the phone as it could have been renamed, may i say find the phone modela and if its connect or not using these?

    thanks for your reply

  5. #5
    Join Date
    Apr 2006
    Posts
    127
    That's where it becomes tricky - if the phone device itself "knows" it's name, you will need to know how to collect that info. Windows can display the name of the device (which it sees as a drive) if the manufacturer has indeed named it. Remember, a phone is not specifically a computer device, it therefore does not need to comply with computer device conventions. Different manufacturers may have different ways of storing such info, and it is not necessarily stored in the memory that the computer automatically sees via USB, since that is reserved for the User's stuff. To cut a long story short, you will need to find out more from the phone manufacturers - most of whom will offer info on their websites, look for a mention of API or SDK.

    Create an AMS project with a Paragraph Object and experiment with these functions:

    sAllInfo = "";
    tDrives = {};

    tDrives = Drive.Enumerate();

    for i,k in tDrives do

    iDriveType = Drive.GetType(k);

    if (iDriveType == 0) then sDriveType = " Drive Type: Unknown\r\n"; end
    if (iDriveType == 1) then sDriveType = " Drive Type: Invalid\r\n"; end
    if (iDriveType == 2) then sDriveType = " Drive Type: Removable\r\n"; end
    if (iDriveType == 3) then sDriveType = " Drive Type: Fixed\r\n"; end
    if (iDriveType == 4) then sDriveType = " Drive Type: Remote\r\n"; end
    if (iDriveType == 5) then sDriveType = " Drive Type: CD ROM\r\n"; end
    if (iDriveType == 6) then sDriveType = " Drive Type: RAM Disk\r\n"; end

    sDrive = "Drive: " .. k .. sDriveType;
    sAllInfo = sAllInfo .. sDrive;

    tDriveInfo = {};
    tDriveInfo = Drive.GetInformation(k);

    if (tDriveInfo) then

    sDriveLabel = "Drive Label: " .. tDriveInfo.Label .. "\r\n";
    sDriveFileSys = "Drive Format: " .. tDriveInfo.FileSystem .. "\r\n";
    sDriveSerialNum = "Drive Serial Number: " .. tDriveInfo.SerialNumber .. "\r\n";
    sDriveDisplay = "Drive Display: " .. tDriveInfo.DisplayName .. "\r\n";

    sAllInfo = sAllInfo .. sDriveLabel .. sDriveFileSys .. sDriveSerialNum .. sDriveDisplay;

    end

    sAllInfo = sAllInfo .. "----------------------------------------------------\r\n";

    end

    Paragraph.SetText("Paragraph1", sAllInfo);

  6. #6
    Join Date
    Jan 2008
    Posts
    52
    mm thanks vaccum using ur code i was able to retrieve all the drives except the phone

    alright wat if say i kno the manfacture , in this case lets keep it as the popular iphone windows detects its model name as Apple iphone

  7. #7
    Join Date
    Jan 2008
    Posts
    52
    could we some how weave that in there?
    also the manfacture is given as Apple Inc
    could that help?

  8. #8
    Join Date
    Apr 2006
    Posts
    127
    Sounds like Windows does detect the phone, but the question is, does Windows detect it as a drive? Sounds as though the answer is no and thus comms may be dependent on manufacturer-supplied software. Have you tried File.DoesExist to see if you can at least read-write? What do the Apple people say?

  9. #9
    Join Date
    Jan 2008
    Posts
    52
    Quote Originally Posted by IdeasVacuum View Post
    Sounds like Windows does detect the phone, but the question is, does Windows detect it as a drive? Sounds as though the answer is no and thus comms may be dependent on manufacturer-supplied software. Have you tried File.DoesExist to see if you can at least read-write? What do the Apple people say?
    windows detects it as a portable device so no i dont think its detected as a drive, and then again i cant use file.DoesExist because if they have renamed thier phone that means the location path will change, Apple uses itunes to reconginze if the phone is plugged in,

    So i dont think Autoplay can find if there is a detected phone plugged in without the name???
    thank you for your help anyway

  10. #10
    Join Date
    Jul 2007
    Posts
    1,512
    Quote Originally Posted by nad46 View Post
    windows detects it as a portable device so no i dont think its detected as a drive, and then again i cant use file.DoesExist because if they have renamed thier phone that means the location path will change, Apple uses itunes to reconginze if the phone is plugged in,

    So i dont think Autoplay can find if there is a detected phone plugged in without the name???
    thank you for your help anyway
    i think iturn will a miniter the com ports knowing the ID tag for a ipod or then a ipod/iphone is pluged in they are in strage mode just not seeable to windows
    there are many programs out there.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts