This repository has been archived by the owner on Jul 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improving network hardware interface
- Loading branch information
1 parent
0aab17e
commit 689f643
Showing
19 changed files
with
324 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,8 @@ build_flags = | |
${env.build_flags} | ||
|
||
-D Arduino | ||
|
||
|
||
; Board | ||
|
||
-D Xila_Board_Hardware_Wireless_Tag_WT32_SC01 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/// @file Client.hpp | ||
/// @author Alix ANNERAUD ([email protected]) | ||
/// @brief | ||
/// @version 0.1.0 | ||
/// @date 05-08-2023 | ||
/// | ||
/// @copyright Copyright (c) 2023 | ||
|
||
#ifndef Xila_Network_Client_Hpp_Included | ||
#define Xila_Network_Client_Hpp_Included | ||
|
||
#include "Module/Module.hpp" | ||
|
||
namespace Xila_Namespace | ||
{ | ||
namespace Network_Types | ||
{ | ||
typedef class Client_Class : public Xila_Namespace::Stream_Type | ||
{ | ||
public: | ||
// - Methods | ||
|
||
// - - Constructors / destructors | ||
|
||
Client_Class(); | ||
~Client_Class(); | ||
|
||
virtual Result_Type Connect(const char* Host, Word_Type Port, int32_t Timeout = 30000) = 0; | ||
|
||
virtual void Stop() = 0; | ||
|
||
virtual bool Connected() = 0; | ||
|
||
virtual String_Type& Last_Error(String_Type& Error_Buffer) = 0; | ||
|
||
virtual void Set_Insecure() = 0; | ||
|
||
virtual void Set_Handshake_Timeout(uint32_t Timeout) = 0; | ||
virtual void Set_Timeout(uint32_t Timeout) = 0; | ||
|
||
virtual int Available() = 0; | ||
virtual int Peek() = 0; | ||
|
||
virtual int Read() = 0; | ||
virtual Size_Type Read_Bytes(Byte_Type* Buffer, Size_Type Length) = 0; | ||
virtual String_Type& Read_String(String_Type& String) = 0; | ||
|
||
virtual void Flush() = 0; | ||
|
||
virtual Size_Type Write(Byte_Type Byte) = 0; | ||
virtual Size_Type Write_Bytes(const Byte_Type* Buffer, Size_Type Length) = 0; | ||
virtual Size_Type Write_String(const char* String) = 0; | ||
|
||
virtual operator bool() = 0; | ||
|
||
virtual operator==(Client_Class& Client) = 0; | ||
virtual operator==(Client_Class& Client) = 0; | ||
|
||
private: | ||
|
||
void* Data; | ||
} Client_Type; | ||
} | ||
|
||
} | ||
|
||
#endif |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/// @file Interface.hpp | ||
/// @author Alix ANNERAUD ([email protected]) | ||
/// @brief | ||
/// @version 0.1.0 | ||
/// @date 04-08-2023 | ||
/// | ||
/// @copyright Copyright (c) 2023 | ||
|
||
#ifndef Xila_Interface_Hpp_Included | ||
#define Xila_Interface_Hpp_Included | ||
|
||
#include "IP_Address.hpp" | ||
#include "Client.hpp" | ||
|
||
namespace Xila_Namespace | ||
{ | ||
typedef class Network_Class Network_Type; | ||
|
||
namespace Network_Types | ||
{ | ||
enum class State_Type | ||
{ | ||
Disconnected, | ||
Connected, | ||
Connecting, | ||
Disconnecting, | ||
Error | ||
}; | ||
|
||
enum class Interface_Type_Type | ||
{ | ||
WiFi, | ||
Ethernet, | ||
Cellular | ||
}; | ||
|
||
typedef class Interface_Class | ||
{ | ||
protected: | ||
|
||
static Interface_Class* First_Instance_Pointer; | ||
Interface_Class* Next_Instance_Pointer; | ||
|
||
public: | ||
// - Methods | ||
|
||
// - - Constructor / Destructor | ||
|
||
Interface_Class(); | ||
~Interface_Class(); | ||
|
||
// - - | ||
|
||
virtual Result_Type Start() = 0; | ||
virtual Result_Type Stop() = 0; | ||
|
||
// - - Getters | ||
|
||
virtual State_Type Get_State() = 0; | ||
|
||
// - - - IP | ||
|
||
virtual IP_Address_Type Get_IP_Address(bool IPv6 = false) = 0; | ||
virtual IP_Address_Type Get_Gateway_IP_Address() = 0; | ||
virtual IP_Address_Type Get_DNS_IP_Address(Natural_Type Index) = 0; | ||
virtual Byte_Type Get_Subnet_CIDR() = 0; | ||
|
||
virtual Client_Class Create_Client() = 0; | ||
|
||
|
||
|
||
// - - Setters | ||
|
||
virtual void Set_State(State_Type State) = 0; | ||
|
||
/// @brief Set the network configuration. | ||
/// @param IP_Address IP address. | ||
/// @param Subnet_Mask Subnet mask. | ||
/// @param Gateway Gateway IP address. | ||
/// @param DNS_1_IP_Address First DNS IP address. | ||
/// @param DNS_2_IP_Address Second DNS IP address. | ||
/// @return `Result_Type::Success` if the network configuration has been set, `Result_Type::Error` otherwise. | ||
Result_Type Set_Configuration(IP_Address_Type IP_Address, IP_Address_Type Subnet_Mask, IP_Address_Type Gateway, IP_Address_Type DNS_1_IP_Address = static_cast<uint32_t>(0x00000000), IP_Address_Type DNS_2_IP_Address = static_cast<uint32_t>(0x00000000)); | ||
|
||
|
||
friend class Xila_Namespace::Network_Class; | ||
} Interface_Type; | ||
} | ||
} | ||
|
||
#endif // Xila_Interface_Hpp_Included |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.