From: Abqori A. <abq...@gm...> - 2011-05-22 14:34:23
|
Thanks for replying. I found opaquedriver.cc, but neither of sharedstruct.h, or opaque.c. I'm using Player 2.1.2 and Stage 2.1.1 Did you mean this part? OpaqueDriver::OpaqueDriver(ConfigFile* cf, int section) : Driver(cf, section, false, PLAYER_MSGQUEUE_DEFAULT_MAXLEN, PLAYER_OPAQUE_CODE) { mData.data_count = sizeof(test_t); mData.data = reinterpret_cast<uint8_t*>(&mTestStruct); mTestStruct.uint8 = 0; mTestStruct.int8 = 0; mTestStruct.uint16 = 0; mTestStruct.int16 = 0; mTestStruct.uint32 = 0; mTestStruct.int32 = 0; mTestStruct.doub = 0; return; } I'll learn about this "casting" and try them, thanks. On Sun, May 22, 2011 at 12:46 AM, Rich Mattes <jp...@gm...> wrote: > On 05/21/2011 10:18 AM, Abqori Aula wrote: > > The type is only uint8_t because each uint8 is one byte, which makes > packing larger types and structs into it a lot easer. The examples in > examples/plugins/opaquedriver/ outline how to do what you're trying to > do. opaquedriver.cc contains a driver which packs a user-defined > structure (defined in sharedstruct.h) into the opaque proxy. There's > also opaque.c, which uses the playerc client library to subscribe to the > example driver and unpack the structure from the opaque message. You > can use the same kind of casting to send any datatypes you want. > > Rich > > |