50 lines
996 B
Java
50 lines
996 B
Java
package org.hwo.servicelink;
|
|
|
|
|
|
public class ServiceLinkTelegram {
|
|
static int REQ_READ = 0x01;
|
|
static int REQ_WRITE = 0x02;
|
|
static int REQ_EVENT = 0x04;
|
|
static int REQ_FAIL = 0x08;
|
|
|
|
static int REQ_INT = 0x10;
|
|
static int REQ_FLOAT = 0x20;
|
|
static int REQ_ACK = 0x40;
|
|
|
|
static int SL_MAGIC = 0x66;
|
|
|
|
|
|
int opcode,
|
|
achse,
|
|
knoten,
|
|
register;
|
|
Object
|
|
value;
|
|
|
|
protected ServiceLinkTelegram(){
|
|
}
|
|
|
|
protected ServiceLinkTelegram(int operation,int achse,int knoten,int register,Object value){
|
|
this.opcode = operation;
|
|
this.achse = achse;
|
|
this.knoten = knoten;
|
|
this.register = register;
|
|
this.value = value;
|
|
}
|
|
|
|
private void checkPlausible(){
|
|
if ((opcode & REQ_WRITE)!=0){
|
|
if (value == null){
|
|
throw new NullPointerException("Need a value to create write-request");
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public static ServiceLinkTelegram create(int operation,int achse,int knoten,int register,Object value){
|
|
return new ServiceLinkTelegram(operation,achse,knoten,register,value);
|
|
}
|
|
|
|
|
|
}
|