typedef struct DEV_Info
{
char sName[INFO_LEN];
char sDEVType[INFO_LEN];
char sElcType[INFO_LEN];
char sElcVR[INFO_LEN];
float fBeng_jing;
float fBeng_shen;
float fhan_shui;
float fdong_ye_mian;
float fchan_ye_add;
}*pDEV_Info;
这个转成类呢,发送的时候怎么获取实质内容和大小呢?
------解决思路----------------------
可以直接写一个Java 类, 然后用 C 将结构体传给 Java
参考 : http://blog.csdn.net/vblittleboy/article/details/11763409
据我所知, 好像没有直接转化的框架
------解决思路----------------------
char 直接用String,不用new
int是四个字节,float忘了。。。
/**
* Created by puruidong on 2015/4/27.
*/
public class Entity {
private String sName;
private String sDEVType;
private String sElcType;
private String sElcVR;
private float fBeng_jing;
private float fBeng_shen;
private float fhan_shui;
private float fdong_ye_mian;
private float fchan_ye_add;
public String getsName() {
return sName;
}
public void setsName(String sName) {
this.sName = sName;
}
public String getsDEVType() {
return sDEVType;
}
public void setsDEVType(String sDEVType) {
this.sDEVType = sDEVType;
}
public String getsElcType() {
return sElcType;
}
public void setsElcType(String sElcType) {
this.sElcType = sElcType;
}
public String getsElcVR() {
return sElcVR;
}
public void setsElcVR(String sElcVR) {
this.sElcVR = sElcVR;
}
public float getfBeng_jing() {
return fBeng_jing;
}
public void setfBeng_jing(float fBeng_jing) {
this.fBeng_jing = fBeng_jing;
}
public float getfBeng_shen() {
return fBeng_shen;
}
public void setfBeng_shen(float fBeng_shen) {
this.fBeng_shen = fBeng_shen;
}
public float getFhan_shui() {
return fhan_shui;
}
public void setFhan_shui(float fhan_shui) {
this.fhan_shui = fhan_shui;
}
public float getFdong_ye_mian() {
return fdong_ye_mian;
}
public void setFdong_ye_mian(float fdong_ye_mian) {
this.fdong_ye_mian = fdong_ye_mian;
}
public float getFchan_ye_add() {
return fchan_ye_add;
}
public void setFchan_ye_add(float fchan_ye_add) {
this.fchan_ye_add = fchan_ye_add;
}
/* 实际使用不用main方法.
public static void main(String[] args) {
Entity e = new Entity();
e.setsName("这是设置名字de ----");
//e.getsName()获取设置的值.
//e.getsName().length();获取长度
System.out.println(e.getsName()+"--<左边是获取名字");
System.out.println(e.getsName().length());
}
*/
}
求加好友,补习C++,Q877470746