SIGVerse

How to add a request to server from the Viewer

Example case: Add a new element/ parameter in world xml file and load this parameter using a new request.

  1. Add a element to parse in the Xml file
  2. Prepare where how to store your new data, and how to access it. In my case I used SSimWorld.h
    1. Variable
    2. Accessor: get/set
  3. Modify WorldXMLReader.cpp, add the new Tags in the parser (in the big if/else)
    1. Use the set accessor
  4. Add in WordSimulator.h, a ID and a name for your event
    1. Be carefull to REQUEST_SIZE
  5. Add a request to Winmain.h (viewer side)
  6. Add to WordSimulator.cpp a case when answer to your request
    1. Use the get accessor
    2. Convert datas in string
    3. Use the socket: s
      1. send first the size of the message (size is store in char[6])
      2. then send the message
  7. Viewer side, Add to Winmain.cpp a case to send your request
    1. Use the function: sendRequest(),
    2. the socket mSock to receive the contain
    3. Parse the contain
    4. Apply the contain

Front page   New List of pages Search Recent changes   Help   RSS of recent changes