mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-20 00:51:41 +00:00
enum and is binary bug fix
This commit is contained in:
@@ -44,8 +44,8 @@ public class ServerHandler {
|
||||
users.remove(context);
|
||||
}
|
||||
|
||||
void onBinaryMessage(WsBinaryMessageContext data) throws Exception {
|
||||
Map<String, Object> deserialized = objectMapper.readValue(ArrayUtils.toPrimitive(data.data()), new TypeReference<Map<String,Object>>(){});
|
||||
void onBinaryMessage(WsBinaryMessageContext context) throws Exception {
|
||||
Map<String, Object> deserialized = objectMapper.readValue(ArrayUtils.toPrimitive(context.data()), new TypeReference<Map<String,Object>>(){});
|
||||
for (Map.Entry<String,Object> entry: deserialized.entrySet()) {
|
||||
try {
|
||||
switch (entry.getKey()) {
|
||||
@@ -87,14 +87,18 @@ public class ServerHandler {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
broadcastMessage(deserialized,context);
|
||||
}
|
||||
}
|
||||
private void setField(Object obj, String fieldName, Object value) {
|
||||
try {
|
||||
Field field = obj.getClass().getField(fieldName);
|
||||
if (BeanUtils.isSimpleValueType(field.getType())){
|
||||
//if enum needs to convert
|
||||
field.set(obj,value);
|
||||
if (field.getType().isEnum()){
|
||||
field.set(obj,field.getType().getEnumConstants()[(Integer) value]);
|
||||
}else{
|
||||
field.set(obj,value);
|
||||
}
|
||||
} else if(field.getType() == List.class){
|
||||
field.set(obj,value);
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
</v-col>
|
||||
<v-col cols="6" class="colsClass">
|
||||
<div>
|
||||
<v-tabs background-color="#212121" dark height="50" slider-color="#4baf62" centered style="padding-bottom:10px" v-model="pipeline.isBinary" @change="handleInput('isBinary',pipeline.isBinary)">
|
||||
<v-tabs background-color="#212121" dark height="50" slider-color="#4baf62" centered style="padding-bottom:10px" v-model="pipeline.isBinary" @change="handleInput('isBinary',!!pipeline.isBinary)">
|
||||
<v-tab>Normal</v-tab>
|
||||
<v-tab>Threshold</v-tab>
|
||||
</v-tabs>
|
||||
|
||||
Reference in New Issue
Block a user