Jump to content

cr-ispinternet

Members
  • Posts

    61
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

cr-ispinternet's Achievements

Member

Member (2/5)

0

Reputation

  1. Physco, your suggestion of the following worked a treat preg_match("#$GPRMC.*#", $input, $match); $GPRMC_line = $match[0]; gave me an ouput of the following... root@voyage:/usr/utils/sattrack# ./check_gps.php GPRMC,001025.000,V,5310.5798,N,00226.2040,W,0.0,0.0,170312,,,N*60 root@voyage:/usr/utils/sattrack# great thing now is there are a dozen other string i can latch onto using the same regex but to answer your questions the $ at the start of GPRMC string does infact mean nothing and the data returned from $read is part of the serial command issued to get the data in the first place all i need to do now is strip that result now into an array using the , as a delimiter for sectioning thanks guys )))
  2. Hi Guys, Think this a simple one but been stuck for a few hours and tearing my hair out... ive got a serial command querying a GPS dongle which returns an output once queried $read = $serial->readPort(); Once the query has been returned it give me and output like the following $GPRMC,120329.000,A,5310.5615,N,00226.2420,W,0.0,10.0,160312,,,A*43 $GPGGA,120329.000,5310.5615,N,00226.2420,W,1,04,25.5,-0.3,M,59.1,M,,0000*52 $GPVTG,10.0,T,,M,0.0,N,0.0,K,A*3C $PMST200,00,204*1E $PMST200,00,204*1E $PMST200,00,204*1E $PMST200,??,204*1E $PMST200,??,204*1E $PMST200,??,204*1E $PMST200,??,204*1E $PMST200,??,204*1E $PMST200,??,204*1E $GPGLL,5310.5615,N,00226.2420,W,120329.00,A,A*72 $GPGSA,A,3,04,07,10,13,,,,,,,,,36.1,25.5,25.5*06 $PMST200,??,204*1E $PMST200,??,204*1E $PMST200,??,204*1E $PMST200,00,204*1E $PMST200,00,204*1E $PMST200,??,204*1E $PMST200,??,204*1E $PMST200,??,204*1E $GPRMC,120330.000,A,5310.5615,N,00226.2420,W,0.0,10.0,160312,,,A*4B $GPGGA,120330.000,5310.5615,N,00226.2420,W,1,04,25.5,-0.3,M,59.1,M,,0000*5A $GPVTG,10.0,T,,M,0.0,N,0.0,K,A*3C $PMST200,??,204*1E $PMST200,??,204*1E $PMST200,??,204*1E $PMST200,??,204*1E $PMST200,??,204*1E Im basically trying to preg_match the GPRMC line but recover the full line, i will then explode it later and break it down by the commas i the string... $GPRMC,120329.000,A,5310.5615,N,00226.2420,W,0.0,10.0,160312,,,A*43 i need the above line each time i query the dongle rather than all the other stuff it generates any one got a clean way of doing it? ive tried this but all it give me is the following.. if (preg_match("/GPMRC/", $read, $result)) { print "$result[0]"; } which give mes this only root@voyage:/usr/utils/sattrack# ./check_gps.php GPRMC root@voyage:/usr/utils/sattrack#
  3. Sal... You the man my friend, im not that great with regular expressions but i knew thats what i need to do to get my output. Many thanks for taking a look at that for me i knew some one on here would be able to help me... thanks so much Alan
  4. Hi There, Im a little bi lost and not sure where to start with this one, ive got a small gps receiver which im polling over a serial connection, each time i poll the device i get a load of rubbish back like this... $GPRMC,223450.000,A,5310.5785,N,00226.2042,W,0.0,25.8,291109,,,A*49 $GPGGA,223450.000,5310.5785,N,00226.2042,W,1,06,2.1,22.3,M,59.1,M,,0000*7D $GPVTG,25.8,T,,M,0.0,N,0.0,K,A*32 $PMST200,00,204*1E $PMST200,00,204*1E $PMST200,00,204*1E $PMST200,??,204*1E $PMST200,??,204*1E $PMST200,??,204*1E $PMST200,??,204*1E $PMST200,??,204*1E $PMST200,??,204*1E $GPGLL,5310.5785,N,00226.2042,W,223450.00,A,A*73 $GPGSA,A,3,02,04,05,07,08,10,,,,,,,4.5,2.1,4.0*39 $PMST200,??,204*1E $PMST200,??,204*1E $PMST200,??,204*1E As they are never ever in the same order i cant really use reg_exp to get what i want, basically im trying to capture the following and then use split to break them down further and insert into a DB $GPRMC,223450.000,A,5310.5785,N,00226.2042,W,0.0,25.8,291109,,,A*49 how can i just get it to extract that line and nothing else unless i ask it to???? the output from the serial devic come is extract using this $read = $serial->readPort(); than i just echo read etc etc and get my text which is further up, any ones help or suggestions would be brill... thanks in advance Alan
  5. Hi All, Ive got a small piece of java script code which basically gives me a status when the image is checked and another status when the image is un checked. I need 8 images in total with 8 different status, ive got the code working ok but something i cant do as im not that offay with javascript is make sure that if one image is selected, when another image is selected the origianl image which was selected is returned to its previosu state.. <script type="text/javascript"> function toggleButtonV1() { var value = document.getElementById('Viewing1').value; if(value == 'on') { document.getElementById('Viewing1').value = 'off'; document.getElementById('toggleButtonImgV1').src = 'archive/images/pressed/viewing/pressed-1.jpg'; document.getElementById('buttonValueViewing').innerHTML = '1'; } else { document.getElementById('Viewing1').value = 'on'; document.getElementById('toggleButtonImgV1').src = 'archive/images/viewing/index_09.png'; document.getElementById('buttonValueViewing').innerHTML = '0'; } } function toggleButtonV2() { var value = document.getElementById('Viewing2').value; if(value == 'on') { document.getElementById('Viewing2').value = 'off'; document.getElementById('toggleButtonImgV2').src = 'archive/images/pressed/viewing/pressed-1.jpg'; document.getElementById('buttonValueViewing').innerHTML = '2'; } else { document.getElementById('Viewing2').value = 'on'; document.getElementById('toggleButtonImgV2').src = 'archive/images/viewing/index_11.png'; document.getElementById('buttonValueViewing').innerHTML = '0'; } } </script> <!-- Debug Start --> <font face="Tahoma" style="font-size: 8pt">Value: </font> <span id="buttonValueViewing"> </span> <!-- Debug Finish --> <!-- Mysql Query Start --> if($row->status == "invisible" ) { echo <<<END END; }else if ($row->status == "active" ) { echo <<<END <img src="$row->image_location" onclick="toggleButtonV2();" id="toggleButtonImgV2"> <input type="hidden" name="Viewing2" id="Viewing2" value="on"> END; }else{ echo <<<END <img src='$row->image_disabled'> END; } } <!-- Mysql Query Finish --> thats the bsisc code ( no hero on that side but it works to a degree, im hoping once ive figured it all out i can tidy it all up. Does any one know how i can make sure that only one image at a time selected as i cant and dont need multiple images selected at any one time. any help would be appreciated Kind Regards Alan
  6. Hi All, Just a quick one not really sure where to start with it... Im trying to create a matrix screen which will be used to switch audio and video outputs on a matrix switcher. its using rs232 commands which i already have working... what id like to be able to do is create a screen layout which has 8 audio inputs, 8 video inputs and 8 screen outputs but i need the image of the zone to do the following... i need to string together code on the fly when the image button is pressed so if some one presses images 1 ( screen output 1 ) and then selects audio input 1 and video input 1 i then get an end result of a string which can then be presented to the rs232 interface which will then change the status. once i can get the string formulas sorted i can then add them to a database each time its called so atleast if you exit the matrix screen it will have the last outputs and inputs as select images. i know this may sound really complicated but im hoping some one can help in some way in a nutn shell i need to be able to use images to build a string then input it to a script all on the same page. Also as a last thing the script needs to know that on the last input it then needs to trigger the process, basically output 1, video input 1, audio input 1 ( trigger ) im hoping some one can help and get me started Alan
  7. Barand, anything you can see in the code which is making the lines like 5 times aslong when seperating the inputs... Alan
  8. Hey Barand, Wored out that on the table version the function exec was not at the bottom of the example added and it works find, but sae problem as in the distance between the first input and the second input... http://www.cr-isp.com/vlcremote/show.php?com=show&playlist=piggy Alan
  9. Barand, The first option works but with an unexpected distance between the 2 tracks etc and the tabled version didnt work for me, but going to try it again and see if i can get it working i didnt check the errors so willtry that now heres the output from the first version http://www.cr-isp.com/vlcremote/show.php?com=show&playlist=piggy Alan again thanks fro yor help, im definately getting there Alan
  10. Barand, you really know your php bud :-) works so well, i do have one more question though :-) again its just tarting up the output i have the following now for inputs, its more than one track loop : yes inputs : /root/MediaPlayer/Audio/FCNK.mp3 /root/MediaPlayer/Audio/cryforyou.mp3 output : how can i get the current function that you have written to do the followign for me im sorry to ask so many question im just a little limited in functions and arrays :-( learnign though... loop : yes inputs : /root/MediaPlayer/Audio/FCNK.mp3 /root/MediaPlayer/Audio/cryforyou.mp3 output : basically for every new track its a new line or maybe like this.... loop : yes inputs : /root/MediaPlayer/Audio/FCNK.mp3 /root/MediaPlayer/Audio/cryforyou.mp3 output : so its kind of tabbed out etc, any further help is very much appreciated Alan
  11. hi there barand, looks like ive solved that one, the array didnt match exactly what the output was returning... it should of looked liek this the array.. $tmp = array ( 'broadcast', 'loop', 'inputs', 'output', 'options', 'instances', 'instance', 'name', 'state', 'position', 'time', 'length' , 'rate', 'title', 'chapter', 'seekable', 'playlistindex' ); whihc is great i have my nice little list now just some further enhancements for it... current output looks like this... broadcast enabled : yes loop : yes inputs /root/MediaPlayer/Audio/FCNK.mp3 output : options instances instance name : default state : playing position : 0.488269 time : 2277381225 length : 4653852562 rate : 1000 title : 0 chapter : 0 seekable : 1 playlistindex : 1 > as you can see not all fields in that array have : after them is there an easy to add them to the ones which dont have them also the > at the end aswell i need to get rid of that as thats part fo the telnet command for connecting etc and running the command using fsockopen your helps been brillirant :-) Alan
  12. Barand, ok im getting there that works great im trying so hard to understand how you have written your code for me do have a further question about the parsing of that output... basically currently, anything which doesnt have an output value to output it basically sticks them all on one line.... loop : no inputs /root/MediaPlayer/Audio/FCNK.mp3 output : options instances instance name : default state : playing position : 0.294213 time : 1372186123 length : 4653852562 rate : 1000 title : 0 chapter : 0 seekable : 1 playlistindex : 1 > is there any way to not show the oens which dont return a value??? so for instance these dont have values... output : options instances instance name : default state : Many thakns for replying Alan
  13. Barand, Impecable answer bud, worked a charm, but there is a slight problem, the long line from the output is for ever changing, the track lines, time left, time remaining etc... Is there an easy way to match like you have done already, basically at the bottom of the function i have a line which is return $output; ive transfered that to a global to be made available outside the function but just tried something like this and it didnt work.. $str = '$output'; the out should pretty much match the array as there all the outputs available but the inputs part will be longer depending on the amount of tracks in the playlist.... any ideas to make that $str able to accept an ever changing data array from the return function $output Many thanks for your reply Alan
  14. Hi All, Im using telnet in conjunction with mysql and php to run a media server im working on... Theres an output i would like ti parse if possible, but have not got a clue whre to start heres the output Password: ÿûÿü Welcome, Master > show piggy type : broadcast enabled : yes loop : no inputs /root/MediaPlayer/Audio/cryforyou.mp3 /root/MediaPlayer/Audio/FCMK.mp3 output : options instances instance name : default state : playing position : 0.351690 time : 84897960 length : 235052421 rate : 1000 title : 0 chapter : 0 seekable : 1 playlistindex : 1 > in essence id like to be able to parse it in the following way ignore all this ( Password: ÿûÿü Welcome, Master > show piggy type : ) thn show line by line the follwing broadcast enabled : yes loop : no inputs /root/MediaPlayer/Audio/cryforyou.mp3 /root/MediaPlayer/Audio/FCMK.mp3 output : options instances instance name : default state : playing position : 0.351690 time : 84897960 length : 235052421 rate : 1000 title : 0 chapter : 0 seekable : 1 playlistindex : 1 Is there an easy way to parse this file using php Alan
  15. Hi All, After a few hours of looking and learning, and im posting the answer for this as i hate it when you find a thread which matches your problem... They then say yeah ive fixed it and never post the solution so basically posting varibles into a function is impossible unless you define them as a global... so what i did was the following, just after your function starts you put the following global vars, and can you put all your other mysql and POST vars outside the function.... thanks to any one who replied, im glad no one gave me the answer ive l;earnt so much in the last hour :-) function telnet_commands($ip, $port, $udelay = 500000) { global $ip; global $port; global $admin_pass; global $command;
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.