Object serialization over an RS232 port

Hi
Thanks in advance for any help!!!
I have just started embarking on a java project that incorporates both J2SE and J2ME technologies.
In short:
I am developing an embedded java system using a JStamp development kit. In conjunction to this I am also developing a java pc GUI application that is used for setting up a configuration for my embedded system.
So here�s what I want to do.
Firstly I would like to input a configuration via my java pc GUI application, and then once this configuration is complete I would like to wrap it in an object. Once the object has been created I would like to serialize it and send it over an Rs232 port as some kind of �OutputStream�. I would expect my embedded system to be listening to its serial port for this stream and then once received reconstruct the stream into it�s original object. The embedded system would then replace its current configuration with the new object.
Questions:
1.What kind of data streams and filtering streams will I need on the java pc application side (or how can I program these streams myself?)?
2.How can I reconstruct this serialized object at the embedded system side

From the javadoc:
Multiple references to a single object are encoded using a reference sharing mechanism so that graphs of objects can be restored to the same shape as when the original was written.
This means ObjectOutputStream writes each Object instance once. It tracks instances which have been written and if they are written again, it only sends a "reference" to that object. This serves 2 purposes: 1) most importantly, preserves the integrity of the object graph and 2) reduces the amount of data.
Two techniques to solve this:
1) open a new stream each time
2) use the reset method

Similar Messages

  • Servlet and Object Serialization

    Hi,
    I am developing a routing server in Java
    2 Instances of the same server will be running in 2 different data centers.
    The servers have a Jetty server embedded with a Servlet inside.
    Server 1 will use a GET method to talk to the Server 2 -> Servlet which will write the state of an object back which will read by Server 1 and reconstruct the object back.
    Do you find any issues in Object Serialization/DeSerialization in the Servlet.
    What are the factors that I need to consider in this case?
    Regards,
    Jana

    Make sure that your servlet handles the transaction in the same thread that doPost() or doGet() is called in.
    I ended up porting some old ServerSocket based code to a servlet, and was handing off the request and response objects to a handler thread on the server side. I ended up with a ton of intermittent errors like this.
    Once I started handling the transactions in the same thread things worked heartbreakingly well.

  • Control Instrument using RS232 port

    I have tried to download the IVI driver of the Agilent E3633A that stated can communicate using GPIB or Serial.
    I tried to initialize the instrument but no successful.
    I used a twisted ( tx and rx swap) RS232 cable (female to female) to connect between the instrument and PC com port.
    Please help to advice on how to control the equipments using RS232 port inlabview. Thanks!

    Hello,
    Here's what you can do to verify that you have established communication with the instrument.
    First gather the relevant information:
    1. Find a command that you know your instrument "understands" (it is highly likely that it will understand *idn? which should prompt the instrument to reply with a description of itself).
    2. Verify the serial settings that your instrument uses by default, such as baud rate, number of data bits (likely 8), parity, and the number of stop bits. You can also verify what termination character the instrument uses (which it likely does); this is the last character you will need to send after sending the relevant command characters, and it will indicate the end of the command to the instrument so that it stops reading from the serial port. I doubt that the instrument is configured for flow control of any kind by default, so don't worry about that unless there is specific indication of this in the manual for your instrument.
    3. Verify the type of your cable; that is, you will need to connect pin 2 of your computer's COM port to pin 3 of your instrument's COM port, and pin 3 of your computer's COM port to pin 2 of your instrument's COM port. Some cables automatically switch these connections with the wires inside the cable, others are "straight through." You can bypass the cables altogether and just use wires to make the relevant connections initially; don't worry about a twisted pair at first, just keep the wires short and you should be ok (unless you are in a particularly noisy environment).
    Now build the LabVIEW program:
    1. Open a blank VI
    2. Navigate to and pin down the following functions palette on the block diagram:
    All Functions -> Instrument I/O -> Serial
    3. Place onto the block diagram the four VIs/functions in the top row in the order they appear (should be VISA Configure Serial Port, VISA Write, VISA Read, VISA Close); note that the open will be performed implicitly the property node inside the VISA Configure Serial Port VI (don't worry about this).
    4. Hover over the upper left hand terminal of the VISA Configure Serial Port VI, right click, and choose
    Create -> Constant; now select the PC COM port you connected your instrument to in the newly created constant
    5. Create constants for the inputs to match the serial parameters that you found for your instrument above if the default values don't already match. Note that the defaults used by this VI include activating the linefeed termination character to be used when reading, as well as standard settings for serial port which may already match your instrument (check by hovering over the ports with the wiring tool; the default values will show in parenthesis)
    6. Wire the top right hand terminal to the top left hand terminal of adjacent VI's (which should be in the order noted above); this connects the resource name to each so they perform the operations on the chosen serial port
    7. Wire the bottom left to the bottom right hand terminals in a similar fashion; this connects the error clusters
    8. Almost done... now hover over the remaining left input of the VISA Write function (called write buffer), right click, and create a constant; type *idn? (and include a linefeed character at the end by typing the key)in the string constant that you just created
    9. Similarly for the read function, create a constant for the input that indicates the number of bytes to read (perhaps make this number 100 as you will likely terminate the read appropriately when a termination character is read; your instrument will likely send this), and create an indicator for the "read buffer" output which will show you the string that is read back when you run the program.
    10. You should now be able to run the program; hope it works.
    I would have included a screenshot or example instead of a description, but I don't have access to that at this time and perhaps it is best to actually go through the process of building the VI anyway if you are new to LAbVIEW.
    Good luck and repost if you continue to have troubles!
    Thank you,
    Best Regards,
    JLS
    Best,
    JLS
    Sixclear

  • Customizing Forte object serialization

    Forte supports serialization of arbitrary object graphs into streams.
    However, there do not seem to be any well documented ways to customize
    this serialization, e.g. by using a different encoding scheme. It would
    seem there must be some support in there somewhere. I suppose at the
    very least, one could parse a serialized object (once one decoded the
    Forte encoding scheme) and do the conversion from that. That seems
    suboptimal, though.
    Has anyone done this? Any thoughts on how it might be done?
    Regards,
    Coty
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/forte>

    JavaFunda wrote:
    Object serialization is the process of saving an object's state to a sequence of bytes. Does it saves only the instance variable or also the object methods(like getter and setter methods) ? Only the state--the instance variables. It doesn't save the class definition. That has to be available separately (via classloader) at deserilaization time. In other words, you cannot deserialize an instance of a class that is not on your classpath.
    Once we we write the object to outputstream or some text file, how does it get transmitted over network?The same way any other bytes get transmitted. You have a Socket. You get its OutputStream. You wrap that in an ObjectOutputStream. When you write to the ObjectOutputStream, that writes through to the Socket's OutputStream, which is responsible for putting the bytes on the wire.
    Does we write the java object to text file only duuring serialization?We write the objects to wherever the other end of the ObjectOutputStream is connected to. Just like any other I/O.

  • Serialization over sockets

    Hi All!
    So i've decided to perform serialization over sockets - so i made a server that has an ObjectOutputStream and a client that has ObjectInputStream and i wrote a Properties object.
    I managed to get passed the EOFException problem and the same object writing problem (using reset()), but i've read that this isn't efficient, and on top it all it has the problem of blocking.
    I've read some posts regarding Serialization and NIO but i couldn't get from them what i should do - so can someone plz explain to me:
    1) How can i write objects to sockets using NIO
    2) Furthermore - if this really solves the memory and efficiency problems
    3) A code sample or a ref. would really be appriciated.
    Regards,
    Snayit

    Basically I would ask myself if I really need NIO - for MOST purposes the old-blocking IO is very good and much easier to use.
    One of the biggest problems with blocking IO is, that for thousands of clients you need an own thread which causes many OSes to truggle.
    I really recommend buffering the streams! (Via BufferedInput/OutputStream) but do not forget to flush() them if you really want the data to be sent.
    If you want to use NIO you have to write the object-data into a byte-array (creating a bytearrayoutputstream -> ObjectOutputStream) and writing this byte-arrays.
    hope this helps, lg Clemens

  • AS2 over HTTP Send port question.

    I have an application that builds and  sends flat and EDI files to FTP, FILE, SqlAdapter send ports and now they want AS2 over an HTTP port, I understand the AS2 settings (using party resolution, etc.) what I don't get is how/what exactly is receiving
    the message on the other side... They don't have a web service nor a page, I created a site to test but what do I do? Send an edi file to a url????
    Bico Bielich

    From your question I understand, you have been asked to send message through AS2. Do they also going to receive message through AS2 from their party? Is your question is about how to receive the message through AS2 which you also want to send over AS2?
    You can configure
    BTSHTTPReceive.dll to receive messages over HTTP and configure the Receive location with AS2 EDI pipeline component to receive messages over AS2 into BizTalk which can be subscribed by your send port filter or Orchestration ( if you have any process
    to be applied before sending the message over AS2 send).
    Check the Tutorial-3 part of AS2 which illustrate an example which receives an AS2 message through BTSHTTPReceive.dll. 
    Tutorial 3: AS2 Tutorial
    And following references shall help you configure the BTSHTTPReceive.dll:
    How to Configure IIS for an HTTP Receive Location
    Configuring BTSHTTPReceive.dll to work on IIS 7 
    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • Capture Weigh Bridge Reading in ABAP Program through RS232 port

    Dear SAPers,
    I am in Cement Implementation Project and i have requirement to Connect Weigh Bridge to SAP ERP and capture the readings of that Weigh Bridge in ABAP program.
    How can i capture those readings in ABAP program or save them in a Z table using RS232 port????
    Best Regards,
    Kholoud
    Moderator message: please do not cross-post.
    Edited by: Thomas Zloch on Mar 17, 2011 1:22 PM

    Dear Vijay,
    I'm having the same problem in my implementation, the client needs me to capture the readings from Weigh Bridge through RS232 port directly to ABAP program.
    Could please tell me how did you solve this??
    Thanks
    Kholoud

  • T450s no 4k 60hz support over Mini-Display Port 1.2

    Hi, I've got a T450s with Intel HD Graphics and my 4k Monitor is not working with 60hz. I only get 2560x1440 with 60hz. What I tried:- New cable- Latest drivers- New Bios Version Does anyone have the same problems? Thanks Mathias

    Is there somebody to get 4k with 60hz over mini-display port? with the following hardware specs:- using a Lenovo T450s- no dedicated GPU (nvidia)- with onboard graphics (Intel HD)- 4k Monitor with display port- using mini-display port on lenovo notebook- no docking station If yes, please tell me- what monitor are you using?- which graphics drivers are you using?- which bios version do you use?- what kind of cable are you using?- which specific settings do you use?- are you using windows 7 or 8? Thanks,Mathias 

  • Equium M40X-189: How to connect RGB port to RS232 port?

    Hi,
    as you know the Equium M40X-189 P-M 730/XP has an RGP monitor port and does not have RS232 port.
    Im working with Auto-titration device which require RS232 port for connection!
    Any idea of how i can connect my notebook to this device!
    pls help
    thanks
    Omrankl

    Hi
    As far as I know the RS-232 port is a serial port and I dont think that its possible to connect the RGB port to the RS232 port.
    But I have found the useful website:
    http://www.ontrak.net/usb.htm
    There you will find a description how to connect the USB port to a RS-232 port.
    You need a ADU interface.
    Check the link.

  • Run a mini displayport cable over a Thunderbolt port

    Hi
    I have a new imac with 2 thunderbolt ports - and I want to run a mini displayport cable over a thunderbolt port - is there any cable can solve this ?

    http://store.apple.com/us/search?find=mini+display+port+to+hdmi+adapter
    https://www.google.com/search?sugexp=chrome,mod=6&sourceid=chrome&ie=UTF-8&q=Min i+Displayport+to+HDMI+adapter
    http://store.apple.com/us/product/H1824ZM/A/Moshi_Mini_DisplayPort_to_HDMI_Adapt er
    http://www.amazon.com/Mini-DisplayPort-Adapter-female-Cable/dp/B0025V2VO0

  • Using multi threading to access 2 RS232 ports

    Hi,
    I'm a beginner in multi threading, so this question may be a very basic one....
    I'm Using TS3.5 + CVI 8.01 to communicate withs 2 RS232 ports.  I thought to use mult threading so I can process 2 steps in parallel rather than in series. 
    This is what I do:
    1) I defined 2 subsequences, each of them call the same CVI function.  I use the sub sequence parameters to transfer the com number.
    2) My CVI application includes one dll for this specific project and another one, a general dll to handle RS232 functions.  The RS232 dll uses one global buffer than collects all the traffic on the com. 
    QUESTIONS:
    1) What happens when 2 seperate threads run the same function in the RS232 dll?  (in terms of memory etc...).  Does each one use a different buffer (in terms of memory allocation), or, both of them writes to the same buffer?   Obviously, if they writes to the same buffer, then, my function will not operate properly.
    2) What happens in TestStand after the 2 steps in new threads have finished their execution?  does the next step run back in the same threads the sequence run before?
    Thanks
    Rafi

    Rafi,
    Glad to hear you were able to make some ground on your application. As for all of your questions, I'll try to answer as many as I can.
    First, when you are talking about your global buffer, is it created in TestStand or in the DLL itself? When you use DLLs, global variables or global structures are shared between all threads that call your DLL. On the other hand, if your buffer is declared inside of the DLL it is global for the DLL but not shared and would be a separate buffer for each call.
    With your run-time error in TS, it would definitely be helpful to have more information about the error. From what you explained (executing fine on the first call, but failing on future executions), it sounds like the resource is not being released after the first execution.
    As far as a specific example for TestStand Multithreading, you'll want to look at the TestStand Development Library and, specifically, Multithreading in TestStand. If you look and browse through the Application Notes and Tutorials section, as well as the Technical Presentations section, you will learn a great deal about multithreading and what options you have in TestStand. For a specific example, you may want to look at This Example. You could also look in the <TestStand>\Examples (where <TestStand> is the directory where TS is installed) at the MultiUUT example for an example of multithreading in TS. These examples may not be exactly what you need, but they should give you a jump start.
    As far as making your DLL multithread safe, it is definitely not necessary; however, there are some significant advantages described in this article: Designing Thread-Safe DLLs. It is an MSDN article that focuses on Visual Basic, but it has some helpful information that can apply to C as well.
    Hopefully this can help you move further. I have attached a list of links at the end of this post with other helpful links for you as well. Keep us posted with your progress.
    Matt Mueller
    NI
    Links:
    General Information on Multithreading for C Programmers
    Building Multithreading Applications with LabWindows/CVI
    Multithreading in LabWindows/CVI
    Easy Multithreading Programming in LabWindows/CVI
    Multithreading for Rookies

  • How to send this command to RS232 Port

    I want to use LV to control a label printer to print what I need. Following info is from printer user manual.
    From RS232 port:
    If Codex has been used with the controller then the simple serial protocol will need to be enabled by sending ESC Z SWITCH ON <CR> (without spaces). Codex automatically disables the simple protocol for security reasons, so it is a good idea to start all sessions with this command.
    ESC Z S W I T C H O N <CR>
    à From BASIC the first line would be CHR$(27)+”ZSWITCHON”+CHR$(13)
    Send the following ASCII data to the RS232 port:
    ESC J 0 C H R I S T M A S <CR>
    ESC J 1 A N D   S E A S O N S <CR>
    ESC J 2 G R E E T I N G S <CR>
    ESC J 3 T O   M Y   H E L P E R S <CR>
    ESC J 4 0 9 8 7 6 5 4 3 2 1 2 1 <CR>
    à From BASIC the first line would be CHR$(27)+”J0CHRISTMAS”+CHR$(13). Etc.
    In VB I can use this command to control the printer. But In LV how can I do?
    I'd appreciate it if anybody give me a simple sample.

    A string control or constant in LabVIEW can be set for normal, hex, or '\' code display by just right clicking on the control constant. CHR$(27) is the the ESC character and the hex equivalent of 27 is 1B. The CR is hex  0D. So, a simple way to do this would be to have a hex display constants for the ESC and CR character and a normal display for the the command. Use the concantanate string function to build one string.
    Message Edited by Dennis Knutson on 10-10-2007 09:57 PM
    Attachments:
    String Display Options.PNG ‏5 KB

  • 2D objects Serialization problem

    Welcome!
    I'm making a net game using RMI and I have this problem.
    When I'm trying to join my client with the server an error occures:
    Error: error marshalling arguments; nested exception is:
         java.io.NotSerializableException: java.awt.geom.Ellipse2D$Double
    My client contains an Object extending a JPanel class. There are 2D object used to make the map, and that's why this error occures.
    It's a funny thing, cause I'm not sending a whole Object of my client, but only it's refference (using "this" in the join() method) so I dont know why does the 2D object need to be serialized and sent :|?
    Any way, my question is how to make 2D objects serializable!? I have jdk1.5.0_06 and as far as I remember they should be srializable in this version. Mabey I'm dooing something wrong!? Mabey it's nessesary to ad an appropreate code-line or import sth... i don't know
    please help me... I have little time to finish my project, and this thing is blocking my work.
    Big thanks to anybodey who will help.
    regards floW

    I'll tel u the whole story then, my problem is as follows:
    public class BounceThread{
       public static void main(String[] args)   {
          JFrame ramka = new BounceFrame();
             ramka.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
             ramka.setVisible(true);
    class BounceFrame extends JFrame{
    public BounceFrame()
          setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
          setTitle("MiniGolf v 1.0");
          panel = new BallPanel(); // this contains maps made with 2D objects
          panel.setBackground(Color.green);
          panel.setVisible(panel.czy_wida&#263;_panel());
          add(panel, BorderLayout.CENTER);
    // I add a menu bar, that starts a net game:
    JMenuBar pasekMenu = new JMenuBar();
              setJMenuBar(pasekMenu);
              JMenu menuGra = new JMenu("Game");
           // and so on... and finaly I add an option:
              menuGame_Nowa.add(new
                        AbstractAction("Net game")
                             public void actionPerformed(ActionEvent event)
                                  net_game(panel);
    // here i write my net_game method:
    public void net_game(BallPanel aPanel)
         //here, i make an Client object, and connect him with my server
         client = new mgClient(panel);
         client.join();
         // I give panel as a paramete, cause I cant think of another way of leting my server to uce it's (panels) methods
         // If I join only a name of my client, then how can I change the panel in my BounceFrame from the Clients method
         // "shouted" by the server!? It has to be a field in the client's object.
         // Is there any other way out!?
    // Class BouceFrame holds the panel as a field:
    private mgClient client;
    private BallPanel panel;
    //and so on...
    }and that's the real problem I'm facing here. Is there any solution!? I think, that making a Client's field out of my panel is the only way ot. And that means I need those 2D objects serialized... :(
    Please help if u can.
    Regards floW

  • Reading data from RS232 PORT

    Hi all
    I have to capture the   WEIGHT from the RS 232 PORT into SAP.
    How to interface the Weigh Bridge System with ABAP thru RS232 PORT.
    Thanks in advance
    Sourabh

    I have the same requirement, but have many different RS-232 devices to read from via serial ports. I would be interested in any solutions that anyone has come up with.
    Thanks,
    Bob

  • How to interface the Weigh Bridge System with ABAP thru' RS232 PORT

    Hi Gurus,
    Can any one guide me how to interface the Weigh Bridge System with ABAP thru' RS232 PORT. I think we have to use the BAPI. What is the name of the BAPI.
    I have to capture the GROSS WEIGHT, TARE WEIGHT. can any one give me the code for that.
    Goodwill
    Jacob charles

    Hi Jacob,
    <b>You can integrate Weigh Bridge with SAP ABAP .
    I have done this for one of our projects
    The technology used in RFC SDK and DCOM Connector.
    Refer to this link
    SAP Business One SDK Version 2005 [original link is broken]
    Search here for sap software distribution center link
    https://websmp203.sap-ag.de/~form/handler?_APP=00200682500000001943&_EVENT=SEARCH&HIDE=&SEARCH_SPAT=X&SEARCH_BPAT=X&SEARCH_CD=X&SEARCH_P=X&SEARCH_PV=X&SEARCH_C=X&SEARCH_CV=X&SEARCH_TA=&SEARCH_V=&HIDE_EXPERT_SEARCH=X&SEARCH_MAX_RESULT=20
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndcom/html/sapintegration.asp
    http://www.intelligententerprise.com/channels/applications/feature/archive/homann.jhtml;jsessionid=BR44S4YLZ0HSGQSNDLOSKHSCJUNN2JVN?_requestid=505707
    www.sapgenie.com/sapgenie/docs/SAP%20Connectors.doc
    help.sap.com/printdocu/core/ Print46c/en/data/pdf/BCMIDDCOM/BCMIDDCOM.pdf</b>
    Good Luck and thanks
    AK

Maybe you are looking for