From ea5dab77bd928d35d568dd038dd48d4a2299361f Mon Sep 17 00:00:00 2001 From: loyaltyarm Date: Thu, 30 Mar 2017 23:28:18 -0700 Subject: [PATCH] marshal additional device fields (#132) --- device/device.go | 58 +++++-- device/internal/deviceproto/device.pb.go | 189 ++++++++++++++++++----- device/internal/deviceproto/device.proto | 12 ++ 3 files changed, 203 insertions(+), 56 deletions(-) diff --git a/device/device.go b/device/device.go index 16191aa1..9b92b67f 100644 --- a/device/device.go +++ b/device/device.go @@ -54,23 +54,35 @@ const ( func MarshalDevice(dev *Device) ([]byte, error) { protodev := deviceproto.Device{ - Uuid: dev.UUID, - Udid: dev.UDID, - SerialNumber: dev.SerialNumber, - OsVersion: dev.OSVersion, - BuildVersion: dev.BuildVersion, - ProductName: dev.ProductName, - Imei: dev.IMEI, - Meid: dev.MEID, - Token: dev.Token, - PushMagic: dev.PushMagic, - MdmTopic: dev.MDMTopic, - UnlockToken: dev.UnlockToken, - Enrolled: dev.Enrolled, - AwaitingConfiguration: dev.AwaitingConfiguration, - DeviceName: dev.DeviceName, - Model: dev.Model, - ModelName: dev.ModelName, + Uuid: dev.UUID, + Udid: dev.UDID, + SerialNumber: dev.SerialNumber, + OsVersion: dev.OSVersion, + BuildVersion: dev.BuildVersion, + ProductName: dev.ProductName, + Imei: dev.IMEI, + Meid: dev.MEID, + Token: dev.Token, + PushMagic: dev.PushMagic, + MdmTopic: dev.MDMTopic, + UnlockToken: dev.UnlockToken, + Enrolled: dev.Enrolled, + AwaitingConfiguration: dev.AwaitingConfiguration, + DeviceName: dev.DeviceName, + Model: dev.Model, + ModelName: dev.ModelName, + Description: dev.Description, + Color: dev.Color, + AssetTag: dev.AssetTag, + DepDevice: dev.DEPDevice, + DepProfileStatus: string(dev.DEPProfileStatus), + DepProfileUuid: dev.DEPProfileUUID, + DepProfileAssignTime: dev.DEPProfileAssignTime.UnixNano(), + DepProfilePushTime: dev.DEPProfilePushTime.UnixNano(), + DepProfileAssignedDate: dev.DEPProfileAssignedDate.UnixNano(), + DepProfileAssignedBy: dev.DEPProfileAssignedBy, + LastCheckIn: dev.LastCheckin.UnixNano(), + LastQueryResponse: dev.LastQueryResponse, } return proto.Marshal(&protodev) } @@ -97,5 +109,17 @@ func UnmarshalDevice(data []byte, dev *Device) error { dev.DeviceName = pb.GetDeviceName() dev.Model = pb.GetModel() dev.ModelName = pb.GetModelName() + dev.Description = pb.GetDescription() + dev.Color = pb.GetColor() + dev.AssetTag = pb.GetAssetTag() + dev.DEPDevice = pb.GetDepDevice() + dev.DEPProfileStatus = DEPProfileStatus(pb.GetDepProfileStatus()) + dev.DEPProfileUUID = pb.GetDepProfileUuid() + dev.DEPProfileAssignTime = time.Unix(0, pb.GetDepProfileAssignTime()).UTC() + dev.DEPProfilePushTime = time.Unix(0, pb.GetDepProfilePushTime()).UTC() + dev.DEPProfileAssignedDate = time.Unix(0, pb.GetDepProfileAssignedDate()).UTC() + dev.DEPProfileAssignedBy = pb.GetDepProfileAssignedBy() + dev.LastCheckin = time.Unix(0, pb.GetLastCheckIn()).UTC() + dev.LastQueryResponse = pb.GetLastQueryResponse() return nil } diff --git a/device/internal/deviceproto/device.pb.go b/device/internal/deviceproto/device.pb.go index 62b887ca..06d343f1 100644 --- a/device/internal/deviceproto/device.pb.go +++ b/device/internal/deviceproto/device.pb.go @@ -29,23 +29,35 @@ var _ = math.Inf const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package type Device struct { - Uuid string `protobuf:"bytes,1,opt,name=uuid" json:"uuid,omitempty"` - Udid string `protobuf:"bytes,2,opt,name=udid" json:"udid,omitempty"` - SerialNumber string `protobuf:"bytes,3,opt,name=serial_number,json=serialNumber" json:"serial_number,omitempty"` - OsVersion string `protobuf:"bytes,4,opt,name=os_version,json=osVersion" json:"os_version,omitempty"` - BuildVersion string `protobuf:"bytes,5,opt,name=build_version,json=buildVersion" json:"build_version,omitempty"` - ProductName string `protobuf:"bytes,6,opt,name=product_name,json=productName" json:"product_name,omitempty"` - Imei string `protobuf:"bytes,7,opt,name=imei" json:"imei,omitempty"` - Meid string `protobuf:"bytes,8,opt,name=meid" json:"meid,omitempty"` - Token string `protobuf:"bytes,9,opt,name=token" json:"token,omitempty"` - PushMagic string `protobuf:"bytes,10,opt,name=push_magic,json=pushMagic" json:"push_magic,omitempty"` - MdmTopic string `protobuf:"bytes,11,opt,name=mdm_topic,json=mdmTopic" json:"mdm_topic,omitempty"` - UnlockToken string `protobuf:"bytes,12,opt,name=unlock_token,json=unlockToken" json:"unlock_token,omitempty"` - Enrolled bool `protobuf:"varint,13,opt,name=enrolled" json:"enrolled,omitempty"` - AwaitingConfiguration bool `protobuf:"varint,14,opt,name=awaiting_configuration,json=awaitingConfiguration" json:"awaiting_configuration,omitempty"` - DeviceName string `protobuf:"bytes,15,opt,name=device_name,json=deviceName" json:"device_name,omitempty"` - Model string `protobuf:"bytes,16,opt,name=model" json:"model,omitempty"` - ModelName string `protobuf:"bytes,17,opt,name=model_name,json=modelName" json:"model_name,omitempty"` + Uuid string `protobuf:"bytes,1,opt,name=uuid" json:"uuid,omitempty"` + Udid string `protobuf:"bytes,2,opt,name=udid" json:"udid,omitempty"` + SerialNumber string `protobuf:"bytes,3,opt,name=serial_number,json=serialNumber" json:"serial_number,omitempty"` + OsVersion string `protobuf:"bytes,4,opt,name=os_version,json=osVersion" json:"os_version,omitempty"` + BuildVersion string `protobuf:"bytes,5,opt,name=build_version,json=buildVersion" json:"build_version,omitempty"` + ProductName string `protobuf:"bytes,6,opt,name=product_name,json=productName" json:"product_name,omitempty"` + Imei string `protobuf:"bytes,7,opt,name=imei" json:"imei,omitempty"` + Meid string `protobuf:"bytes,8,opt,name=meid" json:"meid,omitempty"` + Token string `protobuf:"bytes,9,opt,name=token" json:"token,omitempty"` + PushMagic string `protobuf:"bytes,10,opt,name=push_magic,json=pushMagic" json:"push_magic,omitempty"` + MdmTopic string `protobuf:"bytes,11,opt,name=mdm_topic,json=mdmTopic" json:"mdm_topic,omitempty"` + UnlockToken string `protobuf:"bytes,12,opt,name=unlock_token,json=unlockToken" json:"unlock_token,omitempty"` + Enrolled bool `protobuf:"varint,13,opt,name=enrolled" json:"enrolled,omitempty"` + AwaitingConfiguration bool `protobuf:"varint,14,opt,name=awaiting_configuration,json=awaitingConfiguration" json:"awaiting_configuration,omitempty"` + DeviceName string `protobuf:"bytes,15,opt,name=device_name,json=deviceName" json:"device_name,omitempty"` + Model string `protobuf:"bytes,16,opt,name=model" json:"model,omitempty"` + ModelName string `protobuf:"bytes,17,opt,name=model_name,json=modelName" json:"model_name,omitempty"` + Description string `protobuf:"bytes,18,opt,name=description" json:"description,omitempty"` + Color string `protobuf:"bytes,19,opt,name=color" json:"color,omitempty"` + AssetTag string `protobuf:"bytes,20,opt,name=asset_tag,json=assetTag" json:"asset_tag,omitempty"` + DepDevice bool `protobuf:"varint,21,opt,name=dep_device,json=depDevice" json:"dep_device,omitempty"` + DepProfileStatus string `protobuf:"bytes,22,opt,name=dep_profile_status,json=depProfileStatus" json:"dep_profile_status,omitempty"` + DepProfileUuid string `protobuf:"bytes,23,opt,name=dep_profile_uuid,json=depProfileUuid" json:"dep_profile_uuid,omitempty"` + DepProfileAssignTime int64 `protobuf:"varint,24,opt,name=dep_profile_assign_time,json=depProfileAssignTime" json:"dep_profile_assign_time,omitempty"` + DepProfilePushTime int64 `protobuf:"varint,25,opt,name=dep_profile_push_time,json=depProfilePushTime" json:"dep_profile_push_time,omitempty"` + DepProfileAssignedDate int64 `protobuf:"varint,26,opt,name=dep_profile_assigned_date,json=depProfileAssignedDate" json:"dep_profile_assigned_date,omitempty"` + DepProfileAssignedBy string `protobuf:"bytes,27,opt,name=dep_profile_assigned_by,json=depProfileAssignedBy" json:"dep_profile_assigned_by,omitempty"` + LastCheckIn int64 `protobuf:"varint,28,opt,name=last_check_in,json=lastCheckIn" json:"last_check_in,omitempty"` + LastQueryResponse []byte `protobuf:"bytes,29,opt,name=last_query_response,json=lastQueryResponse,proto3" json:"last_query_response,omitempty"` } func (m *Device) Reset() { *m = Device{} } @@ -172,6 +184,90 @@ func (m *Device) GetModelName() string { return "" } +func (m *Device) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (m *Device) GetColor() string { + if m != nil { + return m.Color + } + return "" +} + +func (m *Device) GetAssetTag() string { + if m != nil { + return m.AssetTag + } + return "" +} + +func (m *Device) GetDepDevice() bool { + if m != nil { + return m.DepDevice + } + return false +} + +func (m *Device) GetDepProfileStatus() string { + if m != nil { + return m.DepProfileStatus + } + return "" +} + +func (m *Device) GetDepProfileUuid() string { + if m != nil { + return m.DepProfileUuid + } + return "" +} + +func (m *Device) GetDepProfileAssignTime() int64 { + if m != nil { + return m.DepProfileAssignTime + } + return 0 +} + +func (m *Device) GetDepProfilePushTime() int64 { + if m != nil { + return m.DepProfilePushTime + } + return 0 +} + +func (m *Device) GetDepProfileAssignedDate() int64 { + if m != nil { + return m.DepProfileAssignedDate + } + return 0 +} + +func (m *Device) GetDepProfileAssignedBy() string { + if m != nil { + return m.DepProfileAssignedBy + } + return "" +} + +func (m *Device) GetLastCheckIn() int64 { + if m != nil { + return m.LastCheckIn + } + return 0 +} + +func (m *Device) GetLastQueryResponse() []byte { + if m != nil { + return m.LastQueryResponse + } + return nil +} + func init() { proto.RegisterType((*Device)(nil), "deviceproto.Device") } @@ -179,26 +275,41 @@ func init() { func init() { proto.RegisterFile("device.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 336 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x4c, 0x92, 0xc1, 0x4f, 0x2a, 0x31, - 0x10, 0xc6, 0xc3, 0x7b, 0xc0, 0xdb, 0x1d, 0x96, 0xf7, 0x9e, 0x0d, 0x9a, 0x46, 0x63, 0x44, 0xbd, - 0x70, 0xf2, 0x62, 0xfc, 0x0b, 0xf4, 0x2a, 0x07, 0x42, 0xbc, 0x36, 0x65, 0x5b, 0x71, 0xc2, 0xb6, - 0xdd,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x7a, 0xa7, 0x78, 0x70, 0xc5, 0xe1, 0x98, 0xad, - 0x69, 0xfc, 0x25, 0x14, 0xd6, 0xc7, 0xd0, 0x34, 0xd6, 0xc8, 0xe9, 0x7c, 0xb0, 0x28, 0x56, 0x27, - 0x2d, 0x9e, 0xe0, 0x42, 0x7f, 0x6a, 0xec, 0xd1, 0x6f, 0x55, 0x1d, 0xfc, 0x3b, 0x6e, 0x53, 0xd4, - 0x7d, 0xbe, 0xc4, 0x5f, 0x72, 0x9e, 0x1f, 0xbb, 0xcf, 0x3f, 0x9b, 0xe2, 0x06, 0x0e, 0xff, 0x1e, - 0x5f, 0xe4, 0x1f, 0xfd, 0x28, 0x30, 0xa2, 0x83, 0xcc, 0x60, 0xe4, 0x82, 0xb1, 0x8d, 0xfc, 0xcf, - 0x8b, 0x92, 0xc8, 0x8b, 0x52, 0xc1, 0xaf, 0xce, 0x78, 0x51, 0x22, 0xf9, 0xd1, 0x66, 0x4c, 0xdf, - 0xc2, 0xe3, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x44, 0xf1, 0x34, 0x8f, 0x28, 0x02, 0x00, 0x00, + // 565 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x94, 0x4f, 0x6f, 0x13, 0x31, + 0x10, 0xc5, 0x15, 0xda, 0xa6, 0x89, 0x93, 0x94, 0xd4, 0x4d, 0x52, 0xb7, 0xa5, 0x22, 0x94, 0x4b, + 0x0e, 0xa8, 0x12, 0x42, 0x3d, 0x70, 0x84, 0xf6, 0xc2, 0x81, 0xaa, 0x84, 0xc0, 0xd5, 0x72, 0xd6, + 0xd3, 0x8d, 0x95, 0xb5, 0xbd, 0xf8, 0x4f, 0x51, 0xbe, 0x3c, 0x42, 0x1e, 0xa7, 0x4d, 0x44, 0xb9, + 0x79, 0x7e, 0xf3, 0xde, 0x78, 0x66, 0xd6, 0x5a, 0xd2, 0x95, 0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, 0x09, 0x93, 0x33, 0xa5, 0x81, 0xbe, 0x27, 0xc3, + 0x6d, 0x1b, 0x3e, 0x0b, 0x34, 0x9d, 0xa0, 0x89, 0x6e, 0x4c, 0x77, 0xd1, 0x2f, 0xd0, 0xf2, 0x91, + 0x9c, 0x3c, 0xbf, 0x09, 0x24, 0x97, 0x22, 0x00, 0x3b, 0x45, 0xdb, 0xe8, 0xdf, 0xbb, 0x40, 0xde, + 0x88, 0x00, 0xff, 0x6f, 0x12, 0x24, 0x9f, 0xaf, 0xd8, 0x19, 0x4e, 0x35, 0x78, 0x6e, 0xfc, 0xbc, + 0xa2, 0x17, 0xa4, 0x57, 0x09, 0x1f, 0x78, 0xb1, 0x80, 0x62, 0xc9, 0x95, 0x61, 0xaf, 0xf0, 0x96, + 0x4e, 0x82, 0xd7, 0x89, 0x7d, 0x31, 0xf4, 0x92, 0x1c, 0xa1, 0xe6, 0x57, 0x04, 0xb7, 0xe2, 0x0e, + 0x7c, 0x6d, 0x8d, 0x07, 0x76, 0x3e, 0x6e, 0x4c, 0xba, 0xd3, 0xc3, 0x94, 0xfa, 0x96, 0x32, 0xd3, + 0x75, 0x62, 0xde, 0xc4, 0xff, 0xc0, 0x87, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xd4, 0x53, 0xe5, + 0xaa, 0x24, 0x04, 0x00, 0x00, } diff --git a/device/internal/deviceproto/device.proto b/device/internal/deviceproto/device.proto index eb649036..3737500a 100644 --- a/device/internal/deviceproto/device.proto +++ b/device/internal/deviceproto/device.proto @@ -21,5 +21,17 @@ message Device { string device_name = 15; string model = 16; string model_name =17; + string description =18; + string color =19; + string asset_tag =20; + bool dep_device =21; + string dep_profile_status =22; + string dep_profile_uuid =23; + int64 dep_profile_assign_time =24; + int64 dep_profile_push_time =25; + int64 dep_profile_assigned_date =26; + string dep_profile_assigned_by =27; + int64 last_check_in =28; + bytes last_query_response =29; }