[protobuf] Using protobuf to exchange messages between c++ and java

2012-12-05 Thread valadas
Hello all,
 
I'm trying to exchange messages between c++ and java and vice-versa without 
success.
 
I've defined two messages (1 to be sent from c++ to java and another to be 
sent the other way around) with union types (see attached .proto).
 
The c++ code is as follows:

*operational_gui::OperationalMessage message; 
message.set_type(operational_gui::OperationalMessage::OWNPOSITIONREPORT); 
message.mutable_oprep()-set_latitude(38.5); 
message.mutable_oprep()-set_longitude(-9.8); 
message.mutable_oprep()-set_heading(25); 
message.mutable_oprep()-set_validity(0); 
  
message.SerializeToArray(buf, message.ByteSize()); 

m_pNamedPipeSocket-write(buf, message.ByteSize()); 
m_pNamedPipeSocket-flush();*
 
The java code is as follows:
*int bytes = pipe.read(buffer);

MessagesProtos.OperationalMessage message = 
MessagesProtos.OperationalMessage.parseFrom(buffer);

switch(message.getType()){
case OWNPOSITIONREPORT:
   System.out.println(Response is OwnPositionReport);
   break;
case FRIENDPOSITIONREPORT:
   System.out.println(Response is FriendPositionReport);
   break;
case COMMSTATUSREPORT:
   System.out.println(Response is CommStatusReport);
   break;
}*
** 
The communication is made by pipes (QLocalSocket on c++, FileInputStream on 
java side)
C++ sends 33 bytes and java received them all but blows with an exception 
*InvalidProtocolBufferException: 
Protocol message contained an invalid tag (zero).*
 
Any hints ?
 
Thanks in advance.
** 

-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/protobuf/-/i3X8hX-sTMcJ.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



[protobuf] Re: Issue 324 in protobuf: Feature: Add a new primitive type for a DateTime format

2012-12-05 Thread protobuf

Updates:
Status: Invalid

Comment #6 on issue 324 by liuj...@google.com: Feature: Add a new primitive  
type for a DateTime format

http://code.google.com/p/protobuf/issues/detail?id=324

Protobuf library is designed to provides fundamental low-level primitive  
types. You can use int64 or even bytes for arbitrary data in application  
layer.


--
You received this message because you are subscribed to the Google Groups Protocol 
Buffers group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



[protobuf] Re: Issue 375 in protobuf: Invoking ShutdownProtobufLibrary() more than once causes segmentation fault.

2012-12-05 Thread protobuf


Comment #3 on issue 375 by liuj...@google.com: Invoking  
ShutdownProtobufLibrary() more than once causes segmentation fault.

http://code.google.com/p/protobuf/issues/detail?id=375

Hmm, looks like the ShutdownProtoLibrary() already can be called by  
multiple times. Rolled back r450.


--
You received this message because you are subscribed to the Google Groups Protocol 
Buffers group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



[protobuf] Re: Issue 345 in protobuf: option java_package missing in src/google/protobuf/compiler/plugin.proto

2012-12-05 Thread protobuf

Updates:
Status: Fixed
Labels: FixedIn-2.5.0

Comment #4 on issue 345 by liuj...@google.com: option java_package missing  
in src/google/protobuf/compiler/plugin.proto

http://code.google.com/p/protobuf/issues/detail?id=345

Fixed in r456

--
You received this message because you are subscribed to the Google Groups Protocol 
Buffers group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] c++ to java issue (zero tag)

2012-12-05 Thread Christopher Head
On Wed, 5 Dec 2012 07:37:40 -0800 (PST)
valadas valadas.gonc...@gmail.com wrote:

 *FileinputStream pipe = new FileinputStream(pipeName);*
 *char buffer = new char[4096];*
 ** 
 *pipe.read(buffer);*
 *
 MessagesProtos.OperationalMessage message = 
 MessagesProtos.OperationalMessage.parseFrom(buffer);
 

Protobuf messages are binary. Use bytes here, not chars. In fact this
code shouldn’t even compile; java.io.FileInputStream doesn’t *have* a
read() method that takes a char array!

Chris

-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



[protobuf] Re: Issue 390 in protobuf: RepeatedFieldAccessor UnsupportedOperationException detail message wrong

2012-12-05 Thread protobuf

Updates:
Status: Fixed
Labels: FixedIn-2.5.0

Comment #2 on issue 390 by liuj...@google.com: RepeatedFieldAccessor  
UnsupportedOperationException detail message wrong

http://code.google.com/p/protobuf/issues/detail?id=390

(No comment was entered for this change.)

--
You received this message because you are subscribed to the Google Groups Protocol 
Buffers group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.