Skip to content

Commit

Permalink
Expose rs-matter's as matter_rs
Browse files Browse the repository at this point in the history
Then `s/rs-matter::/matter_rs::/g`.
  • Loading branch information
MabezDev committed Oct 2, 2023
1 parent e39fd18 commit 5bb6584
Show file tree
Hide file tree
Showing 19 changed files with 66 additions and 62 deletions.
4 changes: 2 additions & 2 deletions examples/onoff_light/src/dev_att.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
* limitations under the License.
*/

use rs_matter::data_model::sdm::dev_att::{DataType, DevAttDataFetcher};
use rs_matter::error::{Error, ErrorCode};
use matter_rs::data_model::sdm::dev_att::{DataType, DevAttDataFetcher};
use matter_rs::error::{Error, ErrorCode};

pub struct HardCodedDevAtt {}

Expand Down
42 changes: 21 additions & 21 deletions examples/onoff_light/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ use core::pin::pin;

use embassy_futures::select::select3;
use log::info;
use rs_matter::core::{CommissioningData, Matter};
use rs_matter::data_model::cluster_basic_information::BasicInfoConfig;
use rs_matter::data_model::cluster_on_off;
use rs_matter::data_model::device_types::DEV_TYPE_ON_OFF_LIGHT;
use rs_matter::data_model::objects::*;
use rs_matter::data_model::root_endpoint;
use rs_matter::data_model::system_model::descriptor;
use rs_matter::error::Error;
use rs_matter::mdns::{MdnsRunBuffers, MdnsService};
use rs_matter::secure_channel::spake2p::VerifierData;
use rs_matter::transport::core::RunBuffers;
use rs_matter::transport::network::{Ipv4Addr, Ipv6Addr, NetworkStack};
use rs_matter::utils::select::EitherUnwrap;
use matter_rs::core::{CommissioningData, Matter};
use matter_rs::data_model::cluster_basic_information::BasicInfoConfig;
use matter_rs::data_model::cluster_on_off;
use matter_rs::data_model::device_types::DEV_TYPE_ON_OFF_LIGHT;
use matter_rs::data_model::objects::*;
use matter_rs::data_model::root_endpoint;
use matter_rs::data_model::system_model::descriptor;
use matter_rs::error::Error;
use matter_rs::mdns::{MdnsRunBuffers, MdnsService};
use matter_rs::secure_channel::spake2p::VerifierData;
use matter_rs::transport::core::RunBuffers;
use matter_rs::transport::network::{Ipv4Addr, Ipv6Addr, NetworkStack};
use matter_rs::utils::select::EitherUnwrap;

mod dev_att;

Expand Down Expand Up @@ -81,26 +81,26 @@ fn run() -> Result<(), Error> {
let dev_att = dev_att::HardCodedDevAtt::new();

#[cfg(feature = "std")]
let epoch = rs_matter::utils::epoch::sys_epoch;
let epoch = matter_rs::utils::epoch::sys_epoch;

#[cfg(feature = "std")]
let rand = rs_matter::utils::rand::sys_rand;
let rand = matter_rs::utils::rand::sys_rand;

// NOTE (no_std): For no_std, provide your own function here
#[cfg(not(feature = "std"))]
let epoch = rs_matter::utils::epoch::dummy_epoch;
let epoch = matter_rs::utils::epoch::dummy_epoch;

// NOTE (no_std): For no_std, provide your own function here
#[cfg(not(feature = "std"))]
let rand = rs_matter::utils::rand::dummy_rand;
let rand = matter_rs::utils::rand::dummy_rand;

let mdns = MdnsService::new(
0,
"rs-matter-demo",
ipv4_addr.octets(),
Some((ipv6_addr.octets(), interface)),
&dev_det,
rs_matter::MATTER_PORT,
matter_rs::MATTER_PORT,
);

info!("mDNS initialized");
Expand All @@ -112,13 +112,13 @@ fn run() -> Result<(), Error> {
&mdns,
epoch,
rand,
rs_matter::MATTER_PORT,
matter_rs::MATTER_PORT,
);

info!("Matter initialized");

#[cfg(all(feature = "std", not(target_os = "espidf")))]
let mut psm = rs_matter::persist::Psm::new(&matter, std::env::temp_dir().join("rs-matter"))?;
let mut psm = matter_rs::persist::Psm::new(&matter, std::env::temp_dir().join("rs-matter"))?;

let handler = HandlerCompat(handler(&matter));

Expand Down Expand Up @@ -226,7 +226,7 @@ fn initialize_logger() {
fn initialize_network() -> Result<(Ipv4Addr, Ipv6Addr, u32), Error> {
use log::error;
use nix::{net::if_::InterfaceFlags, sys::socket::SockaddrIn6};
use rs_matter::error::ErrorCode;
use matter_rs::error::ErrorCode;

let interfaces = || {
nix::ifaddrs::getifaddrs().unwrap().filter(|ia| {
Expand Down
4 changes: 2 additions & 2 deletions examples/speaker/src/dev_att.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
* limitations under the License.
*/

use rs_matter::data_model::sdm::dev_att::{DataType, DevAttDataFetcher};
use rs_matter::error::Error;
use matter_rs::data_model::sdm::dev_att::{DataType, DevAttDataFetcher};
use matter_rs::error::Error;

pub struct HardCodedDevAtt {}

Expand Down
10 changes: 5 additions & 5 deletions examples/speaker/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@

// TODO
// mod dev_att;
// use rs_matter::core::{self, CommissioningData};
// use rs_matter::data_model::cluster_basic_information::BasicInfoConfig;
// use rs_matter::data_model::cluster_media_playback::{Commands, MediaPlaybackCluster};
// use rs_matter::data_model::device_types::DEV_TYPE_ON_SMART_SPEAKER;
// use rs_matter::secure_channel::spake2p::VerifierData;
// use matter_rs::core::{self, CommissioningData};
// use matter_rs::data_model::cluster_basic_information::BasicInfoConfig;
// use matter_rs::data_model::cluster_media_playback::{Commands, MediaPlaybackCluster};
// use matter_rs::data_model::device_types::DEV_TYPE_ON_SMART_SPEAKER;
// use matter_rs::secure_channel::spake2p::VerifierData;

fn main() {
// env_logger::init();
Expand Down
10 changes: 5 additions & 5 deletions examples/speaker/src/speaker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
* limitations under the License.
*/

use rs_matter::core::{self, CommissioningData};
use rs_matter::data_model::cluster_basic_information::BasicInfoConfig;
use rs_matter::data_model::cluster_media_playback::{Commands, MediaPlaybackCluster};
use rs_matter::data_model::device_types::DEV_TYPE_ON_SMART_SPEAKER;
use rs_matter::secure_channel::spake2p::VerifierData;
use matter_rs::core::{self, CommissioningData};
use matter_rs::data_model::cluster_basic_information::BasicInfoConfig;
use matter_rs::data_model::cluster_media_playback::{Commands, MediaPlaybackCluster};
use matter_rs::data_model::device_types::DEV_TYPE_ON_SMART_SPEAKER;
use matter_rs::secure_channel::spake2p::VerifierData;

mod dev_att;

Expand Down
4 changes: 4 additions & 0 deletions rs-matter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ keywords = ["matter", "smart", "smart-home", "IoT", "ESP32"]
categories = ["embedded", "network-programming"]
license = "Apache-2.0"

[lib]
name = "matter_rs"
path = "src/lib.rs"

[features]
default = ["os", "mbedtls"]
os = ["std", "backtrace", "env_logger", "nix", "critical-section/std", "embassy-sync/std", "embassy-time/std"]
Expand Down
12 changes: 6 additions & 6 deletions rs-matter/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
//! # Examples
//! ```ignore
//! /// TODO: Fix once new API has stabilized a bit
//! use rs_matter::{Matter, CommissioningData};
//! use rs_matter::data_model::device_types::device_type_add_on_off_light;
//! use rs_matter::data_model::cluster_basic_information::BasicInfoConfig;
//! use rs_matter::secure_channel::spake2p::VerifierData;
//! use matter_rs::{Matter, CommissioningData};
//! use matter_rs::data_model::device_types::device_type_add_on_off_light;
//! use matter_rs::data_model::cluster_basic_information::BasicInfoConfig;
//! use matter_rs::secure_channel::spake2p::VerifierData;
//!
//! # use rs_matter::data_model::sdm::dev_att::{DataType, DevAttDataFetcher};
//! # use rs_matter::error::Error;
//! # use matter_rs::data_model::sdm::dev_att::{DataType, DevAttDataFetcher};
//! # use matter_rs::error::Error;
//! # pub struct DevAtt{}
//! # impl DevAttDataFetcher for DevAtt{
//! # fn get_devatt_data(&self, data_type: DataType, data: &mut [u8]) -> Result<usize, Error> { Ok(0) }
Expand Down
2 changes: 1 addition & 1 deletion rs-matter/tests/common/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

use rs_matter::{
use matter_rs::{
interaction_model::{messages::ib::AttrResp, messages::msg::ReportDataMsg},
tlv::{TLVElement, TLVList, TLVWriter, TagType, ToTLV},
utils::writebuf::WriteBuf,
Expand Down
2 changes: 1 addition & 1 deletion rs-matter/tests/common/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

use rs_matter::{
use matter_rs::{
data_model::objects::EncodeValue,
interaction_model::{
messages::ib::{CmdPath, CmdStatus, InvResp},
Expand Down
2 changes: 1 addition & 1 deletion rs-matter/tests/common/echo_cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use core::convert::TryInto;
use std::sync::{Arc, Mutex, Once};

use num_derive::FromPrimitive;
use rs_matter::{
use matter_rs::{
attribute_enum, command_enum,
data_model::objects::{
Access, AttrData, AttrDataEncoder, AttrDataWriter, AttrDetails, AttrType, Attribute,
Expand Down
2 changes: 1 addition & 1 deletion rs-matter/tests/common/handlers.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use log::{info, warn};
use rs_matter::{
use matter_rs::{
error::ErrorCode,
interaction_model::{
core::{IMStatusCode, OpCode},
Expand Down
18 changes: 9 additions & 9 deletions rs-matter/tests/common/im_engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use core::borrow::Borrow;
use core::future::pending;
use core::time::Duration;
use embassy_futures::select::select3;
use rs_matter::{
use matter_rs::{
acl::{AclEntry, AuthMode},
data_model::{
cluster_basic_information::{self, BasicInfoConfig},
Expand Down Expand Up @@ -174,10 +174,10 @@ impl<'a> Handler for ImEngineHandler<'a> {

fn invoke(
&self,
exchange: &rs_matter::transport::exchange::Exchange,
cmd: &rs_matter::data_model::objects::CmdDetails,
data: &rs_matter::tlv::TLVElement,
encoder: rs_matter::data_model::objects::CmdDataEncoder,
exchange: &matter_rs::transport::exchange::Exchange,
cmd: &matter_rs::data_model::objects::CmdDetails,
data: &matter_rs::tlv::TLVElement,
encoder: matter_rs::data_model::objects::CmdDataEncoder,
) -> Result<(), Error> {
self.handler.invoke(exchange, cmd, data, encoder)
}
Expand Down Expand Up @@ -209,16 +209,16 @@ impl<'a> ImEngine<'a> {
/// Create the interaction model engine
pub fn new(cat_ids: NocCatIds) -> Self {
#[cfg(feature = "std")]
use rs_matter::utils::epoch::sys_epoch as epoch;
use matter_rs::utils::epoch::sys_epoch as epoch;

#[cfg(not(feature = "std"))]
use rs_matter::utils::epoch::dummy_epoch as epoch;
use matter_rs::utils::epoch::dummy_epoch as epoch;

#[cfg(feature = "std")]
use rs_matter::utils::rand::sys_rand as rand;
use matter_rs::utils::rand::sys_rand as rand;

#[cfg(not(feature = "std"))]
use rs_matter::utils::rand::dummy_rand as rand;
use matter_rs::utils::rand::dummy_rand as rand;

let matter = Matter::new(
&BASIC_INFO,
Expand Down
2 changes: 1 addition & 1 deletion rs-matter/tests/data_model/acl_and_dataver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

use rs_matter::{
use matter_rs::{
acl::{gen_noc_cat, AclEntry, AuthMode, Target},
data_model::{
objects::{EncodeValue, Privilege},
Expand Down
2 changes: 1 addition & 1 deletion rs-matter/tests/data_model/attribute_lists.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

use rs_matter::{
use matter_rs::{
data_model::objects::EncodeValue,
interaction_model::{
core::IMStatusCode,
Expand Down
2 changes: 1 addition & 1 deletion rs-matter/tests/data_model/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

use rs_matter::{
use matter_rs::{
data_model::{
cluster_on_off,
objects::{EncodeValue, GlobalElements},
Expand Down
2 changes: 1 addition & 1 deletion rs-matter/tests/data_model/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use crate::{
echo_req, echo_resp,
};

use rs_matter::{
use matter_rs::{
data_model::{cluster_on_off, objects::EncodeValue},
interaction_model::{
core::IMStatusCode,
Expand Down
2 changes: 1 addition & 1 deletion rs-matter/tests/data_model/long_reads.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

use rs_matter::{
use matter_rs::{
data_model::{
cluster_basic_information as basic_info, cluster_on_off as onoff,
objects::{EncodeValue, GlobalElements},
Expand Down
2 changes: 1 addition & 1 deletion rs-matter/tests/data_model/timed_requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

use rs_matter::{
use matter_rs::{
data_model::objects::EncodeValue,
interaction_model::{
core::IMStatusCode,
Expand Down
4 changes: 2 additions & 2 deletions tools/tlv/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
*/

use clap::{App, Arg};
use rs_matter::cert;
use rs_matter::tlv;
use matter_rs::cert;
use matter_rs::tlv;
use simple_logger::SimpleLogger;
use std::process;

Expand Down

0 comments on commit 5bb6584

Please sign in to comment.