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

up v0.2.3 with new features to get information about network adapters #30

Merged
merged 8 commits into from
Apr 18, 2023
Merged
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
19 changes: 18 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,31 @@

# Changelog

## v0.2.2-BETA
## v0.2.3-BETA

### BScan

This is the latest version introduces the use of the module and its features.

<br>

## v0.2.3 [2023-04-18]

### Features

- [#30](https://github.com/BarcaWebCloud/bscan/pull/30): New features for windows. Gratitude @ahsouza!


### Release Notes

Add features for **Windows** platform:


- **Get Information All About Network Adapter** [only Windows on moment]
- **Get IP Address, MAC Address, Subnet, Gateway, DNS Hostname and more** [only Windows on moment]

<br>

## v0.2.2 [2023-04-15]

### Features
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# Barca, Inc., Vitória/ES, BRA | email: opensource@barca.com | GitHub: @BarcaWebCloud

cmake_minimum_required(VERSION 3.16)
project(bscan VERSION 0.2.2 DESCRIPTION "A library for collecting information about a computing device's Hardware & Software" HOMEPAGE_URL "https://store.barca.com/overview/modules/bscan" LANGUAGES CXX C)
project(bscan VERSION 0.2.3 DESCRIPTION "A library for collecting information about a computing device's Hardware & Software" HOMEPAGE_URL "https://store.barca.com/overview/modules/bscan" LANGUAGES CXX C)

message(STATUS "cmake version ${CMAKE_VERSION}\n\nproject: ${PROJECT_NAME}\nversion: ${PROJECT_VERSION}\ndescription: ${PROJECT_DESCRIPTION}\n${PROJECT_NAME}-api: https://api.bwc-${PROJECT_NAME}.com/v${PROJECT_VERSION_MAJOR}/")

Expand Down Expand Up @@ -266,7 +266,7 @@ find_path(_check_include
"hwares/scan_gpu.h",
"hwares/scan_mainboard.h",
"hwares/scan_monitor.h",
"hwares/scan_network.h",
"hwares/scan_net.h",
"hwares/scan_ram.h",
# softwares header
"swares/swares.h",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# BSCAN v0.2.2-beta
# BSCAN v0.2.3-beta

**BSCAN** is a library cross-platform that provides information about the **hardwares** and **softwares** where to have a computing device & **atmospheric environment**. Enabling developers to utilize digitization capabilities in their Web and mobile applications with their preferred languages ​​such as: *Python, JavaScript/TypeScript, JAVA, Ruby, PHP, GO, Rust* and more.

Expand Down
1 change: 1 addition & 0 deletions include/hwares/hwares.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@
#include "hwares/scan_mainboard.h"
#include "hwares/scan_ram.h"
#include "hwares/scan_network.h"
#include "hwares/scan_net.h"
9 changes: 9 additions & 0 deletions include/hwares/scan_battery.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ namespace bscan {
std::string& serialNumber();
std::string& technology();
uint32_t energyFull();
uint32_t energyNow();
uint32_t voltage();
uint32_t estimatedTime();

double capacity();

Expand All @@ -46,6 +49,9 @@ namespace bscan {
[[nodiscard]] std::string getSerialNumber() const;
[[nodiscard]] std::string getTechnology() const;
[[nodiscard]] uint32_t getEnergyFull() const;
[[nodiscard]] uint32_t getEnergyNow() const;
[[nodiscard]] uint32_t getVoltage() const;
[[nodiscard]] uint32_t getEstimatedTime() const;

[[nodiscard]] uint32_t energyNow() const;
[[nodiscard]] bool charging() const;
Expand All @@ -58,6 +64,9 @@ namespace bscan {
std::string _serialNumber;
std::string _technology;
uint32_t _energyFull = 0;
uint32_t _energyNow = 0;
uint32_t _voltage = 0;
uint32_t _estimatedTime = 0;
};

std::vector<Battery> getAllBatteries();
Expand Down
75 changes: 75 additions & 0 deletions include/hwares/scan_net.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/************************************************************************************

* Copyright (C) 2021 - 2023, Barca, Inc.

* Email: <opensource@barca.com> GitHub: @BarcaWebCloud.
* Project: BSCAN to scanner MotherBoards. CPU, Memory Ram, SO and more

* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://project-barca.github.io/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
**************************************************************************************/
#pragma once

#include <string>
#include <vector>

namespace bscan {

class Net {
friend std::vector<Net> getAllNets();

public:
Net(
std::string& name,
std::string& manufacturer,
std::string& permanentAddress,
std::string& dnsHostname,
std::string& serviceName,
std::string& driverPath,
std::string& status,
std::string& macAddress,
std::string& ipAddress,
std::string& subnet,
std::string& gateway
);
~Net() = default;

[[nodiscard]] const std::string& name() const;
[[nodiscard]] const std::string& manufacturer() const;
[[nodiscard]] const std::string& permanentAddress() const;
[[nodiscard]] const std::string& dnsHostname() const;
[[nodiscard]] const std::string& serviceName() const;
[[nodiscard]] const std::string& driverPath() const;
[[nodiscard]] const std::string& status() const;
[[nodiscard]] const std::string& macAddress() const;
[[nodiscard]] const std::string& ipAddress() const;
[[nodiscard]] const std::string& subnet() const;
[[nodiscard]] const std::string& gateway() const;

private:
Net() = default;
std::string _name;
std::string _manufacturer;
std::string _permanentAddress;
std::string _dnsHostname;
std::string _serviceName;
std::string _driverPath;
std::string _status;
std::string _macAddress;
std::string _ipAddress;
std::string _subnet;
std::string _gateway;
};

std::vector<Net> getAllNets();

};
20 changes: 20 additions & 0 deletions include/swares/scan_bios.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,18 @@ namespace bscan {
const std::string& sku,
const std::string& breachDescription,
const std::string& version,
const std::string& smbiosVersion,
const std::string& buildNumber,
const std::string& currentLanguage,
bool poweredOn,
bool hotSwappable,
bool removable,
bool replaceable,
bool audibleAlarm,
bool lockPresent,
bool visibleAlarm,
int64_t biosMajorVersion,
int64_t biosMinorVersion,
int64_t securityBreach,
int64_t heatGeneration,
int64_t numberOfPowerCords);
Expand All @@ -59,13 +64,18 @@ namespace bscan {
std::string& sku();
std::string& breachDescription();
std::string& version();
std::string& smbiosVersion();
std::string& buildNumber();
std::string& currentLanguage();
bool poweredOn();
bool hotSwappable();
bool removable();
bool replaceable();
bool audibleAlarm();
bool lockPresent();
bool visibleAlarm();
int64_t biosMajorVersion();
int64_t biosMinorVersion();
int64_t securityBreach();
int64_t heatGeneration();
int64_t numberOfPowerCords();
Expand All @@ -80,13 +90,18 @@ namespace bscan {
static std::string getSku();
static std::string getBreachDescription();
static std::string getVersion();
static std::string getSMBIOSVersion();
static std::string getBuildNumber();
static std::string getCurrentLanguage();
static bool getPoweredOn();
static bool getHotSwappable();
static bool getRemovable();
static bool getReplaceable();
static bool getAudibleAlarm();
static bool getLockPresent();
static bool getVisibleAlarm();
static int64_t getBiosMajorVersion();
static int64_t getBiosMinorVersion();
static int64_t getSecurityBreach();
static int64_t getHeatGeneration();
static int64_t getNumberOfPowerCords();
Expand All @@ -102,13 +117,18 @@ namespace bscan {
std::string& _sku;
std::string& _breachDescription;
std::string& _version;
std::string& _smbiosVersion;
std::string& _buildNumber;
std::string& _currentLanguage;
bool _poweredOn;
bool _hotSwappable;
bool _removable;
bool _replaceable;
bool _audibleAlarm;
bool _lockPresent;
bool _visibleAlarm;
int64_t _biosMajorVersion = -1;
int64_t _biosMinorVersion = -1;
int64_t _securityBreach = -1;
int64_t _heatGeneration = -1;
int64_t _numberOfPowerCords = -1;
Expand Down
1 change: 1 addition & 0 deletions include/swares/swares.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#pragma once

#include "swares/scan_system.h"
#include "swares/scan_bios.h"
#include "swares/scan_os.h"
#include "swares/scan_browser.h"
#include "swares/scan_datasource.h"
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bscan",
"version": "0.2.2",
"version": "0.2.3",
"description": " Library Cross-Platform that provides information about the Hardwares and Software of a Computing Device & Atmospheric Environment for NodeJS",
"keywords": [
"nodejs",
Expand Down
6 changes: 4 additions & 2 deletions src/libs/info/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ add_library(BScan
scan_temperature.cpp
scan_bios.cpp
scan_disk.cpp
scan_net.cpp
scan_browser.cpp
scan_datasource.cpp
# apple OS
Expand All @@ -25,7 +26,7 @@ add_library(BScan
linux/scan_ram.cpp
linux/scan_os.cpp
linux/scan_mainboard.cpp
linux/scan_network.cpp
linux/scan_net.cpp
linux/scan_disk.cpp
# windows OS
windows/scan_battery.cpp
Expand All @@ -36,9 +37,10 @@ add_library(BScan
windows/scan_bios.cpp
windows/scan_os.cpp
windows/scan_mainboard.cpp
windows/scan_network.cpp
windows/scan_net.cpp
windows/scan_disk.cpp
windows/scan_browser.cpp
windows/scan_net.cpp
windows/scan_datasource.cpp
)

Expand Down
21 changes: 21 additions & 0 deletions src/libs/info/scan_battery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,27 @@ namespace bscan {
return _energyFull;
}

uint32_t Battery::energyNow() {
if (_energyNow == 0) {
_energyNow = getEnergyNow();
}
return _energyNow;
}

uint32_t Battery::voltage() {
if (_voltage == 0) {
_voltage = getVoltage();
}
return _voltage;
}

uint32_t Battery::estimatedTime() {
if (_estimatedTime == 0) {
_estimatedTime = getEstimatedTime();
}
return _estimatedTime;
}

double Battery::capacity() { return static_cast<double>(energyNow()) / energyFull(); }

};
44 changes: 42 additions & 2 deletions src/libs/info/scan_bios.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ using namespace std;

namespace bscan {

BIOS::BIOS(const string& description, const std::string& name, const std::string& status, const std::string& manufacturer, const std::string& otherIdentifyingInfo, const std::string& partNumber, const std::string& serialNumber, const std::string& sku, const std::string& breachDescription, const std::string& version, bool poweredOn, bool hotSwappable, bool removable, bool replaceable, bool audibleAlarm, bool lockPresent, bool visibleAlarm, int64_t securityBreach, int64_t heatGeneration, int64_t numberOfPowerCords)
BIOS::BIOS(const string& description, const std::string& name, const std::string& status, const std::string& manufacturer, const std::string& otherIdentifyingInfo, const std::string& partNumber, const std::string& serialNumber, const std::string& sku, const std::string& breachDescription, const std::string& version, const std::string& smbiosVersion, const std::string& buildNumber, const std::string& currentLanguage, bool poweredOn, bool hotSwappable, bool removable, bool replaceable, bool audibleAlarm, bool lockPresent, bool visibleAlarm, int64_t securityBreach, int64_t heatGeneration, int64_t biosMajorVersion, int64_t biosMinorVersion, int64_t numberOfPowerCords)
: _description(_description),
_name(_name),
_status(_status),
Expand All @@ -44,7 +44,10 @@ namespace bscan {
_serialNumber(_serialNumber),
_sku(_sku),
_breachDescription(_breachDescription),
_version(_version) {
_version(_version),
_smbiosVersion(_smbiosVersion),
_buildNumber(_buildNumber),
_currentLanguage(_currentLanguage) {
_poweredOn = poweredOn,
_hotSwappable = hotSwappable,
_removable = removable,
Expand All @@ -53,6 +56,8 @@ namespace bscan {
_lockPresent = lockPresent,
_visibleAlarm = visibleAlarm,
_securityBreach = securityBreach,
_biosMajorVersion = biosMajorVersion,
_biosMinorVersion = biosMinorVersion,
_heatGeneration = heatGeneration,
_numberOfPowerCords = numberOfPowerCords;
}
Expand Down Expand Up @@ -127,6 +132,27 @@ namespace bscan {
return _version;
}

std::string& BIOS::smbiosVersion() {
if (_smbiosVersion.empty()) {
_smbiosVersion = getSMBIOSVersion();
}
return _smbiosVersion;
}

std::string& BIOS::buildNumber() {
if (_buildNumber.empty()) {
_buildNumber = getBuildNumber();
}
return _buildNumber;
}

std::string& BIOS::currentLanguage() {
if (_currentLanguage.empty()) {
_currentLanguage = getCurrentLanguage();
}
return _currentLanguage;
}

bool BIOS::poweredOn() {
_poweredOn = getPoweredOn();
return _poweredOn;
Expand Down Expand Up @@ -162,6 +188,20 @@ namespace bscan {
return _visibleAlarm;
}

int64_t BIOS::biosMajorVersion() {
if (_biosMajorVersion == -1) {
_biosMajorVersion = getBiosMajorVersion();
}
return _biosMajorVersion;
}

int64_t BIOS::biosMinorVersion() {
if (_biosMinorVersion == -1) {
_biosMinorVersion = getBiosMinorVersion();
}
return _biosMinorVersion;
}

int64_t BIOS::securityBreach() {
if (_securityBreach == -1) {
_securityBreach = getSecurityBreach();
Expand Down
Loading