finished? tui client efficient streams. Compiled but not tested

main
Keegan 3 years ago
parent 533e0325aa
commit 68aa34ee0d

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.27.1
// protoc-gen-go v1.28.0
// protoc v3.6.1
// source: internal/pkg/grpc/management.proto
@ -27,6 +27,7 @@ type GetDevicesRequest struct {
ClientId uint32 `protobuf:"varint,1,opt,name=clientId,proto3" json:"clientId,omitempty"`
ReactorId uint32 `protobuf:"varint,2,opt,name=reactorId,proto3" json:"reactorId,omitempty"` // if unspecified, don't return any devs
Refresh bool `protobuf:"varint,3,opt,name=refresh,proto3" json:"refresh,omitempty"`
}
func (x *GetDevicesRequest) Reset() {
@ -75,6 +76,13 @@ func (x *GetDevicesRequest) GetReactorId() uint32 {
return 0
}
func (x *GetDevicesRequest) GetRefresh() bool {
if x != nil {
return x.Refresh
}
return false
}
type GetDevicesResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -474,71 +482,73 @@ var File_internal_pkg_grpc_management_proto protoreflect.FileDescriptor
var file_internal_pkg_grpc_management_proto_rawDesc = []byte{
0x0a, 0x22, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x67,
0x72, 0x70, 0x63, 0x2f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x67, 0x72, 0x70, 0x63, 0x22, 0x4d, 0x0a, 0x11, 0x47, 0x65,
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x67, 0x72, 0x70, 0x63, 0x22, 0x67, 0x0a, 0x11, 0x47, 0x65,
0x74, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,
0x1a, 0x0a, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x0d, 0x52, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x72,
0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09,
0x72, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x49, 0x64, 0x22, 0x73, 0x0a, 0x12, 0x47, 0x65, 0x74,
0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
0x1a, 0x0a, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x0d, 0x52, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x72,
0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09,
0x72, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x49, 0x64, 0x12, 0x23, 0x0a, 0x07, 0x64, 0x65, 0x76,
0x69, 0x63, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x67, 0x72, 0x70,
0x63, 0x2e, 0x44, 0x65, 0x76, 0x52, 0x07, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x22, 0x50,
0x0a, 0x14, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74,
0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74,
0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x49, 0x64, 0x18,
0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x49, 0x64,
0x22, 0x6b, 0x0a, 0x15, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x61, 0x63, 0x74, 0x6f,
0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6c, 0x69,
0x72, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x66,
0x72, 0x65, 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x72, 0x65, 0x66, 0x72,
0x65, 0x73, 0x68, 0x22, 0x73, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65,
0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6c, 0x69,
0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x63, 0x6c, 0x69,
0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72,
0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x61, 0x63, 0x74, 0x6f,
0x72, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x03,
0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x22, 0x70, 0x0a,
0x1a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x44, 0x65,
0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x63,
0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x63,
0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x61, 0x63, 0x74,
0x6f, 0x72, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x61, 0x63,
0x74, 0x6f, 0x72, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x65, 0x76, 0x41, 0x64, 0x64, 0x72,
0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x64, 0x65, 0x76, 0x41, 0x64, 0x64, 0x72, 0x22,
0x8b, 0x01, 0x0a, 0x1b, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x61, 0x63, 0x74, 0x6f,
0x72, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
0x1a, 0x0a, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x0d, 0x52, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x72,
0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09,
0x72, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x65, 0x76,
0x41, 0x64, 0x64, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x64, 0x65, 0x76, 0x41,
0x64, 0x64, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x04,
0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x22, 0x6b, 0x0a,
0x03, 0x44, 0x65, 0x76, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d,
0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74,
0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73,
0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
0x64, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x05, 0x20,
0x01, 0x28, 0x0d, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x32, 0xf3, 0x01, 0x0a, 0x0a, 0x6d,
0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3f, 0x0a, 0x0a, 0x47, 0x65, 0x74,
0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x17, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x47,
0x65, 0x74, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x1a, 0x18, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x44, 0x65, 0x76, 0x69, 0x63,
0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a, 0x0d, 0x44, 0x65,
0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x12, 0x1a, 0x2e, 0x67, 0x72,
0x70, 0x63, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x44,
0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5a, 0x0a, 0x13, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65,
0x61, 0x63, 0x74, 0x6f, 0x72, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x12, 0x20, 0x2e, 0x67, 0x72,
0x70, 0x63, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72,
0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e,
0x67, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x61, 0x63, 0x74,
0x6f, 0x72, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x42, 0x13, 0x5a, 0x11, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x6b, 0x67,
0x2f, 0x67, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x72, 0x49, 0x64, 0x12, 0x23, 0x0a, 0x07, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x03,
0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x65, 0x76, 0x52,
0x07, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x22, 0x50, 0x0a, 0x14, 0x44, 0x65, 0x6c, 0x65,
0x74, 0x65, 0x52, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01,
0x28, 0x0d, 0x52, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09,
0x72, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52,
0x09, 0x72, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x49, 0x64, 0x22, 0x6b, 0x0a, 0x15, 0x44, 0x65,
0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18,
0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12,
0x1c, 0x0a, 0x09, 0x72, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01,
0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x49, 0x64, 0x12, 0x18, 0x0a,
0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07,
0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x22, 0x70, 0x0a, 0x1a, 0x44, 0x65, 0x6c, 0x65, 0x74,
0x65, 0x52, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49,
0x64, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x49, 0x64, 0x18, 0x02,
0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x49, 0x64, 0x12,
0x18, 0x0a, 0x07, 0x64, 0x65, 0x76, 0x41, 0x64, 0x64, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05,
0x52, 0x07, 0x64, 0x65, 0x76, 0x41, 0x64, 0x64, 0x72, 0x22, 0x8b, 0x01, 0x0a, 0x1b, 0x44, 0x65,
0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x44, 0x65, 0x76, 0x69, 0x63,
0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6c, 0x69,
0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x63, 0x6c, 0x69,
0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72,
0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x61, 0x63, 0x74, 0x6f,
0x72, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x65, 0x76, 0x41, 0x64, 0x64, 0x72, 0x18, 0x03,
0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x64, 0x65, 0x76, 0x41, 0x64, 0x64, 0x72, 0x12, 0x18, 0x0a,
0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07,
0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x22, 0x6b, 0x0a, 0x03, 0x44, 0x65, 0x76, 0x12, 0x0e,
0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12,
0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79,
0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01,
0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61,
0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x14,
0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x69,
0x6e, 0x64, 0x65, 0x78, 0x32, 0xf3, 0x01, 0x0a, 0x0a, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d,
0x65, 0x6e, 0x74, 0x12, 0x3f, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65,
0x73, 0x12, 0x17, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x44, 0x65, 0x76, 0x69,
0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x67, 0x72, 0x70,
0x63, 0x2e, 0x47, 0x65, 0x74, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65,
0x61, 0x63, 0x74, 0x6f, 0x72, 0x12, 0x1a, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x65, 0x6c,
0x65, 0x74, 0x65, 0x52, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x1a, 0x1b, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52,
0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5a,
0x0a, 0x13, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x44,
0x65, 0x76, 0x69, 0x63, 0x65, 0x12, 0x20, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x65, 0x6c,
0x65, 0x74, 0x65, 0x52, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x44,
0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x44, 0x65, 0x76, 0x69,
0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x13, 0x5a, 0x11, 0x69, 0x6e,
0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x62,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (

@ -12,6 +12,7 @@ service management {
message GetDevicesRequest {
uint32 clientId = 1;
uint32 reactorId = 2; // if unspecified, don't return any devs
bool refresh = 3;
}
message GetDevicesResponse {

@ -18,7 +18,6 @@ import (
type ReactorManager struct {
*Manager
StatusMon *StatusMonitor
DevsMon *StatusMonitor
*devstatus
}
@ -32,17 +31,14 @@ func NewReactorManager(c *Client,sys *SystemViewer,err chan error) GeneralManage
di := make(map[uint32]*DeviceInfo)
r.devstatus = &devstatus{Devs:di}
r.Manager = NewManager(err)
r.StatusMon = sys.AddReactorSender()
r.DevsMon = sys.AddDeviceSender(c.Id)
r.StatusMon = NewStatusMonitor("Reactor",c.Id,sys)
return r
}
func (r *ReactorManager) Start(cl *Client) {
r.Manager.Start(cl)
logging.Debug(logging.DStart,"RMA %v starting", r.Id)
go r.StatusMon.Start()
go r.DevsMon.Start()
go r.StatusMon.Send(&DeviceInfo{Id:r.Id,Type:"Reactor",Status:"[green]ONLINE[white]"})
go r.StatusMon.Send(&DeviceInfo{Id:r.Id,Type:"Reactor",Status:"[green]ONLINE[white]"},"Reactor")
conn := r.Connect()
empty := &grpc.ClientConn{}
if conn != empty {
@ -53,7 +49,7 @@ func (r *ReactorManager) Start(cl *Client) {
func (r *ReactorManager) Exit() {
r.Manager.Exit()
logging.Debug(logging.DExit, "RMA %v exiting", r.Id)
go r.StatusMon.Send(&DeviceInfo{Id:r.Id,Type:"Reactor",Status:"[red]OFFLINE[white]",Data:fmt.Sprintf("Last Seen %v",time.Now().Format("Mon at 03:04:05pm MST"))})
go r.StatusMon.Send(&DeviceInfo{Id:r.Id,Type:"Reactor",Status:"[red]OFFLINE[white]",Data:fmt.Sprintf("Last Seen %v",time.Now().Format("Mon at 03:04:05pm MST"))},"Reactor")
}
func (r *ReactorManager) GetPort() int {
@ -109,7 +105,7 @@ func (r *ReactorManager) Monitor(conn *grpc.ClientConn) {
newd := d
newd.Status = "[yellow]UNKOWN[white]"
r.Devs[newd.Id] = newd
go r.DevsMon.Send(newd)
go r.StatusMon.Send(newd,"Device")
}
r.devstatus.Unlock()
r.Exit()
@ -134,10 +130,10 @@ func (r *ReactorManager) UpdateDevice(d *DeviceInfo) {
if olddev, ok := r.Devs[d.Id]; !ok {
// new device
r.Devs[d.Id] = d
go r.DevsMon.Send(d)
go r.StatusMon.Send(d,"Device")
} else if olddev.Status != d.Status || olddev.Data != d.Data {
// dev status or data has changed
r.Devs[d.Id] = d
go r.DevsMon.Send(d)
go r.StatusMon.Send(d,"Device")
}
}

@ -2,11 +2,9 @@ package server
import (
"sync"
_ "fmt"
"fmt"
"FRMS/internal/pkg/logging"
)
// package will create and maintain a concurrent system structure
// allows for multiple readers/writers
type DeviceInfo struct {
Id uint32
@ -17,12 +15,130 @@ type DeviceInfo struct {
TransactionId uint32
}
func NewStatusMonitor(ch chan *DeviceInfo) *StatusMonitor {
type StatusMonitor struct {
// allows for embedding into managers
TransactionId chan uint32 // monotonically increases to track outdated reqs
DevChan chan *DeviceInfo // channel for device status
ReactorChan chan *DeviceInfo // channel for reactor status
*SystemViewer
DevBuf *devbuf
sync.Mutex
}
type devbuf struct {
ReactorId uint32 // reactor we are looking at, if any
Buf map[string]map[uint32]*DeviceInfo // convienent way to store/seperate device data
sync.Mutex
}
func NewBuffer() map[string]map[uint32]*DeviceInfo {
rbuf := make(map[uint32]*DeviceInfo)
dbuf := make(map[uint32]*DeviceInfo)
sbuf := make(map[string]map[uint32]*DeviceInfo)
sbuf["Reactor"] = rbuf
sbuf["Device"] = dbuf
return sbuf
}
func NewStatusMonitor(t string, id uint32, sys *SystemViewer) *StatusMonitor {
tid := make(chan uint32)
sm := &StatusMonitor{StatusChan:ch,TransactionId:tid}
sm := &StatusMonitor{TransactionId:tid}
sm.SystemViewer = sys
if t == "Reactor" {
// reactor status monitor
sm.ReactorChan = sys.AddReactorSender()
sm.DevChan = sys.AddDeviceSender(id)
go sm.GenerateIds()
} else {
// tui status monitor
sbuf := NewBuffer()
sm.ReactorChan, sbuf["Reactor"] = sys.AddListener(id,0)
sm.DevBuf = &devbuf{Buf:sbuf} // makes it easier to work with
go sm.Listen(sm.ReactorChan)
}
return sm
}
func (s *StatusMonitor) GenerateIds() {
var id uint32
id = 0
for {
s.TransactionId <-id
id += 1
}
}
func (s *StatusMonitor) Send(d *DeviceInfo, dtype string) {
d.TransactionId = <-s.TransactionId
logging.Debug(logging.DClient,"SYS 01 Updating %s Info (%s, %s)", d.Type, d.Status, d.Data)
if dtype == "Reactor" {
s.ReactorChan <-d
} else {
s.DevChan <-d
}
}
func (s *StatusMonitor) GetBuffer() []*DeviceInfo {
// also clears buffer
s.DevBuf.Lock()
defer s.DevBuf.Unlock()
res := []*DeviceInfo{}
for _, devs := range s.DevBuf.Buf {
for _, dev := range devs {
// loops over reactors then devices
res = append(res,dev)
}
}
s.DevBuf.Buf = NewBuffer() // clearing old buffer
return res
}
func (s *StatusMonitor) UpdateListener(tid, reactorId uint32) {
s.DevBuf.Lock()
defer s.DevBuf.Unlock()
// clearing proper buffer
if reactorId == 0 {
s.DevBuf.Buf["Reactors"] = make(map[uint32]*DeviceInfo)
s.ReactorChan, s.DevBuf.Buf["Reactors"] = s.SystemViewer.AddListener(tid, reactorId)
go s.Listen(s.ReactorChan)
} else {
s.DevBuf.Buf["Devices"] = make(map[uint32]*DeviceInfo) // clearing old devices
if s.DevBuf.ReactorId != reactorId {
go s.SystemViewer.RemoveListener(s.DevBuf.ReactorId, tid)
}
s.DevBuf.ReactorId = reactorId
s.DevChan, s.DevBuf.Buf["Devices"] = s.SystemViewer.AddListener(tid, reactorId)
go s.Listen(s.DevChan)
}
}
func (s *StatusMonitor) UpdateBuffer(d *DeviceInfo, dtype string, ch chan *DeviceInfo) {
s.DevBuf.Lock()
defer s.DevBuf.Unlock()
if dev, exists := s.DevBuf.Buf[dtype][d.Id]; exists {
// already a device in the buffer
fmt.Printf("Old: %v,\nNew: %v \n", dev, d)
if dev.TransactionId > d.TransactionId {
d = dev // not sure if i can do this lol
fmt.Printf("Old: %v,\nNew: %v \n", dev, d)
}
}
if ch == s.ReactorChan || ch == s.DevChan {
// hacky way to check if the device came from a listener of a current channel
s.DevBuf.Buf[dtype][d.Id] = d
}
}
func (s *StatusMonitor) Listen(ch chan *DeviceInfo) {
for dev := range ch {
if dev.Type == "Reactor" {
go s.UpdateBuffer(dev,"Reactor", ch)
} else {
go s.UpdateBuffer(dev, "Device", ch)
}
}
}
type InfoStream struct {
// base stream for any reactor/device
// NewSender embedds the channel to send updates on
@ -39,7 +155,8 @@ type listeners struct {
type lischan struct {
sync.WaitGroup
*StatusMonitor
WaitChan chan struct{}
StatusChan chan *DeviceInfo
}
type syslayout struct {
@ -59,15 +176,14 @@ func NewInfoStream() *InfoStream {
func (s *InfoStream) Start() {
// consistency
go s.Listener()
go s.Listen()
}
// goal is to hook every new manager into the reactor status chan
func (s *InfoStream) AddSender() *StatusMonitor {
sm := NewStatusMonitor(s.Stream) // give the channel we monitor for incoming updates
return sm
func (s *InfoStream) AddSender() chan *DeviceInfo {
return s.Stream
}
func (s *InfoStream) Listener() {
func (s *InfoStream) Listen() {
for {
deviceInfo := <-s.Stream
go s.Update(deviceInfo)
@ -87,7 +203,7 @@ func (s *InfoStream) Update(d *DeviceInfo) {
go s.Echo(d)
}
func (l *listener) Echo(d *DeviceInfo) {
func (l *listeners) Echo(d *DeviceInfo) {
l.RLock()
defer l.RUnlock()
// read only lock
@ -100,80 +216,46 @@ func (l *listener) Echo(d *DeviceInfo) {
}
}
func (s *InfoStream) AddListener(id uint32, ch chan *DeviceInfo) (map[uint32]*DeviceInfo, *StatusMonitor) {
s.listener.Lock()
s.Layout.Lock()
defer s.listner.Unlock()
defer s.Layout.Unlock()
if sm, ok l.listener.Listeners[id]; ok {
// listener already exists return nil
// going to delete and create a new one here just because f it
return s.Layout.Devs, sm
} else {
ch := make(chan *DeviceInfo)
sm := NewStatusMonitor(ch)
s.listener.Listeners[id] = sm
return s.Layout.Devs, sm
func (s *InfoStream) AddListener(id uint32, ch chan *DeviceInfo) map[uint32]*DeviceInfo {
// if i get a memory leak ill eat my shoe
s.listeners.Lock()
defer s.listeners.Unlock()
if lis, ok := s.listeners.Listeners[id]; ok {
// exists
go lis.Exit()
delete(s.listeners.Listeners,id)
}
s.listeners.Listeners[id] = &lischan{StatusChan:ch}
s.Layout.RLock()
defer s.Layout.RUnlock()
return s.Layout.Devs
}
func (l *listener) RemoveListener(id uint32) error {
func (l *listeners) RemoveListener(id uint32) {
l.Lock()
defer l.Unlock()
if lis, ok := l.Listeners[id]; !ok {
return errors.New("Listener doesn't exists!")
} else {
if lis, ok := l.Listeners[id]; ok {
go func(){
lis.Wait()
close(lis.WaitChan)
}()
go lis.Exit()
delete(l.Listeners,id)
}
return nil
}
func (l *lischan) Exit() {
for {
select {
case ls.Wait():
l.StatusChan.Close()
case <-l.WaitChan:
close(l.StatusChan)
break;
case <-l.StatusChan:
// dump buffer
}
}
//func (s *InfoStream) GetLayout() map[uint32]*DeviceInfo {
//s.Layout.RLock()
//defer s.Layout.RUnlock()
//return s.Layout.Devs
//}
// status buffer maintaince
type StatusMonitor struct {
// serve as base to embed in managers to send/receive device info
TransactionId chan uint32 // monotonically increases to track outdated reqs
StatusChan chan *DeviceInfo // sending reactor info in same fmt
sync.Mutex
}
func (s *StatusMonitor) Start() {
go s.GenerateIds()
}
func (s *StatusMonitor) GenerateIds() {
var id uint32
id = 0
for {
s.TransactionId <-id
id += 1
}
}
func (s *StatusMonitor) Send(d *DeviceInfo) {
d.TransactionId = <-s.TransactionId
logging.Debug(logging.DClient,"SYS 01 Updating %s Info (%s, %s)", d.Type, d.Status, d.Data)
s.StatusChan <-d
}
// now to tie it all together
// status buffer maintaince
type SystemViewer struct {
// stores system directory and provide methods to be embedded in managers
@ -183,7 +265,6 @@ type SystemViewer struct {
type ds struct {
Reactors map[uint32]*InfoStream //map from reactor id to its device info stream
Clients map[uint32]uint32 // maps tui ids to checked out reactor dev ids
sync.Mutex
}
@ -191,8 +272,7 @@ func NewSystemViewer() *SystemViewer {
rs := NewInfoStream()
s := &SystemViewer{ReactorStream:rs}
m := make(map[uint32]*InfoStream)
c := make(map[uint32]uint32)
s.DeviceStream = &ds{Reactors:m,Clients:c}
s.DeviceStream = &ds{Reactors:m}
return s
}
@ -200,11 +280,11 @@ func (s *SystemViewer) Start() {
go s.ReactorStream.Start()
}
func (s *SystemViewer) AddReactorSender() *StatusMonitor {
func (s *SystemViewer) AddReactorSender() chan *DeviceInfo {
return s.ReactorStream.AddSender()
}
func (s *SystemViewer) AddDeviceSender(reactorId uint32) *StatusMonitor {
func (s *SystemViewer) AddDeviceSender(reactorId uint32) chan *DeviceInfo {
s.DeviceStream.Lock()
defer s.DeviceStream.Unlock()
var ds *InfoStream
@ -217,40 +297,19 @@ func (s *SystemViewer) AddDeviceSender(reactorId uint32) *StatusMonitor {
return ds.AddSender()
}
func (s *SystemViewer) AddListener(tid uint32, rid ...uint32) (map[uint32]*DeviceInfo, *StatusMonitor) {
// adds status monitor as a listener and returns any already stored dev
// id serves as client id and limits them to one of each
var rid uint32
if len(ids) == 1 {
rid = uint32(ids[0])
} else if len(ids) != 0{
logging.Debug(logging.DError, "Too many arguements given to Add Listener")
os.Exit(1)
}
// id is either 0 or reactor we are interested in
rstatus, sm := s.ReactorStream.AddListener(id)
if sm
func (s *SystemViewer) GetBuffer(
/*
func (s *SystemViewer) GetReactorStatus() map[uint32]DeviceInfo {
devs := s.ReactorStream.GetLayout()
ret := make(map[uint32]DeviceInfo)
for id, dev := range devs {
ret[id] = *dev
func (s *SystemViewer) AddListener(id, rid uint32) (chan *DeviceInfo, map[uint32]*DeviceInfo) {
// returns a listener for that chan
ch := make(chan *DeviceInfo)
if rid != 0 {
return ch, s.DeviceStream.Reactors[rid].AddListener(id, ch)
} else {
return ch, s.ReactorStream.AddListener(id, ch)
}
return ret //value instead of ptr
}
func (s *SystemViewer) GetDeviceStatus(reactorId uint32) map[uint32]DeviceInfo {
func (s *SystemViewer) RemoveListener(tid, rid uint32) {
// removes chan for specific tid and rid
s.DeviceStream.Lock()
ds := s.DeviceStream.Reactors[reactorId]
s.DeviceStream.Unlock()
devs := ds.GetLayout()
ret := make(map[uint32]DeviceInfo)
for id, dev := range devs {
ret[id] = *dev
}
return ret
defer s.DeviceStream.Unlock()
go s.DeviceStream.Reactors[rid].RemoveListener(tid)
}
*/

@ -18,19 +18,12 @@ type TUIManager struct {
*Manager // embedded manager for access to methods and client
Ip string
Port *port
DevsMon *StatusMonitor // use it for all devs coming in
*SystemViewer
StatusMon *StatusMonitor // use it for all devs coming in
Err chan error
*DevBuffer
*Timeout
*pb.UnimplementedManagementServer
}
type DevBuffer struct {
Devs []map[uint32]*DeviceInfo
sync.Mutex
}
type Timeout struct {
Alert chan bool
LastSeen time.Time
@ -51,13 +44,7 @@ func NewTUIManager(ip string, c *Client, sys *SystemViewer, err chan error) Gene
t.Timeout = &Timeout{Alert:alert,TO:time.Duration(2500*time.Millisecond)} // short time outs are fine because we will just rejoin
t.Manager = m
t.Ip = ip
mon, buf := sys.AddListener()
t.DevsMon = mon
t.SystemViewer = sys
t.DevBuffer = &DevBuffer{Devs:[2]map[uint32]*DeviceInfo{})}
t.DevBuffer[0] = make(map[uint32]*DeviceInfo)
t.DevBuffer[1] = make(map[uint32]*DeviceInfo) // maps for reactors and devs
go t.UpdateBuffer(buf)
t.StatusMon = NewStatusMonitor("TUI",t.Id,sys)
return t
}
@ -66,7 +53,6 @@ func (t *TUIManager) Start(cl *Client) {
t.PingReset()
t.Manager.Start(cl)
logging.Debug(logging.DStart,"TMA %v starting", t.Id)
go t.DeviceListener()
go t.Timeoutd()
go t.Register() // begin tui server to respond to tui client reqs
//go t.Monitor(conn)
@ -131,62 +117,16 @@ func (t *TUIManager) GetPort() int {
}
// tui client requests and logic will be down here
func (t *TUIManager) DeviceListener() {
// called on start requests reactor info and buffers updates
for dev := range t.DevsMon.StatusChan {
go t.UpdateBuffer(dev)
}
}
func (d *DevBuffer) UpdateBuffer(dv *DeviceInfo) {
// TODO
// need a way to take incoming devices and only store most recent entry in the buffer
d.Lock()
defer d.Unlock()
if dv.Type == "Reactor" {
d.Devs[0][dv.Id] = dv
} else {
d.Devs[1][dv.Id] = dv
}
}
func (d *DevBuffer) EmptyBuffer() []*DeviceInfo {
// TODO
// need to grab the current buffer contents and empty them into the device reply
d.Lock()
defer d.Unlock()
ret := []*DeviceInfo{}
for _, mp := range d.Devs {
for _, dev := range mp {
ret = append(ret,dev)
}
}
d.Devs = []map[uint32]*DeviceInfo{}
return ret
}
func (t *TUIManager) AttachListener(id uint32) []*DeviceInfo {
// if a reactor is selected we need to
// empty the buffer
// get the dev info for the reactor
// add our devmon to the chan
func (t *TUIManager) GetDevices(ctx context.Context, req *pb.GetDevicesRequest) (*pb.GetDevicesResponse, error) {
go t.PingReset()
// doing 2 things, clearing reactor buffer and either
// a) clearing dev buffer
// b) killing old dev listener and getting new buffer
rid := req.GetReactorId()
devices := []*pb.Dev{}
resp := &pb.GetDevicesResponse{ClientId:t.Id,ReactorId:rid,Devices:devices}
var devs []*DeviceInfo
if rid != 0 {
// reactor requested
devs = t.AttachListener(rid)
} else {
devs = t.EmptyBuffer()
resp := &pb.GetDevicesResponse{ClientId:t.Id,Devices:devices}
if req.GetReactorId() > 0 || req.GetRefresh() {
resp.ReactorId = req.GetReactorId()
t.StatusMon.UpdateListener(t.Id, req.GetReactorId())
}
devs := t.StatusMon.GetBuffer() // always empty buffer
for _, v := range devs {
resp.Devices = append(resp.Devices, &pb.Dev{Id:v.Id,Type:v.Type,Status:v.Status,Data:v.Data,Index:v.Index})

@ -111,19 +111,16 @@ func (t *TUIClient) Connect() {
}
}
// going to redo this idk wtf i was thinking
// we just want a way to do two things
// a) get all devices when we first select a reactor
// b) ping the cs every 500ms-1s for updates and get back a list of devs that have changed
func (t *TUIClient) GetDevices(id ...uint32) (map[uint32]*Device, error) {
// returns
var rid uint32
if len(id) > 0 && id[0] != 0 {
rid = id[0]
req := &pb.GetDevicesRequest{ClientId:t.Id}
if len(id) > 0 {
if id[0] == 0 {
req.Refresh = true
} else {
req.ReactorId = id[0]
}
}
req := &pb.GetDevicesRequest{ClientId:t.Id,ReactorId:rid}
r := make(map[uint32]*Device)
client := pb.NewManagementClient(t.ClientConn)
resp, err := client.GetDevices(context.Background(), req)

@ -23,7 +23,6 @@ type Device struct {
type TUI struct {
*Display
//*LocalView
*TUIClient
SelectedReactor <-chan uint32
SelectedDevice <-chan uint32
@ -31,11 +30,7 @@ type TUI struct {
}
func NewTUI(ip string, port int, ifconfig string, ch chan error) *TUI {
//r := make(map[uint32]*Reactor)
t := &TUI{}
//l := new(LocalView)
//l.Reactors = r
//t.LocalView = l
t.Err = ch
client := NewTUIClient(ip, port, ifconfig)
t.TUIClient = client
@ -51,7 +46,6 @@ func (t *TUI) Start() {
go t.Monitor()
t.CreateDisplay()
t.Display.Start()
//go t.Refresh()
}
func (t *TUI) CreateDisplay() {
@ -79,7 +73,6 @@ func (t *TUI) Monitor() {
case reactor := <-t.SelectedReactor:
// reactor has been selected in tui, grabbing devs
t.App.QueueUpdateDraw(func() {
t.Display.DeviceList.Clear()
t.UpdateDevices(reactor)
})
logging.Debug(logging.DClient, "%v getting reactor devices", t.Id)
@ -98,21 +91,26 @@ func (t *TUI) Monitor() {
func (t *TUI) UpdateDevices(r ...uint32) {
// get devices for the reactor and update the tui
var id uint32
// see if there is a page being displayed
/*
if name, _ := t.Display.DevicePages.GetFrontPage(); name != "" {
if tmp, err := strconv.ParseUint(name, 10, 32); err != nil {
log.Fatal(err)
} else {
id = uint32(tmp)
}
}*/
// overwrite if called as a func
var devs map[uint32]*Device
var err error
if len(r) > 0 {
id = r[0]
// could be a reactor id or 1 for update reactors
if r[0] != 0 {
t.Display.DeviceList.Clear()
} else {
t.ReactorList.Clear()
t.ReactorList.AddItem("Refresh","Press (r) to refresh manually", 114, nil)
t.ReactorList.AddItem("Quit","Press (q) to quit",113,func() {
t.App.Stop()
os.Exit(0)
})
}
devs, err = t.TUIClient.GetDevices(r[0])
} else {
devs, err = t.TUIClient.GetDevices()
}
devs, err := t.TUIClient.GetDevices(id)
if err != nil {
log.Fatal(err)
}
@ -129,9 +127,6 @@ func (t *TUI) UpdateDevices(r ...uint32) {
}
t.DisplayDevices(devices)
t.DisplayReactors(reactors)
// } else {
// t.DisplayReactors(devs)
//}
}
// display struct and logic
@ -151,6 +146,7 @@ func NewDisplay(rc,dc chan uint32) *Display {
d.Flex = tview.NewFlex()
d.DeviceList = tview.NewList()
d.ReactorList = tview.NewList()
d.ReactorList.AddItem("Refresh","Press (r) to refresh manually", 114, nil)
d.ReactorList.AddItem("Quit","Press (q) to quit",113,func() {
d.App.Stop()
os.Exit(0)
@ -179,7 +175,7 @@ func (d *Display) DisplayReactors(r map[uint32]*Device) {
indx := int(reactor.Index)
for indx + 1 >= d.ReactorList.GetItemCount() {
// this prevent overwriting quit entry
d.ReactorList.InsertItem(-2,txt,reactor.Data,rune(48+d.ReactorList.GetItemCount()),nil)
d.ReactorList.InsertItem(-3,txt,reactor.Data,rune(47+d.ReactorList.GetItemCount()),nil)
}
if indx + 1 < d.ReactorList.GetItemCount() {
d.ReactorList.SetItemText(indx,txt,reactor.Data)
@ -201,31 +197,14 @@ func (d *Display) DisplayDevices(devs map[uint32]*Device) {
d.DeviceList.SetItemText(indx,txt,dev.Data)
}
}
/*
reactorPage := strconv.FormatUint(uint64(rid), 10)
var reactorList *tview.List
var ok bool
if reactorList, ok = d.DeviceList[reactorPage]; !ok {
reactorList = tview.NewList()//.ShowSecondaryText(false)
d.DeviceList[reactorPage] = reactorList
d.DevicePages.AddPage(reactorPage, reactorList, true, false)
}
//d.Unlock()
for _, dev := range devs {
txt := fmt.Sprintf("0x%x %v %v",dev.Id,dev.Status,dev.Type) // sensor alive at 0x0 data
if reactorList.GetItemCount() > int(dev.Index) {
reactorList.RemoveItem(int(dev.Index))
}
reactorList.InsertItem(int(dev.Index),txt,dev.Data,0,nil)
}
d.DevicePages.SwitchToPage(reactorPage)
*/
}
func (d *Display) SelectReactor(index int, main, data string, r rune) {
// called when reactor in list in selected
if main != "Quit" {
if main == "Refresh" {
// TODO
} else {
maintxt := strings.Split(main," ")
id := maintxt[0]
if id, err := strconv.ParseUint(id, 10, 32); err != nil {
@ -234,6 +213,7 @@ func (d *Display) SelectReactor(index int, main, data string, r rune) {
d.SelectedReactor <-uint32(id)
}
}
}
}
func (d *Display) SelectDevice(index int, main, data string, r rune) {

@ -0,0 +1,42 @@
alright time to do this correctly because this is brutal
7/18
DM -> RLC -> RM -> Sys -> TM -> TC
this basic struct will guide us
Work backwards to start from what the TC wants and work to how to deliver
TC
- wants to know what the overall reactor status are and the associated device status on selection
- its OK if this is a bit out of date, but probably want a synchronized view between clients
- could be a performance hit but f it
TM
Needs to:
- provide up to date information about the reactors connected and know which reactor is selected and provide updates for it
Relies on
- Needs a central struct, 2 methods for data
- call on request to query for ir
- keep its own copy and empty its buffer on request
- this is probably the best route
So TM really needs an intermediate struct a sort of device buffer
- I like the thing we had before with the channels and embedding but it needs to be fleshed out
All of this resides on the server which we can use to our advantage
Lets flesh out the TM a bit more
TM sys struct
this struct will attach itself to a channel and buffer updates for that channel
has to have a few methods
- GetBuffer() returns any new entries and empties the buffer
- ListenTo(reactorID) starts listening to a reactor and returns any devices on that branch so the client can refresh its list
- Refresh() forces the client to get all reactors and devices if listening to any branch
NewSysMonitor() has to return struct and current client status to load fortui client
this client will be given to a TUI at creation
TUI can then call associated commands to get updates for the client
TM sys struct just relies on underlying sys implementation which seems to be working south of the RM so i am just going to work on this TM sys struct for now
Loading…
Cancel
Save