Announcement

Collapse
No announcement yet.

How to connect my computer to my cell phone?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to connect my computer to my cell phone?

    I want to transfer files to a folder in my cell phone via a PB application.
    I can see the cell phone in MS-Explorer and it have an ip-address 192.168.1.67.
    Anyone who can give me tips on how to do?

    Click image for larger version

Name:	Exp.png
Views:	1
Size:	14.5 KB
ID:	773390
    Attached Files
    Fim Wästberg

  • #2
    If it shows in MS Exporer (Windows Explorer/File Explorer) then it has a drive letter.

    SHELL and MS COPY command.

    Or -

    GET to a string, then OPEN on phone and PUT with ABS option.

    To use the phone's IP and TCP, you'd also have to know which protocol the phone supports.

    Cheers,
    Dale

    Comment


    • #3
      Dale,
      "If it shows in MS Exporer (Windows Explorer/File Explorer) then it has a drive letter."
      No, it has no drive letter as you see at the red arrow.
      Fim Wästberg

      Comment


      • #4
        Look under "Computer". The "C:" drive should show as well as DVD/CD (if you have), thumb drives (if plugged in), and the phone (when connected).

        You may need to look around to find the drive letter shown, but if the directories on the phone are shown on the PC, then there is a drive letter assigned. Please point your big red arrow elsewhere.
        Dale

        Comment


        • #5
          Originally posted by Dale Yarker View Post

          You may need to look around to find the drive letter shown, but if the directories on the phone are shown on the PC, then there is a drive letter assigned. Please point your big red arrow elsewhere.
          Sorry, but that's not true.

          A "Windows Portable Device" aka WPD doesn't get a drive letter,
          https://docs.microsoft.com/en-us/win...rtable-devices



          --
          [URL="http://www.camcopng.com"]CAMCo - Applications Development & ICT Consultancy[/URL][URL="http://www.hostingpng.com"]
          PNG Domain Hosting[/URL]

          Comment


          • #6
            https://en.wikipedia.org/wiki/Media_Transfer_Protocol

            "Most MTP-compatible devices are not assigned drive letters; instead, they appear as "devices" in applications such as Windows Explorer. Compared to devices that implement USB mass storage, such devices cannot be accessed programmatically by scripts or normal Windows programs that depend on drive letters. Instead, files must be manipulated using Windows Explorer or applications with specially written MTP support. Another disadvantage of MTP devices on Windows is that file timestamps are not shown in Windows Explorer, although they can be retrieved by opening the file Properties popup."
            ...

            --
            [URL="http://www.camcopng.com"]CAMCo - Applications Development & ICT Consultancy[/URL][URL="http://www.hostingpng.com"]
            PNG Domain Hosting[/URL]

            Comment


            • #7
              Yeap. Sorry Fim. Seems not so well thought out (by MS) to me.
              Dale

              Comment


              • #8
                I am working on a solution based on TCP / IP.
                There is good support for that in PB.
                And on the cell phone there is support for TCP / IP with Rfo-Basic.
                Returns when I have reached the target.
                /Fim W.
                Fim Wästberg

                Comment


                • #9
                  Originally posted by Fim Wästberg View Post
                  I am working on a solution based on TCP / IP.
                  There is good support for that in PB.
                  And on the cell phone there is support for TCP / IP with Rfo-Basic.
                  Returns when I have reached the target.
                  /Fim W.
                  José Roca's Includes contains portabledeviceconnectapi.inc portabledeviceapi.inc etc which let you use the WMP API. That may be a lot easier to use than rolling your lower level solution and avoids the need for an application on the cell phone..

                  https://docs.microsoft.com/en-us/win...p/api/_wpdsdk/

                  --
                  [URL="http://www.camcopng.com"]CAMCo - Applications Development & ICT Consultancy[/URL][URL="http://www.hostingpng.com"]
                  PNG Domain Hosting[/URL]

                  Comment


                  • #10
                    Fim,

                    With a lot of work, one may get the result you want.
                    For the fun of it, here is some COM code that enumerate portable devices.
                    There is a lot more to it, of course, yours to discover if you feel like it.

                    Windows Portable Devices
                    Media Transfer Protocol
                    Enumerating Devices
                    IPortableDeviceManager interface
                    Samples
                    WpdServicesApiSample Application

                    Click image for larger version  Name:	PortableDevices.png Views:	1 Size:	29.9 KB ID:	773439

                    Code:
                    #COMPILE EXE '#CC 5.07 (D:\Basic\Bas\Jose Roca\Forum\Jose\Windows API Headers\1.19 (PB9.x)\uz)#
                    #DIM ALL
                    #INCLUDE "Win32Api.inc"
                    #INCLUDE "PortableDeviceApi.inc" 'Use José Roca APIs definition
                    
                    %USB_STRING_MAXLEN = 256
                    '______________________________________________________________________________
                    
                    FUNCTION pUnicodeToAnsi(BYVAL pUnicode AS DWORD)AS STRING
                     LOCAL CharCount AS DWORD
                     LOCAL sAnsi     AS STRING
                    
                     IF pUnicode THEN 'To avoid gpf
                       CharCount = LStrlenW(BYVAL pUnicode) 'Get dual bytes character count
                       sAnsi     = NUL$(CharCount) 'Initialize string
                       WideCharToMultiByte(%CP_ACP, %NULL, BYVAL pUnicode, CharCount, _
                                           BYVAL STRPTR(sAnsi), CharCount, BYVAL %NULL, BYVAL %NULL)
                       #IF %DEF(%PB_CC32) 'If application is a console
                       CharToOem(BYVAL STRPTR(sAnsi), BYVAL STRPTR(sAnsi)) 'Convert to console characters
                       #ENDIF
                       FUNCTION = sAnsi
                     END IF
                    
                    END FUNCTION
                    '_____________________________________________________________________________
                    
                    FUNCTION PBMAIN() AS LONG
                     LOCAL Coordn AS COORD : Coordn.x = 200 : Coordn.y = 50
                     SetConsoleScreenBufferSize(GETSTDOUT,  Coordn)
                     SetWindowPos(CONSHNDL, %NULL, 1, 1, 1450, 500, %SWP_NOZORDER)
                    
                     LOCAL pIPortableDeviceManager       AS IPortableDeviceManager
                     LOCAL zwsPortableDeviceFriendlyName AS STRING
                     LOCAL zwsDeviceManufacturer         AS STRING
                     LOCAL zwsDeviceDisplayDescription   AS STRING
                     LOCAL Index                         AS DWORD
                     LOCAL PortableDeviceCount           AS DWORD
                     LOCAL zwsBufferSize                 AS DWORD
                     LOCAL hr                            AS LONG
                    
                     pIPortableDeviceManager = NEWCOM CLSID $CLSID_PortableDeviceManager
                     IF ISOBJECT(pIPortableDeviceManager) THEN
                       hr = pIPortableDeviceManager.GetDevices(BYVAL %NULL, PortableDeviceCount) 'Get portable devices count
                       IF SUCCEEDED(hr) THEN
                         PRINT "Windows Portable Devices found: " & FORMAT$(PortableDeviceCount)
                         IF PortableDeviceCount THEN
                           DIM pzwsDeviceId(0 TO PortableDeviceCount - 1) AS STRING POINTER 'Null pointer array to receive valid address from .GetDevices
                           hr = pIPortableDeviceManager.GetDevices(pzwsDeviceId(0), PortableDeviceCount) 'Get all zero terminated wide string pointers to device id
                           IF SUCCEEDED(hr) THEN
                             'Get FriendlyName, Manufacturer, and Description...
                             FOR Index = 0 TO PortableDeviceCount - 1
                               zwsPortableDeviceFriendlyName = NUL$(%USB_STRING_MAXLEN)
                               zwsDeviceManufacturer         = zwsPortableDeviceFriendlyName
                               zwsDeviceDisplayDescription   = zwsPortableDeviceFriendlyName
                    
                               'Tell the method available buffer size, it will be updated with returned string lenght
                    
                               zwsBufferSize = %USB_STRING_MAXLEN
                               hr = pIPortableDeviceManager.GetDeviceFriendlyName(pzwsDeviceId(Index), _ 'Get FriendlyName
                                                                                  BYVAL STRPTR(zwsPortableDeviceFriendlyName), zwsBufferSize)
                               zwsBufferSize = %USB_STRING_MAXLEN
                               hr = pIPortableDeviceManager.GetDeviceManufacturer(pzwsDeviceId(Index), _ 'Get Manufacturer
                                                                                 BYVAL STRPTR(zwsDeviceManufacturer), zwsBufferSize)
                               zwsBufferSize = %USB_STRING_MAXLEN
                               hr = pIPortableDeviceManager.GetDeviceDescription(pzwsDeviceId(Index), _ 'Get Description
                                                                                 BYVAL STRPTR(zwsDeviceDisplayDescription), zwsBufferSize)
                               PRINT
                               PRINT "Device index:   " & FORMAT$(Index)
                               PRINT " DeviceId:      " & pUnicodeToAnsi(pzwsDeviceId(Index))
                               PRINT " Friendly name: " & pUnicodeToAnsi(STRPTR(zwsPortableDeviceFriendlyName))
                               PRINT " Manufacturer:  " & pUnicodeToAnsi(STRPTR(zwsDeviceManufacturer))
                               PRINT " Description:   " & pUnicodeToAnsi(STRPTR(zwsDeviceDisplayDescription))
                             NEXT
                             PRINT
                           END IF
                         END IF
                       END IF
                     END IF
                     PRINT : PRINT "Type or click..." : MOUSE ON : MOUSE 3, UP : WAITKEY$
                    
                    END FUNCTION
                    '_____________________________________________________________________________
                    '
                    Last edited by Pierre Bellisle; 4 Jul 2018, 10:39 AM.

                    Comment


                    • #11
                      https://www.windowscentral.com/best-...-windows-10-pc

                      Does Windows 10 support sending text through an attached android device?
                      Anyone used Cortana or any app to send sents to an attached device?

                      Fim,
                      If this is taking away from your thread please say so I will start another thread.
                      Windows and android both support SQLite and I thought I might send texts through sharing a file.
                      Instead of learning Android programming (which is on my list) I wouldn't mind using something already done.




                      https://www.tesla.com/roadster

                      Comment


                      • #12
                        Here's my solution to the problem
                        The Client:
                        Code:
                        ' PROGRAM-NAMN    TCPCLIENT-TEST
                        ' FÖRFATTARE      FIMATOR FIM WÄSTBERG.
                        ' DATUM           2018-07-08 10:07:28 I YSTAD.
                        
                        ' Utprovning av TCP-client
                        '
                        '
                        ' ÄNDRINGS- OCH RÄTTNINGS-JOURNAL
                        ' Vers  Tidpunkt            Ändringsbeskrivning
                        ' ----- ------------------- ----------------------------------------
                        '       2018-07-08 10:07:28 Nytt program.
                        
                        #COMPILER PBCC
                        #COMPILE EXE "C:\ORDKORS\ORDKORS\TCPCLIENT-TEST"
                        #DIM ALL
                        #BREAK ON
                        #DEBUG DISPLAY on
                        #DEBUG ERROR ON
                        
                        FUNCTION PBMAIN () AS LONG
                        
                            DIM TEXT_TO_SEND                    AS STRING
                            DIM TEXT_RECEIVED                   AS STRING
                        
                        
                        
                        STARTSEKVENS:
                        '============
                        '
                        BILDSTART:
                            COLOR 15,1
                            CLS
                        
                        SET_UP:
                            TCPCLIENT("IPADDRESS", "192.168.1.77", 0)
                            TCPCLIENT("PORT NUMBER", "1080", 0)
                        
                        ASK_AND_SEND:
                            LINE INPUT "Text to send:", TEXT_TO_SEND
                            IF LEN(TEXT_TO_SEND) = 0 THEN EXIT FUNCTION
                            TCPCLIENT("SEND", TEXT_TO_SEND, 10)
                            IF TRIM$(TEXT_TO_SEND) = "." THEN EXIT FUNCTION
                        
                        WAIT_FOR_ANSWER:
                            TCPCLIENT("RECEIVE", TEXT_RECEIVED, 20)
                            PRINT "Answer=";TEXT_RECEIVED
                            PRINT " "
                            GOTO ASK_AND_SEND
                        
                        END FUNCTION
                        
                        
                        
                        FUNCTION TCPCLIENT(ACTION AS STRING, TEXT AS STRING, WAIT_TIME AS LONG) AS LONG
                        '==============================================================================
                        '
                            DIM TCP_FILE_NO                     AS STATIC LONG
                            DIM PORT_NUMBER                     AS STATIC LONG
                            DIM IP_ADDRESS                      AS STATIC STRING
                            DIM CONT                            AS STATIC LONG
                            DIM REC_START                       AS STATIC SINGLE
                        
                        STARTING:
                            IF CONT > 0 THEN GOTO STARTING_EXIT
                            TCP_FILE_NO = FREEFILE
                            CONT = 1
                        STARTING_EXIT:
                        
                        CHECK_ACTION:
                            IF UCASE$(MID$(ACTION, 1, 3)) = "IPA" THEN GOTO SET_IP_ADDRESS
                            IF UCASE$(MID$(ACTION, 1, 3)) = "POR" THEN GOTO SET_PORT_NUMBER
                            IF UCASE$(MID$(ACTION, 1, 3)) = "SEN" THEN GOTO SENDING
                            IF UCASE$(MID$(ACTION, 1, 3)) = "REC" THEN GOTO RECEIVING
                            TCPCLIENT = 1
                            TEXT = "Unknown action"
                            EXIT FUNCTION
                        
                        SET_IP_ADDRESS:
                            IP_ADDRESS = TRIM$(TEXT)
                            IF TALLY(TEXT, ".") <> 4 THEN
                                TEXT = "Invalid IP address"
                                TCPCLIENT = 4
                                EXIT FUNCTION
                            END IF
                            TCPCLIENT = 0
                            EXIT FUNCTION
                        
                        SET_PORT_NUMBER:
                            PORT_NUMBER = VAL(TEXT)
                            TCPCLIENT = 0
                            EXIT FUNCTION
                        
                        SENDING:
                            REPLACE ANY "åäöÅÄÖ" WITH "{|}[\]" IN TEXT
                            TCP OPEN PORT PORT_NUMBER AT IP_ADDRESS AS TCP_FILE_NO TIMEOUT WAIT_TIME * 1000
                            IF ERR THEN
                                TEXT = "TCP OPEN error:" + STR$(ERR)
                                TCPCLIENT = 2
                                EXIT FUNCTION
                            END IF
                            TCP PRINT TCP_FILE_NO, TEXT
                            TCP CLOSE TCP_FILE_NO
                            TCPCLIENT = 0
                            EXIT FUNCTION
                        
                        RECEIVING:
                            TCP OPEN PORT PORT_NUMBER AT IP_ADDRESS AS TCP_FILE_NO TIMEOUT WAIT_TIME * 1000
                            IF ERR THEN
                                TEXT = "TCP OPEN error:" + STR$(ERR)
                                TCPCLIENT = 3
                                EXIT FUNCTION
                            END IF
                            REC_START = TIMER
                            TEXT = ""
                        
                        RECEIVING_FETCH:
                            IF TIMER - REC_START > WAIT_TIME THEN
                                TEXT = "Time out"
                                TCPCLIENT = 4
                                EXIT FUNCTION
                            END IF
                            TCP RECV TCP_FILE_NO, 1024, TEXT
                            IF LEN(TEXT) = 0 THEN
                                SLEEP 10
                                GOTO RECEIVING_FETCH
                            END IF
                            TCP CLOSE TCP_FILE_NO
                        '    REPLACE ANY "{|}[\]" WITH "åäöÅÄÖ" IN TEXT
                            TCPCLIENT = 0
                            EXIT FUNCTION
                        
                        END FUNCTION
                        And here the server, written i RFO-Basic
                        Code:
                        ! PROGRAM-NAMN    TCPSERVER-TEST
                        ! FÖRFATTARE      FIMATOR FIM WÄSTBERG.
                        ! DATUM           2018-07-08 16:48:57 I YSTAD.
                        !
                        ! Utprovning av TCPSERVER
                        !
                        !
                        ! ÄNDRINGS- OCH RÄTTNINGS-JOURNAL
                        ! Vers  Tidpunkt            Ändringsbeskrivning
                        ! ----- ------------------- ----------------------------------------
                        !       2018-07-08 16:49:05 Nytt program.
                        
                        STARTING:
                        !========
                        !
                        SETTINGS:
                            PORT = 1080
                        
                        WHO_AM_I:
                            SOCKET.MYIP MY_IP$
                            PRINT "My Ip is: " + MY_IP$
                        
                        CREATE_SERVER:
                            SOCKET.SERVER.CREATE PORT
                        
                        
                        
                        TCP_RECEIVING:
                        !=============
                        !
                            PRINT "Waiting for client connect for receive"
                            SOCKET.SERVER.CONNECT 0
                            DO
                                SOCKET.SERVER.STATUS st
                            UNTIL st = 3
                            SOCKET.SERVER.CLIENT.IP ip$
                            PRINT "Connected to ";ip$
                            DO
                                SOCKET.SERVER.READ.READY flag
                            UNTIL flag
                            SOCKET.SERVER.READ.LINE TEXT$
                            TEXT$ = REPLACE$(TEXT$, "{", CHR$(229))
                            TEXT$ = REPLACE$(TEXT$, "|", CHR$(228))
                            TEXT$ = REPLACE$(TEXT$, "}", CHR$(246))
                            TEXT$ = REPLACE$(TEXT$, "[", CHR$(197))
                            TEXT$ = REPLACE$(TEXT$, CHR$(92), CHR$(196))
                            TEXT$ = REPLACE$(TEXT$, "]", CHR$(214))
                            PRINT TEXT$
                            SOCKET.SERVER.DISCONNECT
                            IF TRIM$(TEXT$) = "." THEN GOTO STOP_IT
                        
                        
                        
                        ACTION_WITH_DATA:
                        !================
                        !
                        STOP_TEST:
                            IF TRIM$(TEXT$) = "." THEN GOTO STOP_IT
                            TEXT$  = "Sent=" + TEXT$
                        
                        
                        
                        TCP_SENDING:
                        !===========
                        !
                        !PRINT "Waiting for client connect for send"
                            SOCKET.SERVER.CONNECT 0
                            DO
                                SOCKET.SERVER.STATUS st
                            UNTIL st = 3
                            SOCKET.SERVER.CLIENT.IP ip$
                            PRINT "Send Connected to ";ip$
                            SOCKET.SERVER.WRITE.LINE TEXT$
                            SOCKET.SERVER.DISCONNECT
                            PRINT "Send Disconnected from client"
                        
                            GOTO TCP_RECEIVING
                        
                        STOP_IT:
                            END
                        /Fim W.
                        Fim Wästberg

                        Comment


                        • #13
                          Thanks, Fim!
                          I'll be checking it out. Spent the last hour getting Cortana to work, but not adequate for sending to anyone not on its list.
                          https://www.tesla.com/roadster

                          Comment

                          Working...
                          X