Skip to content

Commit

Permalink
refactor: use boost uuid instead of uuid-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
blumamir committed Oct 3, 2020
1 parent a9873bc commit 129fb38
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ set (SOURCES
set(CMAKE_BUILD_TYPE Debug)

add_executable (wavplayeralsa ${SOURCES})
target_link_libraries(wavplayeralsa -lasound -lsndfile ${Boost_SYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY} -pthread -luuid)
target_link_libraries(wavplayeralsa -lasound -lsndfile ${Boost_SYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY} -pthread)
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ RUN apt-get update && \
tzdata \
build-essential \
cmake \
uuid-dev \
libsndfile1-dev \
libasound2-dev \
libboost-all-dev
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
0. Install Raspbian https://www.raspberrypi.org/documentation/installation/installing-images/
1. Install boost, sndfile and libsound libs
```
sudo apt-get install libsndfile1-dev libasound2-dev libboost-all-dev uuid-dev
sudo apt-get install libsndfile1-dev libasound2-dev libboost-all-dev
```
2. Clone the wavplayeralsa project and compile it
```
Expand Down
10 changes: 4 additions & 6 deletions src/wavplayeralsa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
#include <sstream>
#include <fstream>
#include <cstdint>
#include <uuid/uuid.h>
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_io.hpp>
#include <boost/uuid/uuid_generators.hpp>

#include <boost/asio.hpp>
#include <boost/filesystem.hpp>
Expand Down Expand Up @@ -97,11 +99,7 @@ class WavPlayerAlsa {
}

void CreateUUID() {
uuid_t uuid;
uuid_generate_time_safe(uuid);
char uuid_str[37]; // ex. "1b4e28ba-2fa1-11d2-883f-0016d3cca427" + "\0"
uuid_unparse_lower(uuid, uuid_str);
uuid_ = std::string(uuid_str);
uuid_ = boost::uuids::to_string(boost::uuids::random_generator()());
root_logger_->info("Generated uuid for this player run: {}", uuid_);
}

Expand Down

0 comments on commit 129fb38

Please sign in to comment.