Αρχείο ΚΚΕ 70 χρόνια ΔΣΕ

Wednesday, January 23, 2013

Remote playing iPhone from Pc and vice versa

Control PC from iPhone (WiFi)

I have managed controling my keyboard and mouse from my iPhone 3G (ios 4.2.1) with Logitech app Touch Mouse (Διαβάστε εδώ πως ).
You have to run a Logitech server installed on the PC. BOTH are free.
This is working through WiFi from the iPhone (client side) as long the PC (server) is on the same "network" s OR even in different network if you kow the exact ip and there are no firewalls block the ports used in between.

i.e both iPhone and PC are connected in the same 192.168.1.1//24:
PC
IP Address: 192.168.1.8
Subnet mask: 255.255.255.0Default Gateway: 192.168.1.1
iPhone
IP Address: 192.168.1.3
Subnet mask: 255.255.255.0
Router: 192.168.1.1
An easy way to do it is setup an Ad-hoc network between the iPhone and PC not for sharing Internet but just to connect each other..
Very convinient ,indeed! when watching movies...

That last leads us to the reverse route of controling iPhone from PC.

Control iPhone from PC

Wireless - WiFi

First i had to cope to set an Ad-hoc network between my iPhone and PC. I  setup following this instruction 

Right-click your wireless network connection, and then click Properties.
In the Wireless Network Connection Properties dialog box, click the Wireless Networks tab.
Make sure the "Use Windows to configure my wireless network settings" is ticked
On the Wireless Networks tab, under Preferred networks, click Add
In the Wireless network properties dialog box, on the Association tab, type the name of your ad hoc wireless network in Network name (SSID) box (shown in step 10). For example, you could name your wireless network iPhoneNetwork.
9.Clear the The key is provided for me automatically check box and select the This is a computer-to-computer (ad hoc) network check box.
10.Create a 13-digit password and type it in both the Network key and Confirm network key boxes. Then click OK.
Click OK again to save your changes.
Wireless Networks tab in Wireless Network Connection Properties dialog box
You are now able to "connect" to the iPhoneNetwork from "View available wireless netwroks"

After a little (re)searching i was able to get it stable with the following configuration still only and only when i had a iFile webserver running to prevent my iPhone from Auto-Locking and at the same time keeping the connection alive

PC
IP Address: 192.168.0.1
Subnet mask: 255.255.255.0
Default Gateway: 192.168.1.1
DNS: 192.168.1.1 
iPhone
IP Address: 192.168.0.2
Subnet mask: 255.255.255.0
Router: 192.168.0.1
Default Gateway: 192.168.1.1
I can know use my favorite PuTTY!!!!!!!hehe....

I connect with Putty to 192.168.0.2 Port: 22 (as you can see i have saved this session as "iPhoneXP")
in green is what i typed in.
in red is what i typed in PC's command prompt
login as: rootroot@192.168.0.2's password: alpineiPhone:~ root#
I get a list of the files (i.e. all mp3's by Arkana!) i want from my PC

%HOMEDRIVE%%HOMEPATH%>cd Documents\Music..\Documents\Music>dir /s/b *Arkana*.mp3 >list

then i upload (with running mongoose in Music folder) my list to iPhone and convert it to ios format

~ # curl -C - -O http://192.168.0.2:8080/list
~ # sed -i "s/$(printf '\r')\$//" list

i create a folder named music and i download/upload there from my PC all the mp3's i want!!

~ # mkdir Music
~ # mv list Music/
~/Music/ # cd Music
~/Music/ # for i in $(
~/Music/ # rm list
 After that i have my files where i want them...
...and now the Magic begins!
Let's listen to some music!
~/Music/ # for i in $(ls *.mp3);do play ${i}; done &
[1] 1181
~/Music/ #
the number in brackets is the specifc number for this "job"(jobspec) in our case playing mp3's
the next number is the number of the process(PID) doing the "job"
Ready to get back to work listenning your music..
***WARNING*** don't close the window of PuTTY session because your music will die with it :(
oops..something you forgot. you have to go to kitchen and grab a snack! no problem!
Pause the music!!!!!!
here is how.. ON the SAME window of PuTTY session you send a SIGnal to stop the program playing
~/Music/ # jobs -l
[1]+  1181 Running              for i in $(ls *.mp3)
do
      play ${i};
done
~/Music/ # kill -l
HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM URG STOP TSTP CONT CHLD TTIN TTOU IO XCPU XFSZ VTALRM PROF WINCH INFO USR1 USR2 
~/Music/ # kill -STOP 1181 
OR
 ~/Music/ # kill -n 17 1181
The STOP is the 17th signal to  the process number 1181 which is our music playing
You have your snack, now you can continue listenning to music...
Resume the music!!!!
~/Music/ # jobs -l
[1]   1181 Stopped              for i in $(ls *.mp3)
do
      play ${i};
done
~/Music/ # kill -l
HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM URG STOP TSTP CONT CHLD TTIN TTOU IO XCPU XFSZ VTALRM PROF WINCH 
~/Music/ # kill -CONT 1181 
OR
 ~/Music/ # kill -n 19 1181
The continue (CONT) is the 19th signal to  the process number 1181 which is our music playing

Bluetooth

Of course you can use the more user-friendly UI of Remote controling your music through Bluetooth, the protocol AVRCP is implemented in iPhone 3G.

I managed to get remote contoller and stereo sound(A2DP) working together under Windows XP after installing Atheros Bluetooth Suite.

There is not much to explain. First you have to pair the iPhone with the PC.

It will ask you for passcode, just give an easy 0000
Then just start your ipod App or audio player on the iPhone  and go to Bluetooth Suite

select your iPhone and then select Stereo Audio Gateway and you are listenning your iPhone music from your PC speakers and you have !

For the separete option you will use AirPlay button on iPhone player 

Just press the Airplay button and select iPhone and your iPhone speakers or headphones will work again.


No comments: