protobuf interface update

This commit is contained in:
Uwe Seimet 2021-08-25 09:37:51 +02:00
parent 4f43b34204
commit 172b237983
3 changed files with 22 additions and 15 deletions

View File

@ -552,26 +552,26 @@ void GetDeviceTypeFeatures(PbServerInfo& serverInfo)
properties->set_supports_file(true); properties->set_supports_file(true);
types_properties = serverInfo.add_types_properties(); types_properties = serverInfo.add_types_properties();
types_properties->add_block_sizes(512);
types_properties->add_block_sizes(1024);
types_properties->add_block_sizes(2048);
types_properties->add_block_sizes(4096);
properties = types_properties->add_properties();
types_properties->set_type(SCHD); types_properties->set_type(SCHD);
properties = types_properties->add_properties();
properties->set_protectable(true); properties->set_protectable(true);
properties->set_supports_file(true); properties->set_supports_file(true);
properties->add_block_sizes(512);
properties->add_block_sizes(1024);
properties->add_block_sizes(2048);
properties->add_block_sizes(4096);
types_properties = serverInfo.add_types_properties(); types_properties = serverInfo.add_types_properties();
types_properties->add_block_sizes(512);
types_properties->add_block_sizes(1024);
types_properties->add_block_sizes(2048);
types_properties->add_block_sizes(4096);
properties = types_properties->add_properties();
types_properties->set_type(SCRM); types_properties->set_type(SCRM);
properties = types_properties->add_properties();
properties->set_protectable(true); properties->set_protectable(true);
properties->set_removable(true); properties->set_removable(true);
properties->set_lockable(true); properties->set_lockable(true);
properties->set_supports_file(true); properties->set_supports_file(true);
properties->add_block_sizes(512);
properties->add_block_sizes(1024);
properties->add_block_sizes(2048);
properties->add_block_sizes(4096);
types_properties = serverInfo.add_types_properties(); types_properties = serverInfo.add_types_properties();
properties = types_properties->add_properties(); properties = types_properties->add_properties();

View File

@ -61,6 +61,8 @@ message PbDeviceProperties {
bool lockable = 4; bool lockable = 4;
// Device supports image file // Device supports image file
bool supports_file = 5; bool supports_file = 5;
// List of supported block sizes
repeated uint32 block_sizes = 6;
} }
// The status of a device // The status of a device
@ -77,8 +79,6 @@ message PbDeviceStatus {
message PbDeviceTypeProperties { message PbDeviceTypeProperties {
PbDeviceType type = 1; PbDeviceType type = 1;
repeated PbDeviceProperties properties = 2; repeated PbDeviceProperties properties = 2;
// List of supported block sizes
repeated uint32 block_sizes = 3;
} }
// The image file data // The image file data

View File

@ -218,6 +218,8 @@ void CommandServerInfo(const string& hostname, int port)
PbDeviceTypeProperties types_properties = serverInfo.types_properties(i); PbDeviceTypeProperties types_properties = serverInfo.types_properties(i);
cout << " " << PbDeviceType_Name(types_properties.type()); cout << " " << PbDeviceType_Name(types_properties.type());
vector<int> block_sizes;
cout << " Properties: "; cout << " Properties: ";
if (types_properties.properties_size()) { if (types_properties.properties_size()) {
for (int j = 0; j < types_properties.properties_size(); j++) { for (int j = 0; j < types_properties.properties_size(); j++) {
@ -244,22 +246,27 @@ void CommandServerInfo(const string& hostname, int port)
cout << (has_property ? ", " : "") << "Image file support"; cout << (has_property ? ", " : "") << "Image file support";
} }
cout << endl; cout << endl;
for (int k = 0 ; k < properties.block_sizes_size(); k++)
{
block_sizes.push_back(properties.block_sizes(i));
}
} }
} }
else { else {
cout << "None" << endl; cout << "None" << endl;
} }
if (!types_properties.block_sizes_size()) { if (block_sizes.empty()) {
cout << " Block size is not configurable" << endl; cout << " Block size is not configurable" << endl;
} }
else { else {
cout << " Configurable block sizes: "; cout << " Configurable block sizes: ";
for (int j = 0; j < types_properties.block_sizes_size(); j++) { for (size_t j = 0; j < block_sizes.size(); j++) {
if (j) { if (j) {
cout << ", "; cout << ", ";
} }
cout << types_properties.block_sizes(j); cout << block_sizes.at(j);
} }
cout << endl; cout << endl;
} }