mirror of
https://github.com/akuker/RASCSI.git
synced 2024-12-23 06:30:04 +00:00
Renaming
This commit is contained in:
parent
bf5289d30e
commit
fff119e9fd
@ -290,12 +290,12 @@ const PbDevices GetDevices()
|
||||
PbDeviceType_Parse(device->GetType(), &type);
|
||||
pbDevice->set_type(type);
|
||||
|
||||
PbDeviceFeatures *features = new PbDeviceFeatures();
|
||||
pbDevice->set_allocated_features(features);
|
||||
features->set_read_only(device->IsReadOnly());
|
||||
features->set_protectable(device->IsProtectable());
|
||||
features->set_removable(device->IsRemovable());
|
||||
features->set_lockable(device->IsLockable());
|
||||
PbDeviceProperties *properties = new PbDeviceProperties();
|
||||
pbDevice->set_allocated_properties(properties);
|
||||
properties->set_read_only(device->IsReadOnly());
|
||||
properties->set_protectable(device->IsProtectable());
|
||||
properties->set_removable(device->IsRemovable());
|
||||
properties->set_lockable(device->IsLockable());
|
||||
|
||||
PbDeviceStatus *status = new PbDeviceStatus();
|
||||
pbDevice->set_allocated_status(status);
|
||||
@ -334,7 +334,7 @@ const PbDevices GetDevices()
|
||||
PbImageFile *image_file = new PbImageFile();
|
||||
GetImageFile(image_file, device->IsRemovable() && !device->IsReady() ? "" : filepath.GetPath());
|
||||
pbDevice->set_allocated_file(image_file);
|
||||
features->set_supports_file(true);
|
||||
properties->set_supports_file(true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -546,54 +546,54 @@ void GetLogLevels(PbServerInfo& serverInfo)
|
||||
|
||||
void GetDeviceTypeFeatures(PbServerInfo& serverInfo)
|
||||
{
|
||||
PbDeviceTypeFeatures *types_features = serverInfo.add_types_features();
|
||||
PbDeviceFeatures *features = types_features->add_features();
|
||||
types_features->set_type(SAHD);
|
||||
features->set_supports_file(true);
|
||||
PbDeviceTypeProperties *types_properties = serverInfo.add_types_properties();
|
||||
PbDeviceProperties *properties = types_properties->add_properties();
|
||||
types_properties->set_type(SAHD);
|
||||
properties->set_supports_file(true);
|
||||
|
||||
types_features = serverInfo.add_types_features();
|
||||
types_features->add_block_sizes(512);
|
||||
types_features->add_block_sizes(1024);
|
||||
types_features->add_block_sizes(2048);
|
||||
types_features->add_block_sizes(4096);
|
||||
features = types_features->add_features();
|
||||
types_features->set_type(SCHD);
|
||||
features->set_protectable(true);
|
||||
features->set_supports_file(true);
|
||||
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);
|
||||
properties->set_protectable(true);
|
||||
properties->set_supports_file(true);
|
||||
|
||||
types_features = serverInfo.add_types_features();
|
||||
types_features->add_block_sizes(512);
|
||||
types_features->add_block_sizes(1024);
|
||||
types_features->add_block_sizes(2048);
|
||||
types_features->add_block_sizes(4096);
|
||||
features = types_features->add_features();
|
||||
types_features->set_type(SCRM);
|
||||
features->set_protectable(true);
|
||||
features->set_removable(true);
|
||||
features->set_lockable(true);
|
||||
features->set_supports_file(true);
|
||||
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);
|
||||
properties->set_protectable(true);
|
||||
properties->set_removable(true);
|
||||
properties->set_lockable(true);
|
||||
properties->set_supports_file(true);
|
||||
|
||||
types_features = serverInfo.add_types_features();
|
||||
features = types_features->add_features();
|
||||
types_features->set_type(SCMO);
|
||||
features->set_protectable(true);
|
||||
features->set_removable(true);
|
||||
features->set_lockable(true);
|
||||
features->set_supports_file(true);
|
||||
types_properties = serverInfo.add_types_properties();
|
||||
properties = types_properties->add_properties();
|
||||
types_properties->set_type(SCMO);
|
||||
properties->set_protectable(true);
|
||||
properties->set_removable(true);
|
||||
properties->set_lockable(true);
|
||||
properties->set_supports_file(true);
|
||||
|
||||
types_features = serverInfo.add_types_features();
|
||||
features = types_features->add_features();
|
||||
types_features->set_type(SCCD);
|
||||
features->set_read_only(true);
|
||||
features->set_removable(true);
|
||||
features->set_lockable(true);
|
||||
features->set_supports_file(true);
|
||||
types_properties = serverInfo.add_types_properties();
|
||||
properties = types_properties->add_properties();
|
||||
types_properties->set_type(SCCD);
|
||||
properties->set_read_only(true);
|
||||
properties->set_removable(true);
|
||||
properties->set_lockable(true);
|
||||
properties->set_supports_file(true);
|
||||
|
||||
types_features = serverInfo.add_types_features();
|
||||
types_features->set_type(SCBR);
|
||||
types_properties = serverInfo.add_types_properties();
|
||||
types_properties->set_type(SCBR);
|
||||
|
||||
types_features = serverInfo.add_types_features();
|
||||
types_features->set_type(SCDP);
|
||||
types_properties = serverInfo.add_types_properties();
|
||||
types_properties->set_type(SCDP);
|
||||
}
|
||||
|
||||
void GetAvailableImages(PbServerInfo& serverInfo)
|
||||
|
@ -49,8 +49,8 @@ enum PbOperation {
|
||||
UNPROTECT = 9;
|
||||
}
|
||||
|
||||
// The features supported by a device
|
||||
message PbDeviceFeatures {
|
||||
// The properties supported by a device
|
||||
message PbDeviceProperties {
|
||||
// Read-only medium (e.g. CD-ROMs) are not protectable but permanently read-only
|
||||
bool read_only = 1;
|
||||
// Medium can be write-protected
|
||||
@ -73,10 +73,10 @@ message PbDeviceStatus {
|
||||
bool locked = 3;
|
||||
}
|
||||
|
||||
// Device features by device type
|
||||
message PbDeviceTypeFeatures {
|
||||
// Device properties by device type
|
||||
message PbDeviceTypeProperties {
|
||||
PbDeviceType type = 1;
|
||||
repeated PbDeviceFeatures features = 2;
|
||||
repeated PbDeviceProperties properties = 2;
|
||||
// List of supported block sizes
|
||||
repeated uint32 block_sizes = 6;
|
||||
}
|
||||
@ -114,7 +114,7 @@ message PbDevice {
|
||||
int32 id = 1;
|
||||
int32 unit = 2;
|
||||
PbDeviceType type = 3;
|
||||
PbDeviceFeatures features = 4;
|
||||
PbDeviceProperties properties = 4;
|
||||
PbDeviceStatus status = 5;
|
||||
PbImageFile file = 6;
|
||||
string vendor = 7;
|
||||
@ -151,8 +151,8 @@ message PbServerInfo {
|
||||
repeated string available_log_levels = 2;
|
||||
string current_log_level = 3;
|
||||
string default_image_folder = 4;
|
||||
// Supported device types and their features
|
||||
repeated PbDeviceTypeFeatures types_features = 5;
|
||||
// Supported device types and their properties
|
||||
repeated PbDeviceTypeProperties types_properties = 5;
|
||||
// Files in the default folder
|
||||
repeated PbImageFile image_files = 6;
|
||||
// The attached devices
|
||||
|
@ -213,43 +213,53 @@ void CommandServerInfo(const string& hostname, int port)
|
||||
}
|
||||
}
|
||||
|
||||
cout << "Device types and their features:" << endl;
|
||||
for (int i = 0; i < serverInfo.types_features_size(); i++) {
|
||||
PbDeviceTypeFeatures type_features = serverInfo.types_features(i);
|
||||
cout << " " << PbDeviceType_Name(type_features.type());
|
||||
cout << "Device types and their properties:" << endl;
|
||||
for (int i = 0; i < serverInfo.types_properties_size(); i++) {
|
||||
PbDeviceTypeProperties types_properties = serverInfo.types_properties(i);
|
||||
cout << " " << PbDeviceType_Name(types_properties.type());
|
||||
|
||||
if (type_features.features_size()) {
|
||||
for (int j = 0; j < type_features.features_size(); j++) {
|
||||
PbDeviceFeatures features = type_features.features(j);
|
||||
if (features.read_only()) {
|
||||
cout << " Read-only";
|
||||
cout << " Properties: ";
|
||||
if (types_properties.properties_size()) {
|
||||
for (int j = 0; j < types_properties.properties_size(); j++) {
|
||||
bool has_feature = false;
|
||||
|
||||
PbDeviceProperties properties = types_properties.properties(j);
|
||||
if (properties.read_only()) {
|
||||
cout << "Read-only";
|
||||
has_feature = true;
|
||||
}
|
||||
if (features.protectable()) {
|
||||
cout << " Protectable";
|
||||
if (properties.protectable()) {
|
||||
cout << (has_feature ? ", " : "") << "Protectable";
|
||||
has_feature = true;
|
||||
}
|
||||
if (features.removable()) {
|
||||
cout << " Removable";
|
||||
if (properties.removable()) {
|
||||
cout << (has_feature ? ", " : "") << "Removable";
|
||||
has_feature = true;
|
||||
}
|
||||
if (features.lockable()) {
|
||||
cout << " Lockable";
|
||||
if (properties.lockable()) {
|
||||
cout << (has_feature ? ", " : "") << "Lockable";
|
||||
has_feature = true;
|
||||
}
|
||||
if (features.supports_file()) {
|
||||
cout << " Image file support";
|
||||
if (properties.supports_file()) {
|
||||
cout << (has_feature ? ", " : "") << "Image file support";
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
}
|
||||
else {
|
||||
cout << endl;
|
||||
cout << "None" << endl;
|
||||
}
|
||||
|
||||
if (type_features.block_sizes_size()) {
|
||||
cout << " Supported block sizes: ";
|
||||
for (int j = 0; j < type_features.block_sizes_size(); j++) {
|
||||
if (!types_properties.block_sizes_size()) {
|
||||
cout << " Block size is not configurable" << endl;
|
||||
}
|
||||
else {
|
||||
cout << " Configurable block sizes: ";
|
||||
for (int j = 0; j < types_properties.block_sizes_size(); j++) {
|
||||
if (j) {
|
||||
cout << ", ";
|
||||
}
|
||||
cout << type_features.block_sizes(j);
|
||||
cout << types_properties.block_sizes(j);
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ string ListDevices(const PbDevices& devices)
|
||||
|
||||
s << "| " << device.id() << " | " << device.unit() << " | " << PbDeviceType_Name(device.type()) << " | "
|
||||
<< (filename.empty() ? "NO MEDIA" : filename)
|
||||
<< (!device.status().removed() && (device.features().read_only() || device.status().protected_()) ? " (WRITEPROTECT)" : "")
|
||||
<< (!device.status().removed() && (device.properties().read_only() || device.status().protected_()) ? " (WRITEPROTECT)" : "")
|
||||
<< endl;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user