diff --git a/README.md b/README.md index 2b1aaf9..bf5d03b 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -# PxServ Docs / Dokümantasyonu +# PxServ Documentation -🇹🇷 **TR** : Bu dokümantasyon, PxServ API'lerinin ve kütüphanelerinin nasıl kullanılacağını ve bu sistemlerle nasıl iletişim kurulacağını açıklamaktadır. Amacımız, PxServ'in sunduğu hizmetleri en verimli şekilde kullanabilmeniz için ihtiyaç duyduğunuz tüm bilgileri sağlamaktır. +🇺🇸 **EN** — This documentation covers the PxServ APIs, client libraries, and real-time connection layer. Use it to integrate PxServ into any software or hardware project. -🇺🇸 **EN** : This documentation explains how to use the PxServ APIs and libraries and how to communicate with these systems. Our goal is to provide you with all the information you need to make the most efficient use of PxServ's services. +🇹🇷 **TR** — Bu dokümantasyon, PxServ API'lerini, istemci kütüphanelerini ve gerçek zamanlı bağlantı katmanını kapsamaktadır. PxServ'i herhangi bir yazılım veya donanım projesine entegre etmek için kullanın. diff --git a/SUMMARY.md b/SUMMARY.md index 052d46e..6e411b5 100644 --- a/SUMMARY.md +++ b/SUMMARY.md @@ -36,4 +36,4 @@ * [Real-Time Connection (Socket.IO)](en/realtime-connection-socket.io.md) * [Example Projects](en/example-projects/README.md) * [Home Security System](en/example-projects/home-security-system.md) - * [Smart Temperature Monitor:](en/example-projects/smart-temperature-monitor.md) + * [Smart Temperature Monitor](en/example-projects/smart-temperature-monitor.md) diff --git a/en/arduino-library.md b/en/arduino-library.md index cf893bc..515e18b 100644 --- a/en/arduino-library.md +++ b/en/arduino-library.md @@ -4,84 +4,64 @@ icon: gear-code # Arduino Library -This example code allows you to perform database operations with the PxServ project. You can perform the following operations: +The PxServ Arduino library enables direct communication with the PxServ API from Arduino-compatible devices (ESP32, ESP8266, etc.). -- Save data to the database -- Toggle data between 0 and 1 in the database -- Read data from the database -- Delete data from the database +**Supported operations:** -## Requirements - -Before using this example, make sure the following libraries are installed in the Arduino IDE: +* Save data to the database +* Toggle a value between `0` and `1` +* Read data from the database +* Delete data from the database -- **PxServ.h**: To communicate with the PxServ API. +## Requirements -## Connection Settings +Install the following library in the Arduino IDE before use: -You need to enter the Wi-Fi connection information and your PxServ API key in the required fields in the code under the usage heading. +* **PxServ.h** — PxServ API client ## Usage -In the following example code, the database operations using the PxServ API are explained step by step with comments; the functionality of each operation and how it works is described within the code. - ```cpp #include -// PxServ API Key (Enter your project API key here) PxServ client("your_pxserv_api_key"); -void setup() -{ - // Wi-Fi settings (Wi-Fi SSID and Password) - Serial.begin(115200); - PxServ::connectWifi("your_wifi_ssid", "your_wifi_password"); +void setup() { + Serial.begin(115200); + PxServ::connectWifi("your_wifi_ssid", "your_wifi_password"); } -void loop() -{ - // Save data - PxServ::Callback setResult = client.setData("exampleData1", "value"); // Add "value" to the "exampleData1" key - Serial.print("Set Result -> Status: "); - Serial.print(setResult.status); - Serial.print(" | Message: "); - Serial.print(setResult.message); - Serial.print(" | Data: "); - Serial.println(setResult.data); - - delay(2000); // Wait for two seconds - - // Toggle data - PxServ::Callback toggleResult = client.toggleData("exampleData2"); // Toggles the value of the “exampleData2” key between 0 and 1 - Serial.print("Toggle Result -> Status: "); - Serial.print(toggleResult.status); - Serial.print(" | Message: "); - Serial.print(toggleResult.message); - Serial.print(" | Data: "); - Serial.println(toggleResult.data); - - delay(2000); // Wait for two seconds - - // Get data - PxServ::Callback getResult = client.getData("exampleData1"); // Get the value for the "exampleData1" key - Serial.print("Get Result -> Status: "); - Serial.print(getResult.status); - Serial.print(" | Message: "); - Serial.print(getResult.message); - Serial.print(" | Data: "); - Serial.println(getResult.data); - - delay(2000); // Wait for two seconds - - // Remove data - PxServ::Callback removeResult = client.removeData("exampleData1"); // Remove the "exampleData" key - Serial.print("Remove Result -> Status: "); - Serial.print(removeResult.status); - Serial.print(" | Message: "); - Serial.print(removeResult.message); - Serial.print(" | Data: "); - Serial.println(removeResult.data); - - delay(2000); // Wait for two seconds +void loop() { + // Save data + PxServ::Callback setResult = client.setData("exampleData1", "value"); + Serial.print("Set -> Status: "); Serial.print(setResult.status); + Serial.print(" | Message: "); Serial.print(setResult.message); + Serial.print(" | Data: "); Serial.println(setResult.data); + + delay(2000); + + // Toggle data (cycles between 0 and 1) + PxServ::Callback toggleResult = client.toggleData("exampleData2"); + Serial.print("Toggle -> Status: "); Serial.print(toggleResult.status); + Serial.print(" | Message: "); Serial.print(toggleResult.message); + Serial.print(" | Data: "); Serial.println(toggleResult.data); + + delay(2000); + + // Read data + PxServ::Callback getResult = client.getData("exampleData1"); + Serial.print("Get -> Status: "); Serial.print(getResult.status); + Serial.print(" | Message: "); Serial.print(getResult.message); + Serial.print(" | Data: "); Serial.println(getResult.data); + + delay(2000); + + // Remove data + PxServ::Callback removeResult = client.removeData("exampleData1"); + Serial.print("Remove -> Status: "); Serial.print(removeResult.status); + Serial.print(" | Message: "); Serial.print(removeResult.message); + Serial.print(" | Data: "); Serial.println(removeResult.data); + + delay(2000); } ``` diff --git a/en/example-projects/README.md b/en/example-projects/README.md index 8e18a67..b627472 100644 --- a/en/example-projects/README.md +++ b/en/example-projects/README.md @@ -5,3 +5,9 @@ icon: vial # Example Projects +End-to-end project examples demonstrating PxServ integration with real hardware. + +| Project | Description | +| ------- | ----------- | +| [Home Security System](home-security-system.md) | Motion detection with real-time alerts via ESP32 | +| [Smart Temperature Monitor](smart-temperature-monitor.md) | Periodic temperature and humidity logging with DHT11 | diff --git a/en/example-projects/home-security-system.md b/en/example-projects/home-security-system.md index d075eed..68aa9b7 100644 --- a/en/example-projects/home-security-system.md +++ b/en/example-projects/home-security-system.md @@ -1,5 +1,10 @@ # Home Security System +Detects motion using a PIR sensor connected to an ESP32, triggers a buzzer, and sends an alert to PxServ. The system can be remotely disabled by updating the `system_status` key via the PxServ dashboard or API. + +**Hardware:** ESP32, PIR motion sensor, buzzer\ +**Libraries:** `WiFi.h`, `PxServ.h` + ```cpp #include #include @@ -16,7 +21,7 @@ void setup() { pinMode(MOTION_SENSOR, INPUT); pinMode(BUZZER, OUTPUT); WiFi.begin(WIFI_SSID, WIFI_PASS); - + while (WiFi.status() != WL_CONNECTED) { delay(500); } @@ -29,12 +34,12 @@ void loop() { delay(1000); digitalWrite(BUZZER, LOW); } - + PxServ::Callback result = client.getData("system_status"); if (result.data == "disabled") { digitalWrite(BUZZER, LOW); } - + delay(1000); } ``` diff --git a/en/example-projects/smart-temperature-monitor.md b/en/example-projects/smart-temperature-monitor.md index 23ddb5b..d380f83 100644 --- a/en/example-projects/smart-temperature-monitor.md +++ b/en/example-projects/smart-temperature-monitor.md @@ -1,4 +1,9 @@ -# Smart Temperature Monitor: +# Smart Temperature Monitor + +Reads temperature and humidity from a DHT11 sensor connected to an ESP32 and uploads the values to PxServ every 5 minutes. + +**Hardware:** ESP32, DHT11 sensor\ +**Libraries:** `WiFi.h`, `PxServ.h`, `DHT.h` ```cpp #include @@ -17,7 +22,7 @@ void setup() { Serial.begin(115200); WiFi.begin(WIFI_SSID, WIFI_PASS); dht.begin(); - + while (WiFi.status() != WL_CONNECTED) { delay(500); } @@ -26,10 +31,10 @@ void setup() { void loop() { float temp = dht.readTemperature(); float hum = dht.readHumidity(); - + client.setData("temperature", String(temp)); client.setData("humidity", String(hum)); - - delay(300000); // Update every 5 minutes + + delay(300000); // 5-minute interval } ``` diff --git a/en/javascript-typescript-library.md b/en/javascript-typescript-library.md index 83e4613..92f7042 100644 --- a/en/javascript-typescript-library.md +++ b/en/javascript-typescript-library.md @@ -4,148 +4,129 @@ icon: js # JavaScript / TypeScript Library -This example code allows you to perform database operations with the PxServ project. The following operations are supported: +The PxServ npm package provides a typed client for interacting with the PxServ API from Node.js or browser environments. + +**Supported operations:** * Save data to the database -* Toggle data between 0 and 1 in the database +* Toggle a value between `0` and `1` * Read data from the database +* Fetch all stored data * Delete data from the database -## Requirements - -Before using this example, ensure the following libraries are installed: - -* **pxserv**: Used to communicate with the PxServ API. - ## Installation -You can install the PxServ library using npm: - ```sh npm install pxserv ``` -## Connection Settings - -Enter your PxServ API key and optionally the base URL in the following fields: - -### JavaScript +## Usage +{% tabs %} +{% tab title="JavaScript" %} ```javascript -// Include the PxServ library in the project const PxServ = require("pxserv").default; -// Create a new PxServ Instance by entering your API key const pxServ = new PxServ({ - apiKey: "API_KEY", // Write your own API key here + apiKey: "your_api_key", }); (async () => { try { - // Data Saving - const setTempResult = await pxServ.setData("temp", "24.3°C"); - console.log("Temperature Save Result:", setTempResult); + // Save data + const setResult = await pxServ.setData("temp", "24.3°C"); + console.log("Set:", setResult); - // Get data - const getTempResult = await pxServ.getData("temp"); - console.log("Temperature Reading Result:", getTempResult); + // Read data + const getResult = await pxServ.getData("temp"); + console.log("Get:", getResult); // Toggle data - const toggleLightResult = await pxServ.toggleData("light"); - console.log("Toggle Result:", toggleLightResult); + const toggleResult = await pxServ.toggleData("light"); + console.log("Toggle:", toggleResult); - // Get all data - const tumVeriler = await pxServ.getAll(); - console.log("All Data:", tumVeriler); + // Fetch all data + const allData = await pxServ.getAll(); + console.log("All:", allData); // Remove data await pxServ.removeData("temp"); await pxServ.removeData("light"); - console.log("Data removed."); + console.log("Removed."); } catch (err) { - console.error("Error occurred:", err); + console.error("Error:", err); } })(); - ``` +{% endtab %} -### TypeScript - +{% tab title="TypeScript" %} ```typescript -// Include the PxServ library in the project import PxServ from "pxserv"; -// Create a new PxServ Instance by entering your API key const pxServ = new PxServ({ - apiKey: "API_KEY", // Write your own API key here + apiKey: "your_api_key", }); (async () => { try { - // Data Saving - const setTempResult = await pxServ.setData("temp", "24.3°C"); - console.log("Temperature Save Result:", setTempResult); + // Save data + const setResult = await pxServ.setData("temp", "24.3°C"); + console.log("Set:", setResult); - // Get data - const getTempResult = await pxServ.getData("temp"); - console.log("Temperature Reading Result:", getTempResult); + // Read data + const getResult = await pxServ.getData("temp"); + console.log("Get:", getResult); // Toggle data - const toggleLightResult = await pxServ.toggleData("light"); - console.log("Toggle Result:", toggleLightResult); + const toggleResult = await pxServ.toggleData("light"); + console.log("Toggle:", toggleResult); - // Get all data - const tumVeriler = await pxServ.getAll(); - console.log("All Data:", tumVeriler); + // Fetch all data + const allData = await pxServ.getAll(); + console.log("All:", allData); // Remove data await pxServ.removeData("temp"); await pxServ.removeData("light"); - console.log("Data removed."); + console.log("Removed."); } catch (err) { - console.error("Error occurred:", err); + console.error("Error:", err); } })(); - ``` - -## Usage - -Add this code to your project and run it after installing the required libraries. The code will perform data addition, reading, and deletion operations with the PxServ API. - -### Sample Outputs - -Below are example outputs you may see in the console: - -```javascript -Temperature Save Result: { status: 200, message: 'OK', data: {} } -Temperature Reading Result: { - status: 200, - message: 'OK', - data: { - lastUpdate: '2025-05-23T20:28:00.581Z', - icon: 'defaultIcon', - value: '24.3°C' +{% endtab %} +{% endtabs %} + +## Sample Output + +```json +Set: { "status": 200, "message": "OK", "data": {} } +Get: { + "status": 200, + "message": "OK", + "data": { + "lastUpdate": "2025-05-23T20:28:00.581Z", + "icon": "defaultIcon", + "value": "24.3°C" } } -Toggle Result: { status: 200, message: 'OK', data: {} } -All Data: { - status: 200, - message: 'OK', - data: { - temp: { - lastUpdate: '2025-05-23T20:28:00.581Z', - icon: 'defaultIcon', - value: '24.3°C' +Toggle: { "status": 200, "message": "OK", "data": {} } +All: { + "status": 200, + "message": "OK", + "data": { + "temp": { + "lastUpdate": "2025-05-23T20:28:00.581Z", + "icon": "defaultIcon", + "value": "24.3°C" }, - light: { - lastUpdate: '2025-05-23T20:28:00.714Z', - icon: 'defaultIcon', - value: '1' + "light": { + "lastUpdate": "2025-05-23T20:28:00.714Z", + "icon": "defaultIcon", + "value": "1" } } } -Data removed. +Removed. ``` - -These outputs indicate that the data has been successfully added, read, and deleted. diff --git a/en/quick-start.md b/en/quick-start.md index b4fb539..53656d3 100644 --- a/en/quick-start.md +++ b/en/quick-start.md @@ -4,91 +4,72 @@ icon: bolt # Quick Start -PxServ is a platform that provides comprehensive software and hardware support for developers and users who want to develop IoT systems. PxServ enables seamless integration into your projects through APIs and libraries while also offering hardware solutions such as the PxServ Quadro development board (coming soon!). - -### Project Development Steps with PxServ - -1. **Sign Up for PxServ and Create a Project**\ - Log in to the PxServ platform and create a new project. -2. **Choose Your Development Environment**\ - PxServ is compatible with various programming languages and hardware platforms. It supports the following technologies: - * Arduino - * JavaScript / TypeScript - * Rust - * ESP32, ESP8266 - * Raspberry Pi - * Any software or hardware capable of connecting to the internet -3. **Develop Your Project and Define Data Transmission**\ - Define the data your device will share with PxServ. You can easily develop your project by utilizing the various libraries provided by PxServ: - - * **Arduino Library** - * **JavaScript / TypeScript Library** - * **Rust Library** - - For example, in this project, we will use the **Arduino Library since we are using the ESP32 on the Arduino platform.**\ - - - Below is a sample code that sends data to PxServ using an ESP32 and a DHT11 temperature & humidity sensor:\ - - - ```cpp - #include - #include "DHT.h" - - #define DHT_PIN 4 // Pin to which DHT11 Sensor is connected - #define DHT_TYPE DHT11 // Sensor type DHT11 by default - - // PxServ API Key (Enter your project API key here) - PxServ client("pxserv_api_key"); - DHT dht(DHT_PIN, DHT_TYPE); - - void setup() { - // Wi-Fi settings (Wi-Fi SSID and Password) - Serial.begin(115200); - PxServ::connectWifi("wifi_ssid", "wifi_sifre"); - dht.begin(); - } - - void loop() { - float temperature = dht.readTemperature(); - float humidity = dht.readHumidity(); - - if (isnan(temperature) || isnan(humidity)) { - Serial.println("Failed to read data from DHT11 sensor!"); - return; - } - - Serial.print("Temperature: "); - Serial.print(temperature); - Serial.println("°C"); - Serial.print("Humidity: "); - Serial.print(humidity); - Serial.println("%"); - - // Saving data to PxServ - PxServ::Callback tempResult = client.setData("temperature", String(temperature)); - PxServ::Callback humResult = client.setData("humidity", String(humidity)); - - Serial.print("Temperature Saving Status: "); - Serial.println(tempResult.status); - Serial.print("Humidity Saving Status: "); - Serial.println(humResult.status); - } - ``` - - \ - [Click here to explore the detailed usage and additional features of the Arduino library.](arduino-library.md) -4. **Manage Your Data with PxServ** - - * Perform AI-powered data analysis from PxServ’s management panel. - * Examine your data on the statistics page. - * View and manage stored data from the database page. - -

PxServ Website

PxServ Mobile App

-5. **Access Your Data from Anywhere**\ - Access and manage your device or software data through the following methods: - * PxServ Management Panel - * [PxServ Mobile Application](https://play.google.com/store/apps/details?id=net.pxserv.mobile) - * Custom management panels, web pages, or mobile applications developed using PxServ - -With PxServ, you can easily develop, manage, and optimize your IoT projects. Don't forget to check out our official documentation for more information! +PxServ is an IoT platform that provides API and library support for connecting software and hardware projects to the cloud. It is compatible with Arduino, JavaScript/TypeScript, Rust, ESP32, ESP8266, Raspberry Pi, and any internet-capable device. + +## Steps + +### 1. Create a Project + +Sign in to the PxServ platform and create a new project. You will receive a project API key used to authenticate all requests. + +### 2. Choose Your Integration + +PxServ supports the following integrations: + +* [Arduino Library](arduino-library.md) +* [JavaScript / TypeScript Library](javascript-typescript-library.md) +* [Rust Library](rust-library.md) +* [REST API](rest-api/README.md) +* [Real-Time Connection (Socket.IO)](realtime-connection-socket.io.md) + +### 3. Send Data to PxServ + +The following example uses the Arduino Library with an ESP32 and a DHT11 sensor to send temperature and humidity data to PxServ: + +```cpp +#include +#include "DHT.h" + +#define DHT_PIN 4 +#define DHT_TYPE DHT11 + +PxServ client("your_pxserv_api_key"); +DHT dht(DHT_PIN, DHT_TYPE); + +void setup() { + Serial.begin(115200); + PxServ::connectWifi("your_wifi_ssid", "your_wifi_password"); + dht.begin(); +} + +void loop() { + float temperature = dht.readTemperature(); + float humidity = dht.readHumidity(); + + if (isnan(temperature) || isnan(humidity)) { + Serial.println("Failed to read from DHT11 sensor."); + return; + } + + client.setData("temperature", String(temperature)); + client.setData("humidity", String(humidity)); +} +``` + +### 4. Manage Your Data + +Once data is flowing, you can: + +* Analyze data with AI-powered insights from the management panel +* View historical data on the statistics page +* Browse and manage stored records from the database page + +

PxServ Dashboard

PxServ Mobile App

+ +### 5. Access Data Anywhere + +Retrieve and manage your data through: + +* PxServ Management Panel +* [PxServ Mobile App](https://play.google.com/store/apps/details?id=net.pxserv.mobile) +* Custom dashboards or applications built with the PxServ API diff --git a/en/realtime-connection-socket.io.md b/en/realtime-connection-socket.io.md index c31c340..f034c20 100644 --- a/en/realtime-connection-socket.io.md +++ b/en/realtime-connection-socket.io.md @@ -4,104 +4,73 @@ icon: tower-cell # Real-Time Connection (Socket.IO) -This document explains how to establish a real-time connection to the **PxServ API** using **Socket.IO**. **Socket.IO** is a powerful library that enables bidirectional communication between the client and server. The example provided below is for **JavaScript / TypeScript**, but a similar event structure and **API key authentication** can be used with **Rust, Java, Python, and Go** by utilizing the appropriate Socket.IO library. +PxServ supports real-time bidirectional communication via **Socket.IO**. Authenticate using your project API key and listen for data events as they occur. -## Usage +The examples below use JavaScript/TypeScript. The same event structure and API key authentication apply to any language with a Socket.IO client (Python, Rust, Go, Java, etc.). -The following code demonstrates how to connect to **PxServ API** in real-time using **JavaScript / TypeScript**: +## Connecting ```js const socket = io("https://api.pxserv.net", { auth: { - apiKey: "Project API Key", + apiKey: "your_project_api_key", }, }); socket.on("connect", () => { - console.log("Successfully connected to the server."); + console.log("Connected to PxServ."); }); ``` -### Example Console Output: - -``` -Successfully connected to the server. -``` - -This connection ensures authentication with the **API key** while connecting to the server. - ## Events -When a connection is established via Socket.IO, specific events can be listened to track actions such as data storage and deletion. +### `setData` — Data Updated -### Data Update Event - -When new data is stored on the server, the following event is triggered. - -#### Event Name: `setData` - -#### Usage (JavaScript) +Emitted when a key-value pair is saved or updated. ```js socket.on("setData", (data) => { - console.log("New data received:", data); + console.log("Data updated:", data); }); ``` -### Example Console Output: +**Example payload:** -``` -New data received: -{ key: "temperature", lastUpdate: "2025-03-31T17:40:19.653Z", icon: "hum", value: "64.11" } +```json +{ "key": "temperature", "lastUpdate": "2025-03-31T17:40:19.653Z", "icon": "hum", "value": "64.11" } ``` *** -### Data Deletion Event - -When data is deleted, the following event is triggered. +### `removeData` — Data Removed -#### Event Name: `removeData` - -#### Usage (JavaScript) +Emitted when a key is deleted. ```js socket.on("removeData", (data) => { - console.log("A data entry was removed:", data); + console.log("Data removed:", data); }); ``` -### Example Console Output: +**Example payload:** -``` -A data entry was removed: -{ key: "temperature" } +```json +{ "key": "temperature" } ``` *** -## Terminating the Connection - -To terminate the connection, use the following code: +## Disconnecting ```js socket.disconnect(); -console.log("Connection terminated."); ``` -### Example Console Output: - -``` -Connection terminated. -``` - -## Usage in Other Languages - -**Socket.IO** is also supported in various other programming languages. You can establish a connection using **the same event structure** and **API key authentication** with the following languages: - -* [**JavaScript / TypeScript**](https://socket.io/docs/v4/client-initialization/) -* [**Python**](https://python-socketio.readthedocs.io/en/latest/client.html) -* [**Rust**](https://github.com/1c3t3a/rust-socketio) -* [**Go**](https://github.com/googollee/go-socket.io) +## Other Languages -By utilizing the appropriate Socket.IO client library for each language, a similar connection can be established. +| Language | Socket.IO Client | +| -------- | ---------------- | +| JavaScript / TypeScript | [socket.io-client](https://socket.io/docs/v4/client-initialization/) | +| Python | [python-socketio](https://python-socketio.readthedocs.io/en/latest/client.html) | +| Rust | [rust-socketio](https://github.com/1c3t3a/rust-socketio) | +| Go | [go-socket.io](https://github.com/googollee/go-socket.io) | diff --git a/en/rust-library.md b/en/rust-library.md index 5e642d7..ada59af 100644 --- a/en/rust-library.md +++ b/en/rust-library.md @@ -4,11 +4,16 @@ icon: rust # Rust Library -This sample code allows you to perform database operations with the PxServ project. You can perform the following operations: +The `pxserv` crate provides a synchronous client for interacting with the PxServ API from Rust applications. -## Installation +**Supported operations:** + +* Save data to the database +* Toggle a value between `0` and `1` +* Read data from the database +* Delete data from the database -To add the `pxserv` library to your project, first run the following line in the terminal: +## Installation ```sh cargo add pxserv @@ -16,54 +21,47 @@ cargo add pxserv ## Usage -Below is an example of how to use the PxServ library: - ```rust use pxserv::PxServ; fn main() { - // Create an instance of the PxServ class with the API key - let client = PxServ::new("API_KEY"); + let client = PxServ::new("your_api_key"); // Save data - // Save the temperature data to PxServ with the ”temp" key let set_response = client.setdata("temp", "22.5°C"); println!( - "Save Data -> Status: {}, Message: {}", + "Set -> Status: {}, Message: {}", set_response.status, set_response.message ); - // Toggle data - // Toggle the ”light" key between 0 and 1 + // Toggle data (cycles between 0 and 1) let toggle_response = client.toggledata("light"); println!( - "Veri Geçiş -> Status: {}, Message: {}", + "Toggle -> Status: {}, Message: {}", toggle_response.status, toggle_response.message ); - // Get data - // Get the temperature data in the ”temp" key from PxServ + // Read data let get_response = client.getdata("temp"); println!( - "Get Data -> Status: {}, Message: {}, Data: {:?}", + "Get -> Status: {}, Message: {}, Data: {:?}", get_response.status, get_response.message, get_response.data ); // Remove data - // Remove the temperature data in the “temp” key from PxServ let remove_response = client.removedata("temp"); println!( - "Remove Data -> Status: {}, Message: {}", + "Remove -> Status: {}, Message: {}", remove_response.status, remove_response.message ); } ``` -Sample Outputs Below is sample output that you can see in the console +## Sample Output ``` -Save Data -> Status: 200, Message: OK -Toggle Data -> Status: 200, Message: OK -Get Data -> Status: 200, Message: OK, Data: Some("22.5°C") -Remove Data -> Status: 200, Message: OK +Set -> Status: 200, Message: OK +Toggle -> Status: 200, Message: OK +Get -> Status: 200, Message: OK, Data: Some("22.5°C") +Remove -> Status: 200, Message: OK ``` diff --git a/tr/arduino-kutuphanesi.md b/tr/arduino-kutuphanesi.md index 852e990..4c2a6c9 100644 --- a/tr/arduino-kutuphanesi.md +++ b/tr/arduino-kutuphanesi.md @@ -4,84 +4,64 @@ icon: gear-code # Arduino Kütüphanesi -Bu örnek kod, PxServ projesi ile veri tabanı işlemleri yapmanızı sağlar. Aşağıdaki işlemleri gerçekleştirebilirsiniz: +PxServ Arduino kütüphanesi, Arduino uyumlu cihazlardan (ESP32, ESP8266 vb.) PxServ API ile doğrudan iletişim kurmanızı sağlar. -- Veritabanına veri kaydetme -- Veritabanınada veriyi 0 ile 1 arasında geçiş yaptırma -- Veritabanından veri okuma -- Veritabanından veri silme +**Desteklenen işlemler:** -## Gereksinimler - -Bu örneği kullanmadan önce aşağıdaki kütüphanelerin Arduino IDE'ye yüklü olduğundan emin olun: +* Veritabanına veri kaydetme +* Değeri `0` ile `1` arasında geçiş yaptırma +* Veritabanından veri okuma +* Veritabanından veri silme -- **PxServ.h**: PxServ API'si ile iletişim kurmak için. +## Gereksinimler -## Bağlantı Ayarları +Kullanmadan önce Arduino IDE'ye şu kütüphaneyi yükleyin: -Wi-Fi bağlantısı bilgilerini ve PxServ API anahtarınızı kullanım başlığı altındaki koddaki gerekli alanlara girmeniz gerekmektedir. +* **PxServ.h** — PxServ API istemcisi ## Kullanım -Aşağıdaki örnek kodda, PxServ API kullanılarak veritabanı işlemlerinin nasıl gerçekleştirileceği yorum satırlarıyla birlikte adım adım anlatılmıştır; her işlemin işlevi ve nasıl çalıştığı kod içinde açıklanmıştır. - ```cpp #include -// PxServ API Anahtarı (Proje API anahtarınızı buraya girin) -PxServ client("pxserv_api_key"); +PxServ client("pxserv_api_anahtariniz"); -void setup() -{ - // Wi-Fi ayarları (Wi-Fi SSID ve Şifre) - Serial.begin(115200); - PxServ::connectWifi("wifi_ssid", "wifi_sifre"); +void setup() { + Serial.begin(115200); + PxServ::connectWifi("wifi_ssid", "wifi_sifre"); } -void loop() -{ - // Veri Kaydetme - PxServ::Callback setResult = client.setData("exampleData1", "value"); // "exampleData1" anahtarına "value" değerini ekle - Serial.print("Veri Ekleme Sonucu -> Durum: "); - Serial.print(setResult.status); - Serial.print(" | Mesaj: "); - Serial.print(setResult.message); - Serial.print(" | Veri: "); - Serial.println(setResult.data); - - delay(2000); // İki saniye bekle - - // Veri Geçişi - PxServ::Callback toggleResult = client.toggleData("exampleData2"); // “exampleData2” anahtarının değerini 0 ile 1 arasında geçiş yaptırır - Serial.print("Toggle Result -> Status: "); - Serial.print(toggleResult.status); - Serial.print(" | Message: "); - Serial.print(toggleResult.message); - Serial.print(" | Data: "); - Serial.println(toggleResult.data); - - delay(2000); // İki saniye bekle - - // Veri Okuma - PxServ::Callback getResult = client.getData("exampleData1"); // "exampleData1" anahtarının değerini getir - Serial.print("Veri Okuma Sonucu -> Durum: "); - Serial.print(getResult.status); - Serial.print(" | Mesaj: "); - Serial.print(getResult.message); - Serial.print(" | Veri: "); - Serial.println(getResult.data); - - delay(2000); // İki saniye bekle - - // Veri Kaldırma - PxServ::Callback removeResult = client.removeData("exampleData1"); // "exampleData1" anahtarını kaldır - Serial.print("Kaldırma Sonucu -> Durum: "); - Serial.print(removeResult.status); - Serial.print(" | Mesaj: "); - Serial.print(removeResult.message); - Serial.print(" | Veri: "); - Serial.println(removeResult.data); - - delay(2000); // İki saniye bekle +void loop() { + // Veri Kaydetme + PxServ::Callback setResult = client.setData("exampleData1", "value"); + Serial.print("Kaydetme -> Durum: "); Serial.print(setResult.status); + Serial.print(" | Mesaj: "); Serial.print(setResult.message); + Serial.print(" | Veri: "); Serial.println(setResult.data); + + delay(2000); + + // Veri Geçişi (0 ile 1 arasında döngü) + PxServ::Callback toggleResult = client.toggleData("exampleData2"); + Serial.print("Geçiş -> Durum: "); Serial.print(toggleResult.status); + Serial.print(" | Mesaj: "); Serial.print(toggleResult.message); + Serial.print(" | Veri: "); Serial.println(toggleResult.data); + + delay(2000); + + // Veri Okuma + PxServ::Callback getResult = client.getData("exampleData1"); + Serial.print("Okuma -> Durum: "); Serial.print(getResult.status); + Serial.print(" | Mesaj: "); Serial.print(getResult.message); + Serial.print(" | Veri: "); Serial.println(getResult.data); + + delay(2000); + + // Veri Kaldırma + PxServ::Callback removeResult = client.removeData("exampleData1"); + Serial.print("Kaldırma -> Durum: "); Serial.print(removeResult.status); + Serial.print(" | Mesaj: "); Serial.print(removeResult.message); + Serial.print(" | Veri: "); Serial.println(removeResult.data); + + delay(2000); } ``` diff --git a/tr/gercek-zamanli-baglanti-socket.io.md b/tr/gercek-zamanli-baglanti-socket.io.md index 4abf6e6..83a91d2 100644 --- a/tr/gercek-zamanli-baglanti-socket.io.md +++ b/tr/gercek-zamanli-baglanti-socket.io.md @@ -4,104 +4,73 @@ icon: tower-cell # Gerçek Zamanlı Bağlantı (Socket.IO) -Bu doküman, PxServ API'ye **Socket.IO** kullanarak nasıl gerçek zamanlı bağlanabileceğinizi açıklar. **Socket.IO**, istemci ve sunucu arasında çift yönlü iletişim sağlayan güclü bir kütüphanedir. Aşağıda verilen örnek **JavaScript / TypeScript** için hazırlanmıştır, ancak **Rust, Java, Python ve Go** gibi dillerde uygun Socket.IO kütüphanesi kullanılarak benzer event yapısı ve **API anahtarı (API Key) ile kimlik doğrulama** sağlanabilir. +PxServ, **Socket.IO** aracılığıyla gerçek zamanlı çift yönlü iletişimi destekler. Proje API anahtarınızla kimlik doğrulaması yapın ve veri olaylarını anında dinleyin. -## Kullanım +Aşağıdaki örnekler JavaScript/TypeScript kullanmaktadır. Aynı olay yapısı ve API anahtarı kimlik doğrulaması, Socket.IO istemcisi olan tüm dillerde (Python, Rust, Go, Java vb.) geçerlidir. -Aşağıdaki kod ile **JavaScript / TypeScript** kullanarak **PxServ API'ye** gerçek zamanlı olarak bağlanabilirsiniz: +## Bağlantı ```js const socket = io("https://api.pxserv.net", { auth: { - apiKey: "Proje API Keyi", + apiKey: "proje_api_anahtariniz", }, }); socket.on("connect", () => { - console.log("Sunucuya başarılı şekilde bağlanıldı."); + console.log("PxServ'e bağlandı."); }); ``` -### Örnek Console Çıktısı: +## Olaylar -``` -Sunucuya başarılı şekilde bağlanıldı. -``` - -Bu bağlantı, **API anahtarı** ile kimlik doğrulama yaparak sunucuya bağlanmayı sağlar. - -## Eventler - -Socket.IO ile bağlantı kurulduğunda belirli eventler dinlenerek veri kaydedilmesi ve silinmesi gibi işlemlerin durumları takip edilebilir. +### `setData` — Veri Güncellendi -### Veri Güncelleme Olayı - -Sunucuya yeni veri kaydedildiğinde aşağıdaki event tetiklenir. - -#### Olay Adı: `setData` - -#### Kullanım (JavaScript) +Bir anahtar-değer çifti kaydedildiğinde veya güncellendiğinde tetiklenir. ```js socket.on("setData", (data) => { - console.log("Yeni veri alındı:", data); + console.log("Veri güncellendi:", data); }); ``` -### Örnek Console Çıktısı: +**Örnek veri:** -``` -Yeni veri alındı: -{ key: "sıcaklık", lastUpdate: "2025-03-31T17:40:19.653Z", icon: "hum", value: "64.11" } +```json +{ "key": "sıcaklık", "lastUpdate": "2025-03-31T17:40:19.653Z", "icon": "hum", "value": "64.11" } ``` *** -### Veri Silme Olayı - -Bir veri silindiğinde aşağıdaki event tetiklenir. +### `removeData` — Veri Silindi -#### Olay Adı: `removeData` - -#### Kullanım (JavaScript) +Bir anahtar silindiğinde tetiklenir. ```js socket.on("removeData", (data) => { - console.log("Bir veri kaldırıldı:", data); + console.log("Veri silindi:", data); }); ``` -### Örnek Console Çıktısı: +**Örnek veri:** -``` -Bir veri kaldırıldı: -{ key: "sıcaklık" } +```json +{ "key": "sıcaklık" } ``` *** ## Bağlantıyı Sonlandırma -Bağlantıyı sonlandırmak için şu kod kullanılabilir: - ```js socket.disconnect(); -console.log("Bağlantı sonlandırıldı."); ``` -### Örnek Console Çıktısı: - -``` -Bağlantı sonlandırıldı. -``` - -## Diğer Dillerde Kullanım - -**Socket.IO**, farklı dillerde de desteklenmektedir. Aşağıdaki dillerde **aynı event yapısı** ve **API anahtarı ile kimlik doğrulama** kullanarak bağlantı kurulabilir: - -* [**JavaScript / TypeScript**](https://socket.io/docs/v4/client-initialization/) -* [**Python**](https://python-socketio.readthedocs.io/en/latest/client.html) -* [**Rust**](https://github.com/1c3t3a/rust-socketio) -* [**Go**](https://github.com/googollee/go-socket.io) +## Diğer Diller -Her dil için uygun Socket.IO istemci kütüphanesi kullanılarak benzer şekilde bağlanılabilir. +| Dil | Socket.IO İstemcisi | +| --- | ------------------- | +| JavaScript / TypeScript | [socket.io-client](https://socket.io/docs/v4/client-initialization/) | +| Python | [python-socketio](https://python-socketio.readthedocs.io/en/latest/client.html) | +| Rust | [rust-socketio](https://github.com/1c3t3a/rust-socketio) | +| Go | [go-socket.io](https://github.com/googollee/go-socket.io) | diff --git a/tr/hizli-baslangic.md b/tr/hizli-baslangic.md index aaf6da9..03d4434 100644 --- a/tr/hizli-baslangic.md +++ b/tr/hizli-baslangic.md @@ -4,91 +4,72 @@ icon: bolt # Hızlı Başlangıç -PxServ, IoT sistemleri geliştirmek isteyen geliştiriciler ve kullanıcılar için kapsamlı yazılımsal ve donanımsal destekler sunan bir platformdur. PxServ, API'ler ve kütüphaneler ile projelerinize entegre olmanızı sağlarken, donanımsal olarak da PxServ Quadro geliştirme kartı (çok yakında!) gibi çözümler sunacaktır. - -### PxServ ile Proje Geliştirme Adımları - -1. **PxServ'e Kaydolun ve Proje Oluşturun**\ - PxServ platformuna giriş yaparak yeni bir proje oluşturun. -2. **Geliştirme Ortamınızı Seçin**\ - PxServ, birçok programlama dili ve donanım platformuyla uyumludur. Şu teknolojileri destekler: - * Arduino - * JavaScript / TypeScript - * Rust - * ESP32, ESP8266 - * Raspberry Pi - * Internete bağlanabilen herhangi bir yazılım veya donanım -3. **Projenizi Geliştirin ve Veri Gönderimini Tanımlayın**\ - Cihazınızın PxServ ile hangi verileri paylaşacağını belirleyin. PxServ'in sunduğu çeşitli kütüphanelerden faydalanarak projenizi kolayca geliştirebilirsiniz: - - * **Arduino Kütüphanesi** - * **JavaScript / TypeScript Kütüphanesi** - * **Rust Kütüphanesi** - - Örnek olarak, bu projede **Arduino platformunda ESP32 kullanacağımız için Arduino Kütüphanesi'ni tercih edeceğiz.**\ - - - Aşağıda, ESP32 ve DHT11 sıcaklık & nem sensörünü kullanarak PxServ'e veri gönderen bir örnek kod bulunmaktadır:\ - - - ```cpp - #include - #include "DHT.h" - - #define DHT_PIN 4 // DHT11 Sensörünün bağlı olduğu pin - #define DHT_TYPE DHT11 // Sensör tipi varsayılan olarak DHT11 - - // PxServ API Anahtarı (Proje API anahtarınızı buraya girin) - PxServ client("pxserv_api_key"); - DHT dht(DHT_PIN, DHT_TYPE); - - void setup() { - // Wi-Fi ayarları (Wi-Fi SSID ve Şifre) - Serial.begin(115200); - PxServ::connectWifi("wifi_ssid", "wifi_sifre"); - dht.begin(); - } - - void loop() { - float temperature = dht.readTemperature(); - float humidity = dht.readHumidity(); - - if (isnan(temperature) || isnan(humidity)) { - Serial.println("DHT11 sensöründen veri okunamadı!"); - return; - } - - Serial.print("Sıcaklık: "); - Serial.print(temperature); - Serial.println("°C"); - Serial.print("Nem: "); - Serial.print(humidity); - Serial.println("%"); - - // Verileri PxServ'e kaydetme - PxServ::Callback tempResult = client.setData("temperature", String(temperature)); - PxServ::Callback humResult = client.setData("humidity", String(humidity)); - - Serial.print("Sıcaklık Kaydetme Durumu: "); - Serial.println(tempResult.status); - Serial.print("Nem Kaydetme Durumu: "); - Serial.println(humResult.status); - } - ``` - - \ - [Arduino kütüphanesinin detaylı kullanımını ve ek özellikleri keşfetmek için buraya tıklayın.](arduino-kutuphanesi.md) -4. **Verilerinizi PxServ ile Yönetin** - - * PxServ'in yönetim panelinden AI destekli veri analizleri yapabilirsiniz. - * İstatistikler sayfasında verilerinizi inceleyebilirsiniz. - * Veritabanı sayfasından kaydedilen verileri görüntüleyebilir ve yönetebilirsiniz. - -

PxServ Websitesi

PxServ Mobil Uygulaması

-5. **Verilerinize Her Yerden Erişim Sağlayın**\ - Cihazınızın veya yazılımınızın verilerine aşağıdaki yöntemlerle erişebilir ve yönetebilirsiniz: - * PxServ Yönetim Paneli - * [PxServ Mobil Uygulaması](https://play.google.com/store/apps/details?id=net.pxserv.mobile) - * PxServ kullanarak geliştirilen / geliştireceğiniz özel yönetim panelleri, web sayfaları veya mobil uygulamalar - -PxServ ile IoT projelerinizi kolayca geliştirebilir, yönetebilir ve optimize edebilirsiniz. Daha fazla bilgi için resmi dökümantasyonumuza göz atmayı unutmayın! +PxServ, yazılım ve donanım projelerini buluta bağlamak için API ve kütüphane desteği sunan bir IoT platformudur. Arduino, JavaScript/TypeScript, Rust, ESP32, ESP8266, Raspberry Pi ve internete bağlanabilen her cihazla uyumludur. + +## Adımlar + +### 1. Proje Oluşturun + +PxServ platformuna giriş yapın ve yeni bir proje oluşturun. Tüm isteklerde kimlik doğrulaması için kullanacağınız bir proje API anahtarı alacaksınız. + +### 2. Entegrasyon Yönteminizi Seçin + +PxServ şu entegrasyonları destekler: + +* [Arduino Kütüphanesi](arduino-kutuphanesi.md) +* [JavaScript / TypeScript Kütüphanesi](javascript-typescript-kutuphanesi.md) +* [Rust Kütüphanesi](rust-kutuphanesi.md) +* [REST API](rest-api/README.md) +* [Gerçek Zamanlı Bağlantı (Socket.IO)](gercek-zamanli-baglanti-socket.io.md) + +### 3. PxServ'e Veri Gönderin + +Aşağıdaki örnek, DHT11 sensörü ve ESP32 kullanan Arduino Kütüphanesi ile sıcaklık ve nem verilerini PxServ'e göndermektedir: + +```cpp +#include +#include "DHT.h" + +#define DHT_PIN 4 +#define DHT_TYPE DHT11 + +PxServ client("pxserv_api_anahtariniz"); +DHT dht(DHT_PIN, DHT_TYPE); + +void setup() { + Serial.begin(115200); + PxServ::connectWifi("wifi_ssid", "wifi_sifre"); + dht.begin(); +} + +void loop() { + float temperature = dht.readTemperature(); + float humidity = dht.readHumidity(); + + if (isnan(temperature) || isnan(humidity)) { + Serial.println("DHT11 sensöründen veri okunamadı."); + return; + } + + client.setData("temperature", String(temperature)); + client.setData("humidity", String(humidity)); +} +``` + +### 4. Verilerinizi Yönetin + +Veri aktarımı başladıktan sonra şunları yapabilirsiniz: + +* Yönetim panelinden yapay zeka destekli veri analizi yapın +* İstatistikler sayfasında geçmiş verileri görüntüleyin +* Veritabanı sayfasından kayıtları inceleyin ve yönetin + +

PxServ Yönetim Paneli

PxServ Mobil Uygulaması

+ +### 5. Verilerinize Her Yerden Erişin + +Cihaz veya yazılım verilerinize şu yollarla erişebilirsiniz: + +* PxServ Yönetim Paneli +* [PxServ Mobil Uygulaması](https://play.google.com/store/apps/details?id=net.pxserv.mobile) +* PxServ API ile geliştirilmiş özel paneller veya uygulamalar diff --git a/tr/javascript-typescript-kutuphanesi.md b/tr/javascript-typescript-kutuphanesi.md index e2dcd17..68257e0 100644 --- a/tr/javascript-typescript-kutuphanesi.md +++ b/tr/javascript-typescript-kutuphanesi.md @@ -4,146 +4,129 @@ icon: js # JavaScript / TypeScript Kütüphanesi -Bu örnek kod, PxServ projesi ile veri tabanı işlemleri yapmanızı sağlar. Aşağıdaki işlemleri gerçekleştirebilirsiniz: +PxServ npm paketi, Node.js veya tarayıcı ortamlarından PxServ API ile etkileşim kurmak için tiplendirilmiş bir istemci sağlar. + +**Desteklenen işlemler:** * Veritabanına veri kaydetme -* Veritabanınada veriyi 0 ile 1 arasında geçiş yaptırma +* Değeri `0` ile `1` arasında geçiş yaptırma * Veritabanından veri okuma +* Tüm verileri çekme * Veritabanından veri silme -## Gereksinimler - -Bu örneği kullanmadan önce aşağıdaki kütüphanelerin yüklü olduğundan emin olun: - -* **pxserv**: PxServ API'si ile iletişim kurmak için. - ## Kurulum -PxServ kütüphanesini npm kullanarak yükleyebilirsiniz: - ```sh npm install pxserv ``` -## Bağlantı Ayarları - -PxServ API anahtarınızı ve isteğe bağlı olarak temel URL'yi aşağıdaki alanlara girmeniz gerekmektedir: - -### JavaScript +## Kullanım +{% tabs %} +{% tab title="JavaScript" %} ```javascript -// PxServ kütüphanesini projeye dahil et const PxServ = require("pxserv").default; -// API anahtarınızı girerek yeni bir PxServ Instancesi oluşturun const pxServ = new PxServ({ - apiKey: "API_KEY", // Kendi API anahtarınızı buraya yazın + apiKey: "api_anahtariniz", }); (async () => { try { // Veri Kaydetme - const setTempResult = await pxServ.setData("temp", "24.3°C"); - console.log("Sıcaklık Kaydetme Sonucu:", setTempResult); + const setResult = await pxServ.setData("temp", "24.3°C"); + console.log("Kaydetme:", setResult); // Veri Okuma - const getTempResult = await pxServ.getData("temp"); - console.log("Sıcaklık Okuma Sonucu", getTempResult); + const getResult = await pxServ.getData("temp"); + console.log("Okuma:", getResult); - // Geçiş işlemi - const toggleLightResult = await pxServ.toggleData("light"); - console.log("Light Geçiş(Toggle) Sonucu:", toggleLightResult); + // Veri Geçişi + const toggleResult = await pxServ.toggleData("light"); + console.log("Geçiş:", toggleResult); - // Tüm Veriler - const tumVeriler = await pxServ.getAll(); - console.log("Tüm Veriler:", tumVeriler); + // Tüm Verileri Çek + const allData = await pxServ.getAll(); + console.log("Tümü:", allData); // Veri Silme await pxServ.removeData("temp"); await pxServ.removeData("light"); console.log("Veriler silindi."); } catch (err) { - console.error("Hata oluştu:", err); + console.error("Hata:", err); } })(); - ``` +{% endtab %} -### TypeScript - +{% tab title="TypeScript" %} ```typescript -// PxServ kütüphanesini projeye dahil et import PxServ from "pxserv"; -// API anahtarınızı girerek yeni bir PxServ Instancesi oluşturun const pxServ = new PxServ({ - apiKey: "API_KEY", // Kendi API anahtarınızı buraya yazın + apiKey: "api_anahtariniz", }); (async () => { try { // Veri Kaydetme - const setTempResult = await pxServ.setData("temp", "24.3°C"); - console.log("Sıcaklık Kaydetme Sonucu:", setTempResult); + const setResult = await pxServ.setData("temp", "24.3°C"); + console.log("Kaydetme:", setResult); // Veri Okuma - const getTempResult = await pxServ.getData("temp"); - console.log("Sıcaklık Okuma Sonucu", getTempResult); + const getResult = await pxServ.getData("temp"); + console.log("Okuma:", getResult); - // Geçiş işlemi - const toggleLightResult = await pxServ.toggleData("light"); - console.log("Light Geçiş(Toggle) Sonucu:", toggleLightResult); + // Veri Geçişi + const toggleResult = await pxServ.toggleData("light"); + console.log("Geçiş:", toggleResult); - // Tüm Veriler - const tumVeriler = await pxServ.getAll(); - console.log("Tüm Veriler:", tumVeriler); + // Tüm Verileri Çek + const allData = await pxServ.getAll(); + console.log("Tümü:", allData); // Veri Silme await pxServ.removeData("temp"); await pxServ.removeData("light"); console.log("Veriler silindi."); } catch (err) { - console.error("Hata oluştu:", err); + console.error("Hata:", err); } })(); - ``` - -## Kullanım - -Bu kodları kendi projenize ekleyin ve gerekli kütüphaneleri yükledikten sonra çalıştırın. Kod, PxServ API'si ile veri ekleme, okuma ve silme işlemlerini gerçekleştirecektir. - -Örnek Çıktılar Aşağıda, konsolda görebileceğiniz örnek çıktılar bulunmaktadır: - -```javascript -Sıcaklık Kaydetme Sonucu: { status: 200, message: 'OK', data: {} } -Sıcaklık Okuma Sonucu { - status: 200, - message: 'OK', - data: { - lastUpdate: '2025-05-23T20:27:06.587Z', - icon: 'defaultIcon', - value: '24.3°C' +{% endtab %} +{% endtabs %} + +## Örnek Çıktı + +```json +Kaydetme: { "status": 200, "message": "OK", "data": {} } +Okuma: { + "status": 200, + "message": "OK", + "data": { + "lastUpdate": "2025-05-23T20:27:06.587Z", + "icon": "defaultIcon", + "value": "24.3°C" } } -Light Geçiş(Toggle) Sonucu: { status: 200, message: 'OK', data: {} } -Tüm Veriler: { - status: 200, - message: 'OK', - data: { - temp: { - lastUpdate: '2025-05-23T20:27:06.587Z', - icon: 'defaultIcon', - value: '24.3°C' +Geçiş: { "status": 200, "message": "OK", "data": {} } +Tümü: { + "status": 200, + "message": "OK", + "data": { + "temp": { + "lastUpdate": "2025-05-23T20:27:06.587Z", + "icon": "defaultIcon", + "value": "24.3°C" }, - light: { - lastUpdate: '2025-05-23T20:27:06.716Z', - icon: 'defaultIcon', - value: '1' + "light": { + "lastUpdate": "2025-05-23T20:27:06.716Z", + "icon": "defaultIcon", + "value": "1" } } } Veriler silindi. ``` - -Bu çıktılar, verilerin başarıyla eklendiğini, okunduğunu ve silindiğini göstermektedir. diff --git a/tr/ornek-projeler/README.md b/tr/ornek-projeler/README.md index e8bfb76..e69e91c 100644 --- a/tr/ornek-projeler/README.md +++ b/tr/ornek-projeler/README.md @@ -5,3 +5,9 @@ icon: vial # Örnek Projeler +Gerçek donanımla PxServ entegrasyonunu gösteren uçtan uca proje örnekleri. + +| Proje | Açıklama | +| ----- | -------- | +| [Ev Güvenlik Sistemi](ev-guvenlik-sistemi.md) | ESP32 ile gerçek zamanlı hareket algılama ve uyarı | +| [Akıllı Sıcaklık Monitörü](akilli-sicaklik-monitoru.md) | DHT11 ile periyodik sıcaklık ve nem kaydı | diff --git a/tr/ornek-projeler/akilli-sicaklik-monitoru.md b/tr/ornek-projeler/akilli-sicaklik-monitoru.md index fc0f7ff..c250599 100644 --- a/tr/ornek-projeler/akilli-sicaklik-monitoru.md +++ b/tr/ornek-projeler/akilli-sicaklik-monitoru.md @@ -1,6 +1,9 @@ # Akıllı Sıcaklık Monitörü +ESP32'ye bağlı bir DHT11 sensöründen sıcaklık ve nem okuyarak değerleri her 5 dakikada bir PxServ'e yükler. +**Donanım:** ESP32, DHT11 sensörü\ +**Kütüphaneler:** `WiFi.h`, `PxServ.h`, `DHT.h` ```cpp #include @@ -12,14 +15,14 @@ #define DHT_PIN 4 #define DHT_TYPE DHT11 -PxServ client("your_pxserv_api_key"); +PxServ client("pxserv_api_anahtariniz"); DHT dht(DHT_PIN, DHT_TYPE); void setup() { Serial.begin(115200); WiFi.begin(WIFI_SSID, WIFI_PASS); dht.begin(); - + while (WiFi.status() != WL_CONNECTED) { delay(500); } @@ -28,10 +31,10 @@ void setup() { void loop() { float temp = dht.readTemperature(); float hum = dht.readHumidity(); - + client.setData("temperature", String(temp)); client.setData("humidity", String(hum)); - - delay(300000); // Update every 5 minutes + + delay(300000); // 5 dakikalık aralık } ``` diff --git a/tr/ornek-projeler/ev-guvenlik-sistemi.md b/tr/ornek-projeler/ev-guvenlik-sistemi.md index d7399d2..bf6e6ca 100644 --- a/tr/ornek-projeler/ev-guvenlik-sistemi.md +++ b/tr/ornek-projeler/ev-guvenlik-sistemi.md @@ -1,5 +1,10 @@ # Ev Güvenlik Sistemi +ESP32'ye bağlı bir PIR sensörü kullanarak hareket algılar, bir zili tetikler ve PxServ'e uyarı gönderir. Sistem, PxServ paneli veya API aracılığıyla `system_status` anahtarı güncellenerek uzaktan devre dışı bırakılabilir. + +**Donanım:** ESP32, PIR hareket sensörü, zil\ +**Kütüphaneler:** `WiFi.h`, `PxServ.h` + ```cpp #include #include @@ -9,14 +14,14 @@ #define MOTION_SENSOR 5 #define BUZZER 6 -PxServ client("your_pxserv_api_key"); +PxServ client("pxserv_api_anahtariniz"); void setup() { Serial.begin(115200); pinMode(MOTION_SENSOR, INPUT); pinMode(BUZZER, OUTPUT); WiFi.begin(WIFI_SSID, WIFI_PASS); - + while (WiFi.status() != WL_CONNECTED) { delay(500); } @@ -24,17 +29,17 @@ void setup() { void loop() { if (digitalRead(MOTION_SENSOR) == HIGH) { - client.setData("alert", "Motion detected!"); + client.setData("alert", "Hareket algılandı!"); digitalWrite(BUZZER, HIGH); delay(1000); digitalWrite(BUZZER, LOW); } - + PxServ::Callback result = client.getData("system_status"); if (result.data == "disabled") { digitalWrite(BUZZER, LOW); } - + delay(1000); } ``` diff --git a/tr/rust-kutuphanesi.md b/tr/rust-kutuphanesi.md index 15368f3..cc46b08 100644 --- a/tr/rust-kutuphanesi.md +++ b/tr/rust-kutuphanesi.md @@ -4,11 +4,16 @@ icon: rust # Rust Kütüphanesi -Bu örnek kod, PxServ projesi ile veri tabanı işlemleri yapmanızı sağlar. Aşağıdaki işlemleri gerçekleştirebilirsiniz: +`pxserv` crate'i, Rust uygulamalarından PxServ API ile etkileşim kurmak için senkron bir istemci sağlar. -## Kurulum +**Desteklenen işlemler:** + +* Veritabanına veri kaydetme +* Değeri `0` ile `1` arasında geçiş yaptırma +* Veritabanından veri okuma +* Veritabanından veri silme -Projenize `pxserv` kütüphanesini eklemek için öncelikle terminalde şu satırı çalıştırın: +## Kurulum ```sh cargo add pxserv @@ -16,54 +21,47 @@ cargo add pxserv ## Kullanım -Aşağıda, PxServ kütüphanesinin nasıl kullanılacağını gösteren bir örnek bulunmaktadır: - ```rust use pxserv::PxServ; fn main() { - // API anahtarı ile PxServ class'ının bir instance'ını oluşturuyoruz - let client = PxServ::new("API_KEY"); + let client = PxServ::new("api_anahtariniz"); // Veri Kaydetme - // "temp" anahtarı ile sıcaklık verisini PxServ'e kaydediyoruz let set_response = client.setdata("temp", "22.5°C"); println!( - "Veri Kaydetme -> Durum: {}, Mesaj: {}", + "Kaydetme -> Durum: {}, Mesaj: {}", set_response.status, set_response.message ); - // Veri Geçişi - // "light" anahtarını 0 ile 1 arasında geçiş yapıyoruz (Aydınlatma durumu) + // Veri Geçişi (0 ile 1 arasında döngü) let toggle_response = client.toggledata("light"); println!( - "Veri Geçiş -> Durum: {}, Mesaj: {}", + "Geçiş -> Durum: {}, Mesaj: {}", toggle_response.status, toggle_response.message ); // Veri Okuma - // "temp" anahtarındaki sıcaklık verisini PxServ den okuyoruz let get_response = client.getdata("temp"); println!( - "Veri Okuma -> Durum: {}, Mesaj: {}, Veri: {:?}", + "Okuma -> Durum: {}, Mesaj: {}, Veri: {:?}", get_response.status, get_response.message, get_response.data ); // Veri Silme - // "temp" anahtarındaki sıcaklık verisini PxServ den siliyoruz let remove_response = client.removedata("temp"); println!( - "Veri Silme -> Durum: {}, Mesaj: {}", + "Kaldırma -> Durum: {}, Mesaj: {}", remove_response.status, remove_response.message ); } ``` -Örnek Çıktılar Aşağıda, konsolda görebileceğiniz örnek çıktılar bulunmaktadır +## Örnek Çıktı ``` -Veri Kaydetme -> Durum: 200, Mesaj: OK -Veri Geçiş -> Durum: 200, Mesaj: OK -Veri Okuma -> Durum: 200, Mesaj: OK, Veri: Some("22.5°C") -Veri Silme -> Durum: 200, Mesaj: OK +Kaydetme -> Durum: 200, Mesaj: OK +Geçiş -> Durum: 200, Mesaj: OK +Okuma -> Durum: 200, Mesaj: OK, Veri: Some("22.5°C") +Kaldırma -> Durum: 200, Mesaj: OK ```