3 unstable releases
0.2.0 | Oct 18, 2024 |
---|---|
0.1.1 | Oct 18, 2024 |
0.1.0 | Oct 18, 2024 |
#1517 in Network programming
52 downloads per month
28KB
579 lines
zte-cpe-rs
🚀 A Rust library for interacting with ZTE devices, such as the GigaCube ZTE MF289F.
Supported Devices
- GigaCube ZTE MF289F
Features
- 🔄 Device Reboot
- 📊 Device Status Information / Monitoring
- 📡 Connect and Disconnect Network
- 🔀 Set Connection Mode
- 🛡️ Set Bearer Preference
- 🔒 Set LTE Band Lock
- 🌐 Set DNS mode configuration
- 📶 Set WiFi Coverage
- 🔌 Configure UPnP
- 🌐 Configure DMZ
- ♻️ Manage Auto Update
More features coming soon...
Installation
Add this to your Cargo.toml
:
[dependencies]
zte-cpe-rs = "0.2.0"
Usage
Here's a basic example of how to use zte-cpe-rs
:
use std::collections::HashSet;
use anyhow::{Context, Result};
use zte_cpe_rs::{bands::LteBand, ZteClient};
#[tokio::main]
async fn main() -> Result<()> {
let mut zte_client = ZteClient::new("giga.cube")
.context("Failed to create ZteClient")?;
// Login
zte_client.login("YOURPASSWORD".to_string())
.await
.context("Failed to login")?;
// Disconnect network
zte_client.disconnect_network().await?;
// Connect network
zte_client.connect_network().await?;
// Get status
println!("{}", zte_client.get_status().await?);
// Set LTE band
let mut bands = HashSet::new();
bands.insert(LteBand::Band1);
bands.insert(LteBand::Band3);
bands.insert(LteBand::Band7);
zte_client.select_lte_band(Some(bands))
.await?;
// Logout
zte_client.logout().await?;
Ok(())
}
Contributing
We welcome contributions! To get started, follow these steps:
- Fork the repository: Click the "Fork" button at the top right of this page.
- Clone your fork:
git clone https://github.com/yourusername/zte-cpe-rs.git cd zte-cpe-rs
- Create a new branch:
git checkout -b feature/your-feature-name
- Make your changes: Implement your feature or fix the bug.
- Commit your changes:
git commit -am 'Add a meaningful commit message'
- Push to your branch:
git push origin feature/your-feature-name
- Open a Pull Request: Go to the original repository and click the "New Pull Request" button.
Please ensure your code adheres to the project's coding standards and includes appropriate tests.
Thank you for your contributions!
Setup
Clone the repository:
git clone https://github.com/1zun4/zte-cpe-rs.git
cd zte-cpe-rs
Build the project:
cargo build
Run tests:
cargo test
Acknowledgements
This project was inspired by and uses code from:
License
This project is licensed under the GNU GENERAL PUBLIC LICENSE.
Dependencies
~5–18MB
~248K SLoC