GET method control HTTP VLC
zaharov
Posts: 8
I want to share an example with VLC via HTTP
I propose here to share management capabilities VLC.
Here is an example of the GET method with VLC.
VLC player, perform management through the management interface to the HTTP server example
Host server: 10.0.7.18 port 8081
I propose here to share management capabilities VLC.
Here is an example of the GET method with VLC.
VLC player, perform management through the management interface to the HTTP server example
Host server: 10.0.7.18 port 8081
PROGRAM_NAME='Main Program' (***********************************************************) (***********************************************************) (* FILE_LAST_MODIFIED_ON: 04/05/2006 AT: 09:00:25 *) (***********************************************************) (* System Type : NetLinx *) (***********************************************************) (* REV HISTORY: *) (***********************************************************) (* $History: $ *) (***********************************************************) (* DEVICE NUMBER DEFINITIONS GO BELOW *) (***********************************************************) DEFINE_DEVICE dvIPDeviceVLC = 0:5:0 dvTP = 32000:1:0 (***********************************************************) (* CONSTANT DEFINITIONS GO BELOW *) (***********************************************************) DEFINE_CONSTANT CHAR cDevTelnetVLC[15] = '10.0.7.18' //IP Address VLC server INTEGER nIPPORT = 8081 /// IP PORT VLC server INTEGER nProtocol = 1 LONG tlOnline = 1 (***********************************************************) (* DATA TYPE DEFINITIONS GO BELOW *) (***********************************************************) DEFINE_TYPE (***********************************************************) (* VARIABLE DEFINITIONS GO BELOW *) (***********************************************************) DEFINE_VARIABLE integer nOnline integer nOffline integer nError integer nData integer btnCtr[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9 } DEFINE_FUNCTION CHAR[100] SMTPGetIpError (LONG nNUM) { SWITCH (nNUM) { //// ERROR REPORTING CASE 2: RETURN "'IP ERROR (',ITOA(nNUM),'): General Failure (IP_CLIENT_OPEN/IP_SERVER_OPEN)'" CASE 4: RETURN "'IP ERROR (',ITOA(nNUM),'): Unknown host (IP_CLIENT_OPEN)'" CASE 6: RETURN "'IP ERROR (',ITOA(nNUM),'): Connection refused (IP_CLIENT_OPEN)'" CASE 7: RETURN "'IP ERROR (',ITOA(nNUM),'): Connection timed out (IP_CLIENT_OPEN)'" CASE 8: RETURN "'IP ERROR (',ITOA(nNUM),'): Unknown connection error (IP_CLIENT_OPEN)'" CASE 9: RETURN "'IP ERROR (',ITOA(nNUM),'): Already closed (IP_CLIENT_CLOSE/IP_SERVER_CLOSE)'" CASE 14: RETURN "'IP ERROR (',ITOA(nNUM),'): Local port already used (IP_CLIENT_OPEN/IP_SERVER_OPEN)'" CASE 16: RETURN "'IP ERROR (',ITOA(nNUM),'): Too many open sockets (IP_CLIENT_OPEN/IP_SERVER_OPEN)'" CASE 17: RETURN "'IP ERROR (',ITOA(nNUM),'): Local Port Not Open (IP_SERVER_OPEN)'" DEFAULT: RETURN "'IP ERROR (',ITOA(nNUM),'): Unknown'" } } (***********************************************************) (* LATCHING DEFINITIONS GO BELOW *) (***********************************************************) DEFINE_LATCHING (***********************************************************) (* MUTUALLY EXCLUSIVE DEFINITIONS GO BELOW *) (***********************************************************) DEFINE_MUTUALLY_EXCLUSIVE (***********************************************************) (* SUBROUTINE/FUNCTION DEFINITIONS GO BELOW *) (***********************************************************) (* EXAMPLE: DEFINE_FUNCTION <RETURN_TYPE> <NAME> (<PARAMETERS>) *) (* EXAMPLE: DEFINE_CALL '<NAME>' (<PARAMETERS>) *) (***********************************************************) (* STARTUP CODE GOES BELOW *) (***********************************************************) DEFINE_START IP_CLIENT_OPEN(dvIPDeviceVLC.PORT,cDevTelnetVLC,nIPPort,IP_TCP) /// OPEN IP CONNECTION (***********************************************************) (* THE EVENTS GO BELOW *) (***********************************************************) DEFINE_EVENT DATA_EVENT[dvIPDeviceVLC] { ONLINE: { nOnline = 100 SEND_STRING 5001:0:0,"'dv1-DEVICE ONLINE- PORT ',ITOA(data.device.port)"/// TELL ME ABOUT IT } OFFLINE: { nOffline = 100 IP_CLIENT_OPEN(dvIPDeviceVLC.PORT,cDevTelnetVLC,nIPPort,IP_TCP) /// OPEN IP CONNECTION SEND_STRING 5001:0:0,"'dv1-DEVICE OFFLINE- PORT ',ITOA(data.device.port)" /// TELL ME ABOUT IT } ONERROR: { nError = 100 // Print error SEND_STRING 5001:0:0,"'dv1-REPORT- PORT ',ITOA(data.device.port),'-',SMTPGetIpError(Data.Number)" /// TELL ME ABOUT THE ERROR /// Act Accordingly SWITCH(data.number) { CASE 14: CASE 17: IP_CLIENT_OPEN(dvIPDeviceVLC.PORT,cDevTelnetVLC,nIPPort,IP_TCP) /// OPEN IP CONNECTION } } STRING: { nData = 100 SEND_STRING 5001:0:0, data.text } } BUTTON_EVENT [dvTP, btnCtr] { PUSH: { SWITCH (button.input.channel) { case 1: //pause { send_string dvIPDeviceVLC, "'GET /requests/status.xml?command=pl_pause HTTP/1.0',$0D,$0A,$0D,$0A" } case 2: //play { send_string dvIPDeviceVLC, "'GET /requests/status.xml?command=pl_play HTTP/1.0',$0D,$0A,$0D,$0A" } case 3: //stop { send_string dvIPDeviceVLC, "'GET /requests/status.xml?command=pl_stop HTTP/1.0',$0D,$0A,$0D,$0A" } case 4: //next { send_string dvIPDeviceVLC, "'GET /requests/status.xml?command=pl_next HTTP/1.0',$0D,$0A,$0D,$0A" } case 5: //previous { send_string dvIPDeviceVLC, "'GET /requests/status.xml?command=pl_previous HTTP/1.0',$0D,$0A,$0D,$0A" } case 6: //pl_delete { send_string dvIPDeviceVLC, "'GET /requests/status.xml?command=pl_delete HTTP/1.0',$0D,$0A,$0D,$0A" } case 7: //pl_loop { send_string dvIPDeviceVLC, "'GET /requests/status.xml?command=pl_loop HTTP/1.0',$0D,$0A,$0D,$0A" } case 8: //pl_repeat { send_string dvIPDeviceVLC, "'GET /requests/status.xml?command=pl_repeat HTTP/1.0',$0D,$0A,$0D,$0A" } case 9: //fullscreen { send_string dvIPDeviceVLC, "'GET /requests/status.xml?command=fullscreen HTTP/1.0',$0D,$0A,$0D,$0A" } } } } (***********************************************************) (* THE ACTUAL PROGRAM GOES BELOW *) (***********************************************************) DEFINE_PROGRAM (***********************************************************) (* END OF PROGRAM *) (* DO NOT PUT ANY CODE BELOW THIS COMMENT *) (***********************************************************)
0
Comments
I would appreciate if anyone share the parser (feedback) to process the HTML code.
feedback example:
but I would assume it would be 0:0:0 not 5001:0:0
While what you say is true it hits wide of my question. I'm not the best communicator. The thrust of my question was to ask for what reason he was sending notifications to the NI device and not the master. My guess is that he was assuming he WAS sending notifications to the master and not the device portion of the box.
I've seen a lot of programmers not quite get the concept of the integrated master. It's seems that some people have a hard time getting their head around the idea that the box actually contains several little boxes (conceptually) integrated on the same PC board.
Also, I was curious if there was some new exciting thing I didn't know about that sending to port zero on the NI device facilitated or something.
e
I have been an example to work with VLC player.
Send to a device 5001:0:0, I was comfortable watching message in the notification window. You can also look in the Diagnostic window, sending send_string 0, "'xxx'", including Diagnostics -> Enabe Netlinx Internal Diagnostics Messages
How to send a message Invite device - 0:5:0 (local port) through the window "Control a Device .."
I try to send a Control a Device .. (Device - 0, Port - 5, System - an, Message (s) to Send check String Expressions - "'GET / requests / status.xml? Command = pl_pause HTTP/1.0', $ 0D, $ 0A, $ 0D, $ 0A "), but the VLC server does not understand this command.
, Although a one button command "'GET / requests / status.xml? Command = pl_pause HTTP/1.0', $ 0D, $ 0A, $ 0D, $ 0A") perfectly understood
Control device doesn't work with IP devices.
Сan somebody share his ideas to work with VLC?
I want to write a complete unit of work with this player. I want to implement a control with the touch panel to control not less than the HTML page.
I guess that's my point. But never mind. If you getting the results you need then who am I to argue?
You can kinda accomplish sending something to an IP port by routing it through a virtual device temporarily.
Sonething like
Then send stuff to the virtual dev in control device.
I'll try,
Answer, and how to connect virtual device (vdv_testing) with a local port (dv_IP_port)
There is no need to connect the two devices. (Combine..) By sending a command to the testing device the code will send it on to the port for you. You still have to open the IP port, connect it to something out there and so forth. It's just a work-around for being able to send strings to an IP port.