A Flash Developer Resource Site

Page 4 of 5 FirstFirst 12345 LastLast
Results 61 to 80 of 82

Thread: (AS2) Flash to read\listen to serial port?

  1. #61
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    sent your esp13 out to shipping today

  2. #62
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    ahh.. cool!

    I have a current approach I am trying to do... (if it fails.. I might resort to your ESP solution to serve up the policy file)


    I'm reading up on how to configure a new website in LAMP/Apache hosted on port 843.. so that I can request it locally and have it respond with 'whatever' (not that far yet)

  3. #63
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    I deleted some private messages.. not sure why it saying my inbox is full still??

    you can email me.. [username]@ hotmail [dot] com

  4. #64

  5. #65
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    Hey Alloy Bacon -

    Just wanted to follow up with this thread a bit..

    So I (believe) I finally got all the server policy stuff set-up correctly..

    Meaning

    * SSL, with self signed certificate (still says invalid with red text with line through the HTTPS part in the URL, but after accepting the cert exception it loads fine)

    I also found this link, where someone created & provides an Apache mod for just this thing (Adobe Security Policy server)
    http://www.beamartyr.net/articles/ad...ileserver.html

    At this point.. I feel like everything is on track for the most part..

    Sending this to my RPi via terminal:

    Code:
    $ perl -e 'printf "<policy-file-request/>%c",0' | nc 127.0.0.1 843
    returns the expected security policy..

    I have even added a line to point to my own custom crossdomainpolicy.xml file that also displays..


    However.. I can still CAN NOT get Flash to connect to that SOCAT instance??

    Not even sure where to go from here now.. (still researching I guess)

    maybe you have some ideas? (I know you support the external hardware approach, but I wanted to explore using the already available Apache web server to act as the policy server before attempting to go that route)

    I dont know much about SOCAT (in fact you turned me on to it).. Im wondering if there is any configuration/updates that may need to be made to it?



    At this point... my questions are:

    * How can I check that the Flash app is indeed making this request?
    * How can I check that this security policy is indeed being sent back to the flash request? (using the pearl line is a manual check, but how to check if Flash app is also requesting?)

    If the above is in fact working.... then everything is fine on the RPi side of things.. and this is an error on the FLASH side of things?

    I do NOT know any AS3...

    do you have an EXAMPLE AS3 .swf that just listens to 127.0.0.1:7777 (the socat feed)... that I can possibly throw up on my RPi to test with? (to see if its my .swf or not?)

    I am doing this all on AS2... so I'll take a known working AS2 example.. or AS3

    I dont even know how to add all the camera object stuff to an AS3 .fla... so it can just have 2 text fields

    1.) shows the status of the XMLSocket connection
    2.) another that shows the incoming serial data fed by SOCAT? (which is nothing more than data, data, data....etc..etc over and over for now)


    If that works.. I will take the time to figure out how to get an working AS3 version going... (never really got into making everything a class style of approach for AS3 stuff unfortunately)

    Thanks
    -whispers

  6. #66
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    hi, have you connected the rpi to the esp13 I sent you yet? put the esp13 ontop of the arduino uno and on the rpi wifi menu find the esp13 name and connect, should of had no password when I sent it.

    on the swf make the socket connect to 192.168.1.1 port 9000 and you should be connected now.

    PHP Code:
    var server = new XMLSocket();
    server.connect("192.168.1.1"9000);

    server.onConnect = function(result){
        if(
    result){
            
    //connected
            
    state_txt.text "connected";
        }else{
            
    //not connected
            
    state_txt.text "not connected";
        }

    }

    server.onClose = function(){
        
    //disconnected
        
    state_txt.text "connection closed";
    }

    server.onXML = function(data){
        
    //do whatever    
        
    incomingData_txt.text += data;
        
        
    //close
        //server.close();

    when you finish the setup and everything is good, I will show you wiring of esp13 to the new arduino you were going to get.
    Last edited by AS3.0; 03-04-2019 at 11:33 PM.

  7. #67
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hhi,

    One might not be using 192.168.1.1

    so open cmd prompt and "type ipconfig /all" no quotes must have space.

    look for default gateway - this is your connection

    thats my 2 bits..

    good to see you using the server connect code all over the place Alloy

  8. #68
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    "type ipconfig /all"..................this isnt windows. Where are you suggesting I run this line then?

    Also.. (maybe I'm not being clear enough)...

    I DO NOT want to try this approach yet. (ie: using the ESP-13/more hardware approach)..

    I would still like to try and figure out what is going on with the Apache mod/approach I installed on the RPi..

    I appreciate the ESP-13 approach .. just works.

    its more hardware than I have space for.

    I will not be using an UNO in the end (but a pro-mini)...etc..etc..etc.


    I never got code liek this:


    Code:
    var server = new XMLSocket();
    server.connect("127.0.0.1", 7777);
    
    server.onConnect = function(result){
        if(result){
            //connected
            state_txt.text = "connected";
        }else{
            //not connected
            state_txt.text = "not connected";
        }
    
    }
    
    server.onClose = function(){
        //disconnected
        state_txt.text = "connection closed";
    }
    
    server.onXML = function(data){
        //do whatever    
        incomingData_txt.text += data;
        
        //close
        //server.close();
    }
    I never made the jump to AS3.. hence the request for a known working .fla/.swf (that JUST displays connected or not connected on the screen).. trying to determine if there is a difference between AS2 working and AS3 file working..

    My current understanding is that my policy server is working as expected?

    At least when I run:

    Code:
    perl -e 'printf "<policy-file-request/>%c",0' | nc 127.0.0.1 843
    manually from terminal prompt..

    I get the crossdomain.xml policy displayed..

    what I cant figured out yet.. is:

    1.) Is flash making that request? (how do I check?)
    2.) Why will it NOT connect to the SOCAT instance? that is making the incoming data available? Is it an issue with how SOCAT was initiated? (different params maybe to allow a connection? Just reaching at this point?)

  9. #69
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    Sorry, got the wrong end of the stick,

    maybe this pearl script may help you

    http://www.lightsphere.com/dev/artic...et_policy.html

  10. #70
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    (such a PITA you can not edit your previous posts).. grrr..

    Anyways..

    on my way to work.. I started to think about the ESP-13 approach..

    Let explore that a bit.. I want to make sure:

    1.) I understand it
    2.) It even applies to my project


    Questions:

    1.) How will the Flash app (housed and served up on the RPI via LAMP install) know how & where to get to 192.168.1.1:9000 ???

    This ESP-13 is connected to the Arduino (via shield).. and the Arduino is connected via USB (ie: ttyUSB0)

    Are you saying that the RPi, needs to wirelessly connect to the ESP-13 to whatever SSID it is broadcasting?.. and then at that point.. the Flash will have this local IP accessible to it?

    I'm not quite following how that aspect plays out?

    Remember (again).. in the end.. this project is a standalone/off-line PROJECT.. while I do have access to internet during development, it will not be the case in the final project.

    So unless (because you never said).. the RPi doesnt connect to the ESP-13 locally through its own custom broadcast SSID... I'm not clear how this all works?

    TO BE CLEAR THOUGH...

    my first choice is to work though/debug this Apache module approach.

    I just cant wrap my head around why to use another (hardware) web server... when we have one already (Apache) on the RPi itself running?

    And if my policy server IS configured correctly (which I have only checked by running that pearl line above.. not sure how else I can check in with the Flash app or some log of some kind?).. then what is keeping the Flash app from making a connection?

    SOCAT configuration?

    * PUTTY seems to connect to it just fine, and shows the data on the serial line? (ttyUSB0)


    If anyone has some ideas on testing the Apache approach, PLEASE provide a suggestion/make a comment.

  11. #71
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    look at the prevous post, you will need to have pearl set up with your lamp/wamp

    as for the other hardware stuff, that is beyond me as I don't travel that road

  12. #72
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    Hi fruitbeard-


    sorry I didnt even see your previous post (must have been typing my post up at the same time?)

    but I do have pearl set up. As mentioned, when I run this line:

    Code:
    perl -e 'printf "<policy-file-request/>%c",0' | nc 127.0.0.1 843
    I get the policy response... as expected.


    Thats sorta my point..

    I believe I already DO have a policy server set up...


    following the steps here:
    http://www.beamartyr.net/articles/ad...ileserver.html


    actually that same link is provided at the bottom of the lightsphere link as well.

    So I decided to try the Apache module approach instead with a virtual host on port 843..

    I just cant be 100% sure that the flash app is actually making this request??

    If I manually check the request, it responds correctly. (it will even provide my custom policy file if I put in a path line after the Adobe line like so

    AdobePolicyFileServerEnabled On
    AdobePolicyFile /path/too/crossdomain.xml

    but how can I check that the FLASH app is actually:

    1.) making the request?
    2.) Is getting the response?

    At this point.. because I cant check/verify that the Flash app is making/getting the response... and my manual check works, I can only assume that Flash can not connect to the SOCAT instance.. (for whatever reason)

    * either cant/not seeing the policy server on port 843
    * or cant connect to SOCAT

  13. #73
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    Are you saying that the RPi, needs to wirelessly connect to the ESP-13 to whatever SSID it is broadcasting?.. and then at that point.. the Flash will have this local IP accessible to it?

    Yes the rpi needs to wirelessly connect to the esp13, once you do that, your swf in the browser can communicate with the esp13 at 192.168.1.1 port 9000, so now on your uno use the uno scripts from this thread to make it print lines and you will see the lines in flash, and you can socket send from flash to read it back on the uno as well, you wont need socat, netcat or perl for this anymore.
    Last edited by AS3.0; 03-05-2019 at 05:16 PM.

  14. #74

  15. #75
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    I sent it with no password, you'll see the ssid broadcasting, I wouldn't change the ssid name because it takes forever to take effect and to reset the whole thing if you forget the password you set you have to hold down its buttons for like 20 seconds and it might not even reset after acouple of tries, takes too long if you want to reset from being locked out really, I wouldn't change much from its webpage ui.
    Last edited by AS3.0; 03-05-2019 at 11:11 PM.

  16. #76
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    ok..

    Last night I turned on verbose logging for the apache module..

    and it looks liek things are being server up correctly..

    request
    23 bytes given...etc

    connection made..

    so I'm starting to think this is a Flash things/issue now?

    If I cant get this Apache approach to work.. I want to try the pearl server approach.. if that fails.. I'll result to the hardware server.. (ESP-13)

    Still cant figure out WHY this isnt working though?

    I feel like it some simple flash publish setting.. (maybe need to be FP 9 or 10?).. or perhaps the local file access only vs network access only publish setting?

    or maybe even a param in the index file?


    its literally driving me nuts! LOL...

    All the AS2 development I've done.. I never really got into the networking/socket side of things... (and of that whats I need now!) LOL

  17. #77
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    FINALLY!!!

    Got it working!!

    WOO HOO! (I'm so stoked right now.. I cant even explain).

    Finally got it working with that Apache mod link posted above.


    Gotta thank a co-worker, who not only helped, (but listened to me day after day!) LOL..

    He helped me get the policy server set up correctly, and helped me tweak/add a parameter I was missing/overlooking to the (custom/secondary) crossdomain.xml file!

    ports = '*' was a big difference.. and not mentioned in many tutorials... nor mentioned (or part of) the above links master-file crossdomain.xml file!


    Big ups to @Alloy Bacon as well.. who started me down this path and got me working with SOCAT (the proxy I needed)

    To re-cap:

    Just:

    RPi
    Arduino (connected via USB/ttyUSB0)


    Thats all the hardware needed. (no ESP-13 hardware server required, although I gotta admit, thats a pretty neat work around!)


    Now I can back to the Flash development side of things a bit more.. and work on the PCB schematic/board design stuff I still need to do for this!

    Thanks again!

  18. #78
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    nice, your swf is finally communicating with the arduino through the socket, congratulations.

    Keep the esp13 for something else like wireless relay control.
    Last edited by AS3.0; 03-06-2019 at 09:41 PM.

  19. #79
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    Yes.. it is.
    Thanks to your help as well.

    So with this project now (finally) under way... I have a way to communicate with Arduino >> Flash (hosted on RPi).

    I also have another project that I did recently, that (doesnt use flash) and uses PHP and AJAX to communicate and displays things in an HTML/CSS page..(its for my barbot menu system)

    Open up a lot doors for me on what I can do with this data, and making interfaces..etc.. as well.


    I am not even sure if I need to go through all the trouble of the SSL and self-signed certificate process now?

    Initially I thought the camera stuff in the .swf wouldnt run unless it was on an HTTPS connection.. but with the .swf being local to the system/browser (it wasnt in my initial tests.. it was hosted remotely).... I dont think that is even an issue any longer.

    This link was great:
    http://www.beamartyr.net/articles/ad...ileserver.html

    however.. you WILL need your own custom crossdomain.xml file to be called.. as the one built in the module (maybe could edit it before compiling it) is missing some port="*" parameters

  20. #80
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    Hey Alloy Bacon-

    Questions for you. (since you are the only one I really know that is interested in Arduino/RPi stuff... and ALSO knows anything about Flash stuff... figured I'd run this by you)..

    In my SWF.. I have a camera/video object.. (nothing special)

    Basically just this:

    Code:
    var video_obj:Video;
    var cam:Camera = Camera.get();
    video_obj.attachVideo(cam);
    cam.onStatus = function(infoObj:Object) {
        switch (infoObj.code) {
    		case 'Camera.Muted' :
    			trace("Camera access is denied");
    		break;
       
       		case 'Camera.Unmuted' :
        		trace("Camera access granted");
    			//start it up
    			//setTimeout(startUp,1000);
        	break;
        }
    }


    It works fine (as far as loading and displaying the camera feed on the page) ... however.. It looks a bit 'pixelated' (like the video is 'scaled up').. or stretched is a better word to describe it.

    I used this line to make the driver/service start at RPi boot up:


    Code:
    sudo sh -c 'grep "bcm2835-v4l2" /etc/modules || echo "bcm2835-v4l2" >> /etc/modules'

    Once things were running. I ran this line:

    Code:
    v4l2-ctl -V
    To see what resolution it was at and other details..


    Code:
    pi@raspberrypi:~ $ v4l2-ctl -V
    Format Video Capture:
    Width/Height : 160/120
    Pixel Format : 'YU12'
    Field : None
    Bytes per Line : 160
    Size Image : 30720
    Colorspace : SMPTE 170M
    Transfer Function : Default
    YCbCr/HSV Encoding: Default
    Quantization : Default
    Flags :
    The 3.5 HDMI screen I am using is a 480x320 resolution screen..

    The flash camera object is set to 480x320px dimensions on the stage as well..

    I'm not sure if this an RPi thing? (and some setting with the ArduCam I am using?) or if this is something on the Flash side of things? (but not sure what it could be.. but I also dont have much experience with the cam/video objects)..

    The details returned, seems to indicate that the resolution is 160x120? (which would make sense that it is pixelated if the Flash video object dimensions are 480x320...

    But I an not clear on where this initial 160/120 resolution is coming from??



    Any ideas?


    nevermind! I should have checked the documentation before posting! LOL..

    it states right there.. the default is 160x120... and need to be set using the setMode() method. (DUH!)

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center