Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #201

Merged
merged 5 commits into from
Jan 6, 2024
Merged

Dev #201

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions bin/main.dart
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import 'dart:io';

import 'package:cbj_integrations_controller/infrastructure/shared_variables.dart';
import 'package:cbj_integrations_controller/infrastructure/system_commands/system_commands_manager_d.dart';
import 'package:cbj_integrations_controller/integrations_controller.dart';
import 'package:cbj_smart_device/application/usecases/core_u/smart_device_manager_u.dart';
import 'package:cbj_smart_device/infrastructure/datasources/core_d/manage_physical_components/device_pin_manager.dart';
import 'package:cbj_smart_device/utils.dart';
import 'package:network_tools/network_tools.dart';

void main(List<String> arguments) async {
logger.i('Smart device is activated');

try {
configureNetworkTools('network_tools_db');
// configureNetworkTools('network_tools_db');
SystemCommandsManager();
SharedVariables()
.asyncConstructor(arguments.firstOrNull ?? Directory.current.path);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:cbj_integrations_controller/infrastructure/gen/cbj_smart_device_server/protoc_as_dart/cbj_smart_device_server.pbgrpc.dart';
import 'package:cbj_integrations_controller/integrations_controller.dart';
import 'package:cbj_smart_device/application/usecases/button_object_u/button_object_local_abstract.dart';
import 'package:cbj_smart_device/application/usecases/devices_pin_configuration_u/pin_information.dart';
import 'package:cbj_smart_device/application/usecases/smart_device_objects_u/abstracts_devices/smart_device_base.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:cbj_integrations_controller/infrastructure/gen/cbj_smart_device_server/protoc_as_dart/cbj_smart_device_server.pbgrpc.dart';
import 'package:cbj_integrations_controller/integrations_controller.dart';
import 'package:cbj_smart_device/application/usecases/button_object_u/simple_button_object.dart';
import 'package:cbj_smart_device/application/usecases/devices_pin_configuration_u/pin_information.dart';
import 'package:cbj_smart_device/application/usecases/wish_classes_u/off_wish_u.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:cbj_integrations_controller/infrastructure/gen/cbj_smart_device_server/protoc_as_dart/cbj_smart_device_server.pbgrpc.dart';
import 'package:cbj_integrations_controller/integrations_controller.dart';
import 'package:cbj_smart_device/application/usecases/devices_pin_configuration_u/pin_information.dart';
import 'package:cbj_smart_device/application/usecases/smart_device_objects_u/abstracts_devices/smart_device_base.dart';
import 'package:cbj_smart_device/application/usecases/smart_device_objects_u/abstracts_devices/smart_device_base_abstract.dart';
Expand Down Expand Up @@ -26,7 +26,6 @@ class ButtonObject extends SmartDeviceBaseAbstract {
@override
// ignore: overridden_fields
CbjDeviceTypes? smartDeviceType = CbjDeviceTypes.button;


/// The button will save list of states like on, off, long press, double tap.
/// For each button press state we save the smart object and the actions that
Expand Down Expand Up @@ -70,8 +69,7 @@ class ButtonObject extends SmartDeviceBaseAbstract {

/// Execute on button press
Future<String> executeOnButtonPress() async {
logger.i(
'Button number ${buttonPin?.pinAndPhysicalPinConfiguration}'
logger.i('Button number ${buttonPin?.pinAndPhysicalPinConfiguration}'
' was pressed');
pressStateCounter++;
if (pressStateCounter > 2) {
Expand Down
2 changes: 1 addition & 1 deletion lib/application/usecases/core_u/actions_to_preform_u.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:cbj_integrations_controller/infrastructure/gen/cbj_smart_device_server/protoc_as_dart/cbj_smart_device_server.pbgrpc.dart';
import 'package:cbj_integrations_controller/integrations_controller.dart';
import 'package:cbj_smart_device/application/usecases/smart_device_objects_u/abstracts_devices/smart_device_base.dart';

class ActionsToPreformU {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class SmartDeviceManagerU {
/// Setting up all the device from the memory
_setDevicesUseCase.setAllDevices(deviceList: smartDeviceFromDb);

logger.i('Device local IP: ${await getIps()}');
logger.i('Entity local IP: ${await getIps()}');

/// Start listen for in incoming connections from the local internet (LAN/Wifi)
_smartServerUseCase.waitForConnection(firebaseAccountsInformationD);
Expand Down
2 changes: 1 addition & 1 deletion lib/application/usecases/smart_client/smart_client.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:cbj_integrations_controller/infrastructure/gen/cbj_smart_device_server/protoc_as_dart/cbj_smart_device_server.pbgrpc.dart';
import 'package:cbj_integrations_controller/integrations_controller.dart';
import 'package:cbj_smart_device/application/usecases/smart_server_u/smart_server_u.dart';
import 'package:cbj_smart_device/utils.dart';
import 'package:grpc/grpc.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:cbj_integrations_controller/infrastructure/gen/cbj_smart_device_server/protoc_as_dart/cbj_smart_device_server.pbgrpc.dart';
import 'package:cbj_integrations_controller/integrations_controller.dart';
import 'package:cbj_smart_device/application/usecases/button_object_u/button_object_local_u.dart';
import 'package:cbj_smart_device/application/usecases/devices_pin_configuration_u/pin_information.dart';
import 'package:cbj_smart_device/application/usecases/smart_device_objects_u/abstracts_devices/smart_device_base_abstract.dart';
Expand Down Expand Up @@ -80,7 +80,7 @@ abstract class SmartDeviceBase extends SmartDeviceBaseAbstract {
/// Turn on the device basic action
String _setOn(PinInformation? pinNumber) {
// if (deviceInformation == null) {
// return 'Device information is missing, can't turn on';
// return 'Entity information is missing, can't turn on';
// }
OnWishU.setOn(deviceInformation, pinNumber);
onOff = true;
Expand All @@ -90,7 +90,7 @@ abstract class SmartDeviceBase extends SmartDeviceBaseAbstract {
/// Turn off the device basic action
String _setOff(PinInformation? pinNumber) {
// if (deviceInformation == null) {
// return 'Device information is missing, can't turn off';
// return 'Entity information is missing, can't turn off';
// }
OffWishU.setOff(deviceInformation, pinNumber);
onOff = false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:cbj_integrations_controller/infrastructure/gen/cbj_smart_device_server/protoc_as_dart/cbj_smart_device_server.pbgrpc.dart';
import 'package:cbj_integrations_controller/integrations_controller.dart';
import 'package:cbj_smart_device/application/usecases/devices_pin_configuration_u/pin_information.dart';
import 'package:cbj_smart_device/core/device_information.dart';
import 'package:cbj_smart_device/core/helper_methods.dart';
Expand Down Expand Up @@ -62,7 +62,6 @@ abstract class SmartDeviceBaseAbstract {

// Getters


/// Returning the non abstract of this object
Type getTheNonAbstractObjectOfThisInstance() {
return EnumHelper.getTheNonAbstractObjectOfSmartDeviceBaseAbstract(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:cbj_integrations_controller/infrastructure/gen/cbj_smart_device_server/protoc_as_dart/cbj_smart_device_server.pbgrpc.dart';
import 'package:cbj_integrations_controller/integrations_controller.dart';
import 'package:cbj_smart_device/application/usecases/smart_device_objects_u/abstracts_devices/smart_device_simple_abstract.dart';
import 'package:cbj_smart_device/application/usecases/wish_classes_u/dynamic_wish_u.dart';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:cbj_integrations_controller/infrastructure/gen/cbj_smart_device_server/protoc_as_dart/cbj_smart_device_server.pbgrpc.dart';
import 'package:cbj_integrations_controller/integrations_controller.dart';
import 'package:cbj_smart_device/application/usecases/smart_device_objects_u/abstracts_devices/smart_device_base.dart';

/// Abstract class for smart devices with on time property
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:cbj_integrations_controller/infrastructure/gen/cbj_smart_device_server/protoc_as_dart/cbj_smart_device_server.pbgrpc.dart';
import 'package:cbj_integrations_controller/integrations_controller.dart';
import 'package:cbj_smart_device/application/usecases/smart_device_objects_u/abstracts_devices/smart_device_base.dart';
import 'package:cbj_smart_device/utils.dart';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:cbj_integrations_controller/infrastructure/gen/cbj_smart_device_server/protoc_as_dart/cbj_smart_device_server.pbgrpc.dart';
import 'package:cbj_integrations_controller/integrations_controller.dart';
import 'package:cbj_smart_device/application/usecases/button_object_u/button_object_local_u.dart';
import 'package:cbj_smart_device/application/usecases/devices_pin_configuration_u/pin_information.dart';
import 'package:cbj_smart_device/application/usecases/smart_device_objects_u/abstracts_devices/smart_device_simple_abstract.dart';
Expand Down Expand Up @@ -76,8 +76,7 @@ class BoilerObject extends SmartDeviceSimpleAbstract {
}

if (wishExecuteResult != null) {
if (deviceState != CbjDeviceStateGRPC.ack) {
}
if (deviceState != CbjDeviceStateGRPC.ack) {}
return wishExecuteResult;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:cbj_integrations_controller/infrastructure/gen/cbj_smart_device_server/protoc_as_dart/cbj_smart_device_server.pbgrpc.dart';
import 'package:cbj_integrations_controller/integrations_controller.dart';
import 'package:cbj_smart_device/application/usecases/smart_device_objects_u/abstracts_devices/smart_device_simple_abstract.dart';
import 'package:cbj_smart_device/utils.dart';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:cbj_integrations_controller/infrastructure/gen/cbj_smart_device_server/protoc_as_dart/cbj_smart_device_server.pbgrpc.dart';
import 'package:cbj_integrations_controller/integrations_controller.dart';
import 'package:cbj_smart_device/application/usecases/smart_device_objects_u/abstracts_devices/smart_device_simple_abstract.dart';
import 'package:cbj_smart_device/utils.dart';

Expand All @@ -19,7 +19,6 @@ class SmartCameraObject extends SmartDeviceSimpleAbstract {
@override
List<String> getNeededPinTypesList() => <String>[];


/// Return smart device type
@override
CbjDeviceTypes getDeviceType() => CbjDeviceTypes.smart_camera;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:cbj_integrations_controller/infrastructure/gen/cbj_smart_device_server/protoc_as_dart/cbj_smart_device_server.pbgrpc.dart';
import 'package:cbj_integrations_controller/integrations_controller.dart';
import 'package:cbj_smart_device/application/usecases/smart_device_objects_u/abstracts_devices/smart_device_simple_abstract.dart';
import 'package:cbj_smart_device/utils.dart';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:cbj_integrations_controller/infrastructure/gen/cbj_smart_device_server/protoc_as_dart/cbj_smart_device_server.pbgrpc.dart';
import 'package:cbj_integrations_controller/integrations_controller.dart';
import 'package:cbj_smart_device/application/usecases/button_object_u/button_object_local_u.dart';
import 'package:cbj_smart_device/application/usecases/devices_pin_configuration_u/pin_information.dart';
import 'package:cbj_smart_device/application/usecases/smart_device_objects_u/abstracts_devices/smart_device_static_abstract.dart';
Expand Down
3 changes: 1 addition & 2 deletions lib/application/usecases/smart_server_u/smart_server_u.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import 'dart:async';
import 'dart:io';

import 'package:cbj_integrations_controller/infrastructure/gen/cbj_smart_device_server/protoc_as_dart/cbj_smart_device_server.pbgrpc.dart';
import 'package:cbj_integrations_controller/infrastructure/system_commands/system_commands_manager_d.dart';
import 'package:cbj_integrations_controller/integrations_controller.dart';
import 'package:cbj_smart_device/application/usecases/core_u/actions_to_preform_u.dart';
import 'package:cbj_smart_device/application/usecases/smart_device_objects_u/abstracts_devices/smart_device_base.dart';
import 'package:cbj_smart_device/application/usecases/smart_device_objects_u/abstracts_devices/smart_device_base_abstract.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/application/usecases/wish_classes_u/on_wish_u.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class OnWishU {
case final RemoteDevice type:
return setOnRemote(type, pinNumber);
}
logger.i('Device type ${deviceInformation.name} is not specified ');
logger.i('Entity type ${deviceInformation.name} is not specified ');

return 'DeviceBase type not supported';
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:cbj_integrations_controller/infrastructure/system_commands/system_commands_manager_d.dart';
import 'package:cbj_integrations_controller/integrations_controller.dart';
import 'package:cbj_smart_device/core/device_information.dart';

/// Class to change wish on status to device
Expand Down
3 changes: 1 addition & 2 deletions lib/core/my_singleton.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:cbj_integrations_controller/infrastructure/system_commands/system_commands_manager_d.dart';
import 'package:cbj_integrations_controller/integrations_controller.dart';
import 'package:cbj_smart_device/application/usecases/smart_device_objects_u/abstracts_devices/smart_device_base_abstract.dart';

class MySingleton {
Expand All @@ -23,7 +23,6 @@ class MySingleton {
Future<String?> getCurrentUserName() =>
_currentUserName ??= SystemCommandsManager().getCurrentUserName();


void addToSmartDevicesList(SmartDeviceBaseAbstract smartDeviceVal) {
smartDevicesList.add(smartDeviceVal);
}
Expand Down
1 change: 0 additions & 1 deletion lib/core/permissions/permissions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ class Permission {
bool read = false;
bool write = false;
bool execute = false;

}
1 change: 0 additions & 1 deletion lib/core/permissions/permissions_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@ class PermissionsManager {
// Set

// Get

}
4 changes: 2 additions & 2 deletions lib/domain/entities/core_e/enums_e.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:cbj_integrations_controller/infrastructure/gen/cbj_smart_device_server/protoc_as_dart/cbj_smart_device_server.pbgrpc.dart';
import 'package:cbj_integrations_controller/integrations_controller.dart';
import 'package:cbj_smart_device/application/usecases/button_object_u/button_with_light_object.dart';
import 'package:cbj_smart_device/application/usecases/button_object_u/simple_button_object.dart';
import 'package:cbj_smart_device/application/usecases/smart_device_objects_u/abstracts_devices/smart_device_base_abstract.dart';
Expand All @@ -24,7 +24,7 @@ import 'package:cbj_smart_device/utils.dart';
// Speakers,
//
// /// Cleaning robot
// Roomba,
// Areaba,
//
// /// Give water to plants
// Irrigation,
Expand Down
2 changes: 1 addition & 1 deletion lib/domain/entities/set_devices_e/set_devices_e.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:cbj_integrations_controller/infrastructure/gen/cbj_smart_device_server/protoc_as_dart/cbj_smart_device_server.pbgrpc.dart';
import 'package:cbj_integrations_controller/integrations_controller.dart';
import 'package:cbj_smart_device/application/usecases/button_object_u/button_with_light_object.dart';
import 'package:cbj_smart_device/application/usecases/button_object_u/simple_button_object.dart';
import 'package:cbj_smart_device/application/usecases/devices_pin_configuration_u/pin_information.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:cbj_integrations_controller/infrastructure/gen/cbj_smart_device_server/protoc_as_dart/cbj_smart_device_server.pbgrpc.dart';
import 'package:cbj_integrations_controller/infrastructure/system_commands/system_commands_manager_d.dart';
import 'package:cbj_integrations_controller/integrations_controller.dart';
import 'package:cbj_smart_device/application/usecases/button_object_u/button_with_light_object.dart';
import 'package:cbj_smart_device/application/usecases/button_object_u/simple_button_object.dart';
import 'package:cbj_smart_device/application/usecases/devices_pin_configuration_u/device_configuration_base_class.dart';
Expand Down Expand Up @@ -148,7 +147,7 @@ class DevicePinListManager extends DevicePinListManagerAbstract {
default:
{
logger.i('Detected deviceHostName $deviceHostName \n'
'Device is not supported, the software will not be able to '
'Entity is not supported, the software will not be able to '
'control the pins.');
break;
}
Expand All @@ -171,7 +170,9 @@ class DevicePinListManager extends DevicePinListManagerAbstract {
try {
final int isGpioFree = physicalDevice!.isGpioPinFree(pinNumber);
if (isGpioFree != 0) {
logger.i('Gpio $pinNumber is not free, exist with error code $isGpioFree');
logger.i(
'Gpio $pinNumber is not free, exist with error code $isGpioFree',
);
return null;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'dart:io';

import 'package:cbj_integrations_controller/infrastructure/shared_variables.dart';
import 'package:cbj_integrations_controller/integrations_controller.dart';

class ListenToPinHighWiringPiSetupPhys {
/// Listen to button press once and return exist code
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'dart:io';

import 'package:cbj_integrations_controller/infrastructure/shared_variables.dart';
import 'package:cbj_integrations_controller/integrations_controller.dart';

class TurnPinOffWiringPiSetup {
Future<ProcessResult> turnThePinOff(String physicalPinNumber) async {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'dart:io';

import 'package:cbj_integrations_controller/infrastructure/shared_variables.dart';
import 'package:cbj_integrations_controller/integrations_controller.dart';

class TurnPinOffWiringPiSetupGpio {
Future<ProcessResult> turnThePinOff(String physicalPinNumber) async {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'dart:io';

import 'package:cbj_integrations_controller/infrastructure/shared_variables.dart';
import 'package:cbj_integrations_controller/integrations_controller.dart';

class TurnPinOffWiringPiSetupPhys {
Future<ProcessResult> turnThePinOff(String physicalPinNumber) async {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'dart:io';

import 'package:cbj_integrations_controller/infrastructure/shared_variables.dart';
import 'package:cbj_integrations_controller/integrations_controller.dart';

class TurnPinOffWiringPiSetupSys {
Future<ProcessResult> turnThePinOff(String physicalPinNumber) async {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'dart:io';

import 'package:cbj_integrations_controller/infrastructure/shared_variables.dart';
import 'package:cbj_integrations_controller/integrations_controller.dart';

class TurnPinOnWiringPiSetup {
Future<ProcessResult> turnThePinOn(String physicalPinNumber) async {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'dart:io';

import 'package:cbj_integrations_controller/infrastructure/shared_variables.dart';
import 'package:cbj_integrations_controller/integrations_controller.dart';

class TurnPinOnWiringPiSetupGpio {
Future<ProcessResult> turnThePinOn(String physicalPinNumber) async {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'dart:io';

import 'package:cbj_integrations_controller/infrastructure/shared_variables.dart';
import 'package:cbj_integrations_controller/integrations_controller.dart';

class TurnPinOnWiringPiSetupPhys {
Future<ProcessResult> turnThePinOn(String physicalPinNumber) async {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'dart:io';

import 'package:cbj_integrations_controller/infrastructure/shared_variables.dart';
import 'package:cbj_integrations_controller/integrations_controller.dart';

class TurnPinOnWiringPiSetupSys {
Future<ProcessResult> turnThePinOn(String physicalPinNumber) async {
Expand Down
2 changes: 1 addition & 1 deletion lib/infrastructure/datasources/hive_d/hive_d.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:cbj_integrations_controller/infrastructure/system_commands/system_commands_manager_d.dart';
import 'package:cbj_integrations_controller/integrations_controller.dart';
import 'package:cbj_smart_device/core/my_singleton.dart';
import 'package:cbj_smart_device/infrastructure/datasources/hive_d/hive_objects_d/isar_database_information_d.dart';
import 'package:cbj_smart_device/infrastructure/datasources/hive_d/hive_objects_d/isar_devices_d.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/infrastructure/datasources/local_db_d/local_db_d.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:cbj_integrations_controller/infrastructure/gen/cbj_smart_device_server/protoc_as_dart/cbj_smart_device_server.pbgrpc.dart';
import 'package:cbj_integrations_controller/integrations_controller.dart';
import 'package:cbj_smart_device/application/usecases/button_object_u/button_with_light_object.dart';
import 'package:cbj_smart_device/application/usecases/button_object_u/simple_button_object.dart';
import 'package:cbj_smart_device/application/usecases/smart_device_objects_u/abstracts_devices/smart_device_base_abstract.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:cbj_integrations_controller/infrastructure/system_commands/system_commands_manager_d.dart';
import 'package:cbj_integrations_controller/integrations_controller.dart';

class SetDevicesD {
Future<String> getCurrentDeviceUUid() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:cbj_integrations_controller/infrastructure/system_commands/system_commands_manager_d.dart';
import 'package:cbj_integrations_controller/integrations_controller.dart';

class SmartDeviceObjectsD {
static Future<String> getUuid() {
Expand Down
Loading