Attempt 1
This commit is contained in:
34
AppServer/.env
Executable file
34
AppServer/.env
Executable file
@@ -0,0 +1,34 @@
|
||||
# Docker compose config file
|
||||
# PostgreSQL settings
|
||||
DB_USER=admin
|
||||
DB_PASSWORD=1234
|
||||
DB_HOST=pagerino_db
|
||||
DB_NAME=pager_data
|
||||
|
||||
# App server specific settings
|
||||
# === Chirpstack API
|
||||
CHIRP_API_KEY=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiJjaGlycHN0YWNrIiwiaXNzIjoiY2hpcnBzdGFjayIsInN1YiI6IjI3YzI5Y2M2LTdjMTUtNDI5Yy1iMjBmLTczNzliZWYzYTI1ZCIsInR5cCI6ImtleSJ9.RsMPIGgPaGluBllRz0Ma_EthxUj3xM9pTPy_uUEAbvk
|
||||
|
||||
# === MQTT broker settings
|
||||
MQTT_ADDRESS=ssl://mosquitto:8883
|
||||
MQTT_CLIENT_ID=app-server
|
||||
MQTT_QOS=0
|
||||
# This App's ID in Chirpstack
|
||||
# + matches all IDs
|
||||
# # matches all IDs and all(!) subtopics
|
||||
APP_ID=d6ccd2ad-0cf7-46ab-8618-7a5a14b8676d
|
||||
|
||||
# Enviroment variables that will be available for every application
|
||||
|
||||
# General version of the system
|
||||
VERSION=0.1
|
||||
|
||||
# Optional prefix for logging
|
||||
LOG_PREFIX=[Pagerino]
|
||||
|
||||
# Main app container name
|
||||
SERVER_NAME=pagerino-app
|
||||
SERVER_API_PORT=50222
|
||||
|
||||
# General preferred connection timeout
|
||||
TIMEOUT=3s
|
||||
31
AppServer/Dockerfile
Executable file
31
AppServer/Dockerfile
Executable file
@@ -0,0 +1,31 @@
|
||||
# [0] Go build environment
|
||||
FROM golang:1.24.5-alpine3.21 AS builder
|
||||
WORKDIR /app-server/src
|
||||
|
||||
## Dependencies
|
||||
# Get
|
||||
COPY ./src/go.mod ./src/go.sum ./
|
||||
# Download
|
||||
RUN go mod download
|
||||
|
||||
## Executable
|
||||
# Get
|
||||
COPY ./src .
|
||||
# Build
|
||||
RUN go build -o ../build/app_server
|
||||
|
||||
# [1] Final image -> new FS
|
||||
FROM alpine:latest
|
||||
WORKDIR /root/
|
||||
|
||||
# RUN apk add --no-cache ca-certificates
|
||||
# RUN apk add --no-cache bash
|
||||
|
||||
## Final build
|
||||
# Get
|
||||
COPY --from=builder /app-server/build ./build
|
||||
COPY ./certs ./certs
|
||||
COPY ./*.env ./build/
|
||||
|
||||
# Run the app
|
||||
CMD ["./build/app_server"]
|
||||
40
AppServer/Makefile
Normal file
40
AppServer/Makefile
Normal file
@@ -0,0 +1,40 @@
|
||||
# Makefile for compiling all proto files into Go
|
||||
|
||||
PROTO_IN := src/app_comm/proto
|
||||
PROTO_OUT := src/app_comm/api
|
||||
|
||||
# Find all .proto files recursively
|
||||
PROTO_FILES := $(shell find $(PROTO_IN) -name "*.proto")
|
||||
GO_FILES := $(shell find ./src/** -name "*.go")
|
||||
|
||||
# Default target
|
||||
all: proto
|
||||
|
||||
# Go build
|
||||
go: $(GO_FILES)
|
||||
@echo "Building Go application..."
|
||||
go build -o ../build/app_server -C src
|
||||
@echo "Done."
|
||||
|
||||
# Compile all proto files
|
||||
proto: $(PROTO_FILES)
|
||||
@echo "Generating Go code from proto files..."
|
||||
@for f in $(PROTO_FILES); do \
|
||||
base=$${f##*/}; \
|
||||
name=$${base%%.*}; \
|
||||
echo "Generating $$f -> $(PROTO_OUT)/$$name"; \
|
||||
mkdir -p $(PROTO_OUT)/$$name; \
|
||||
protoc -I=$(PROTO_IN) \
|
||||
--go_out=$(PROTO_OUT)/$$name --go_opt=paths=source_relative \
|
||||
--go-grpc_out=$(PROTO_OUT)/$$name --go-grpc_opt=paths=source_relative \
|
||||
$$f || exit 1; \
|
||||
done
|
||||
@echo "Done."
|
||||
|
||||
# Clean builds
|
||||
clean:
|
||||
@echo "Deleting built files..."
|
||||
rm -rf $(PROTO_OUT)/* build/*
|
||||
@echo "Done."
|
||||
|
||||
.PHONY: all clean
|
||||
61
AppServer/README.md
Executable file
61
AppServer/README.md
Executable file
@@ -0,0 +1,61 @@
|
||||
# Pagerino: **Application server**
|
||||
|
||||
### Description
|
||||
|
||||
Dockerized server communicating with Chirpstack (v4) and processing incoming data.
|
||||
|
||||
### Features
|
||||
|
||||
Current working and in-progress capabilities include:
|
||||
- receiving uplinks
|
||||
- sending downlinks
|
||||
- logging messages and telemetery
|
||||
- managing users, devices, messages and other objects
|
||||
- accepting api requests
|
||||
|
||||
### Configuration
|
||||
|
||||
Can be found in server.env:
|
||||
**CHIRP_API_KEY** - used to get more detailed information about the network
|
||||
of devices from Chirpstack
|
||||
|
||||
**MQTT_ADDRESS** - address for MQTT broker that manages uplinks & downlinks,
|
||||
do not change unless you reconfigure the chirpstack as well
|
||||
|
||||
**MQTT_CLIENT_ID** - ID to use when communicating with broker, can be anything
|
||||
|
||||
**MQTT_QOS** - quality of service level, leave at zero unless your network supports it
|
||||
|
||||
**APP_ID** - ID of accessing application registred in Chirpstack
|
||||
|
||||
**API_PORT** - port at which API is provided, this and its wrappers are the
|
||||
only way to officially communicate with the server
|
||||
|
||||
The app requires some other shared variables from shared.env.
|
||||
If not present, provide the following:
|
||||
**LOG_PREFIX**
|
||||
**SERVER_NAME**
|
||||
**TIMEOUT** - used for establishing connections
|
||||
|
||||
### Prerequisites
|
||||
|
||||
The server communicates through ssl with MQTT and needs the following files
|
||||
generated from Chirpstack in the certs directory:
|
||||
- ca.pem
|
||||
- client.key
|
||||
- client.pem
|
||||
|
||||
It uses Chirpstack's gRPC API, so it needs the compiled proto files into go in
|
||||
the src/app_comm/api directory.
|
||||
|
||||
### Usage
|
||||
|
||||
The server requires to be on the same docker network as MQTT broker and Chirpstack
|
||||
to properly function.
|
||||
|
||||
To start have Chirpstack v4 running in detached state and execute:
|
||||
```docker compose up```
|
||||
|
||||
|
||||
*Created by Olek \@ Gorak Industries*
|
||||
|
||||
30
AppServer/certs/ca.pem
Normal file
30
AppServer/certs/ca.pem
Normal file
@@ -0,0 +1,30 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIFETCCAvmgAwIBAgIUBcNVhGn2QaXZrzEfo7NEcktfjQowDQYJKoZIhvcNAQEL
|
||||
BQAwGDEWMBQGA1UEAwwNQ2hpcnBTdGFjay1DQTAeFw0yNTA5MDYyMjUwMzlaFw0y
|
||||
ODA5MDUyMjUwMzlaMBgxFjAUBgNVBAMMDUNoaXJwU3RhY2stQ0EwggIiMA0GCSqG
|
||||
SIb3DQEBAQUAA4ICDwAwggIKAoICAQDKru8yd0ZYdoxDgL0Ls2IiL5+oYmyoEIAq
|
||||
GKaQltKOUMBMLOaDXum+/aEnCVoch5yzX7As/rIAH1p6rrGy5HJs7xww1ls5yjon
|
||||
IcVjlpWMnH3PecilVQuZOXEeny2h6zIVaK0aThVB3/+pEVY3nprk9i29KEz+8biU
|
||||
ykDce30EvemV4g6hF7AfrGiSv/EFLNTyX9YBPZ9LgbC1EHd4W07vYIz67JNcuw42
|
||||
xyYSMnp0hsxBiXv7KXlu2h5MjzNOXR8fI9WEkg5BkmVX6h+Uruvaw26uw5prXbYp
|
||||
FtakDjnnQ+wS7Q3Jl7e0hF4pejvfgZoqJZXErUpRGIPBGD2Gxm+S5J2RahaUOvKY
|
||||
AQg32okeoOtwv0YoP4Tei3HPyQkKjgGCWjMog3yUCG7z59zXilcl6GvESZEEh0Q/
|
||||
M0VKOzh85MnWSJ2otppjCYzzklyUwm5zvWiUS3xQr6e3EapsthS5ccuAzNa++LMU
|
||||
Vs6TO7U8BshbgNFUqpc7exBdPPdGVzKbzidwJeanshLy0+zc2ZUH+nIdlmQRSlM1
|
||||
cyUk0Z5N0X6so3NouHSag7lhqYBGmESX+P4dOqhwgFw4EfmuSLdduXVehU2Cca/1
|
||||
6e7YQi+Zy9lHLCN1kmHU0Eu8xoaDH0D3jnKccrWqsV/fiiainAUnTxHkzV8K8guq
|
||||
3iTrcBsI2QIDAQABo1MwUTAdBgNVHQ4EFgQUFYNQfsgbp5HNBPVNlZ12GSM3FAIw
|
||||
HwYDVR0jBBgwFoAUFYNQfsgbp5HNBPVNlZ12GSM3FAIwDwYDVR0TAQH/BAUwAwEB
|
||||
/zANBgkqhkiG9w0BAQsFAAOCAgEAMgeVJHzXHdS47agDhqkz4gPQl4ynohXaZIUw
|
||||
3tMDLayjj2MuQ/LDuk2by4FTwWCTGGYhbv0WMaPueatdZVygmokh4jXhux+6Yen7
|
||||
fBeqV5hkzhl9BPPaMp9Et2FZRYLMkaNXYcEc697NZUQSWkR2VbJ3P+wMk9N61T6n
|
||||
q0tUdtWW/2EB5w0TtN+Qz2EcANUD1dqdTQkZUUR7yCWbOvUeUvyqx2GBYA9QWxtT
|
||||
Vg+t4TlXpbSd/28jxpJwjFCrG+kcoyDnnmCqlfKQX3uj0mnuXg0sgKzwf6OroPgR
|
||||
7wUjL3/RtlQhxxhen2tAoYThVQ6WMfxioSZPUKzkfapib5/pbb2t/srxb7D35ho+
|
||||
Iw1qZCIZ1vpRQ7sKeOXqmDmq6wiIHKP3D0ODsppond2BKagb3umJ7LKV3k6hnOTo
|
||||
vCsnotXXT2apO4S2YcfQ4yTCW6E05Qo8S7hSzXB8RQpq5gGUSB78DB7tAkhf9RIQ
|
||||
Ek9O+fBDv2LqyPxLUZM7eyaXQ8RzhpQqO+MYESAQgwxu5etPJTjLMxB8eIxrWY0H
|
||||
CTnTHmKmpbL9YrU4903YvpTh2NDB/0VmlQe9S1PU0FqPws5fCZtaAK4P9Gsfv59j
|
||||
CiMy2OPUDMrItR/pl3zSAof2lHN1Tp/Lg9yIY5udgwCDzXo7ajxnbL1W+qLC9pq4
|
||||
v/HHA+g=
|
||||
-----END CERTIFICATE-----
|
||||
28
AppServer/certs/client.key
Normal file
28
AppServer/certs/client.key
Normal file
@@ -0,0 +1,28 @@
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDR4rPIgeFuktPQ
|
||||
KRh2DLhUI4IvA+RYOvIjlQRAOawXiQYe/RMwdCsEul36Nsdj+6RQtsANIXgYqdRJ
|
||||
t8x+pdzmMeczs9dSJcJMZPt3XnMMeW5lV+MeuehzqcVn1xqNYfP8nL7EUGgpXH5t
|
||||
68bE8xqM8/e/uIwX046WGD2dqbH+WBseJeyo2Zo9mS9jECVv20h1Dzxl3A6tvHB+
|
||||
vBxHgZX9X22V0sW5p2oP29CmjG0ETKRznXKCh0udMOiTfkGL4HQ5MTAlXNKaHcO5
|
||||
pLow8qGEhG06/s8A+2TahAveGf1dbdzrj2XlaX+FgcYBgeMOLXloFghg77B1C0NI
|
||||
Fb5dYk1nAgMBAAECggEAJidRakYd/lVHluQZk8AdNAJedIB/HoDcqpY4txokzAR3
|
||||
LePwfJLpjQr58XXKykSg6qFGCT0H0Wfx9NKqJG2vWdNBhbcQEdlWWD/VLK5pOJ/M
|
||||
bzTKTzgZZwk6HvXN2Fyxlz7BOPuq67XqL744HG5a6buh0mLQaLZnCabvcH08I5F5
|
||||
VRYq60cEzjVuRzCYwBQuoQi7I4ovIvcKVVQTQ6nPsFlk9CgmBUUK3xzV+ZJSGnZ+
|
||||
SzgCXL3XmCdzd2Y/Yhsu4uLNd/LdCuUbgU+audyML+JA5MoiTKHw9fiv9yBeMngA
|
||||
vdQSM/tMhYDv2liCEMSql7BeQ95/ofv/S7HudF4Z4QKBgQDszjAU//i97efvPRk1
|
||||
36taBwCmsnrhK3gHchUdmorU/I1+/2vUh59lf2MHdTpraHWzI1wutCDMOL2PGM5K
|
||||
CDy2pX8CDM0PBCQUFk+ZeAiGZPyRzOX5OkttqJQId7VzKTzwC9f/9j04rKzY05ps
|
||||
ga40HpceF5QIfyqmMRgYNTNk4QKBgQDi5ep5m10VDou1/3Xbd8yu+zSVPl6H6ti8
|
||||
t3bWdI4/xQF6mowR7Hu6mTlMDBXr44hzjJDdw5Zgfg2GZJJGWM/o5U3jCvwQmtbV
|
||||
loXwAl246aZ2DvUQ5S9KxoEEZzZ+j44EvX1bmOiOeLR+OsHRTySt5RfFziDMv6jo
|
||||
/irCp5izRwKBgAGXAMujTFA6IKyChIDQF55rHZ4A5MJOQGgMZAfm2bfEWk7X+Cld
|
||||
H7zWtht+tf2yndeuDRhjLTUxzFQBnqDwnTe8tLWW0GmhZXydCbvGCoicdPWlooWh
|
||||
1o/N6fCEnTtAs6AI9FJLnO2ceyyZfxfrZvgCnJEfJ2dHM0oaWkcPVGEBAoGAIa7i
|
||||
BRWEVvjm0qjO1TrOnvdZ0gIFRIYfkLxnnuSErYDQfGPvAUYrBAN1Fw4APxlzCzxF
|
||||
0TYU39Q2q8nIUTsj+j34NwlNbCWgWOrUjVG8mhPNi18jEFQFlkMrqfysgVNMUPXU
|
||||
Y0Gq3GOc39RXK3xlRI9q3QmBowOczqHUtTruF0cCgYEA1XncVWT6ioOhpiv9YXH6
|
||||
+GtBeVO8BCyDMiH8cJWYjU1LaljWNmzZDHfWH+cCpb4tNd9RmIhQO27FKVl9BVX7
|
||||
xKbi6BXkj8m8H2V7AqCQu/NSKwsYXpAmRLC7vfUqbqlkNPFQSB0gHpIAIrLo2Fjx
|
||||
hEQcS/cfNEHjKBGNPvFmiTE=
|
||||
-----END PRIVATE KEY-----
|
||||
25
AppServer/certs/client.pem
Normal file
25
AppServer/certs/client.pem
Normal file
@@ -0,0 +1,25 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIEKjCCAhKgAwIBAgIUX/8vMc8novU3n+VgW4ToUseWZaUwDQYJKoZIhvcNAQEL
|
||||
BQAwGDEWMBQGA1UEAwwNQ2hpcnBTdGFjay1DQTAeFw0yNTA5MDYyMjUwMzlaFw0y
|
||||
NjA5MDYyMjUwMzlaMBUxEzARBgNVBAMMCmNoaXJwc3RhY2swggEiMA0GCSqGSIb3
|
||||
DQEBAQUAA4IBDwAwggEKAoIBAQDR4rPIgeFuktPQKRh2DLhUI4IvA+RYOvIjlQRA
|
||||
OawXiQYe/RMwdCsEul36Nsdj+6RQtsANIXgYqdRJt8x+pdzmMeczs9dSJcJMZPt3
|
||||
XnMMeW5lV+MeuehzqcVn1xqNYfP8nL7EUGgpXH5t68bE8xqM8/e/uIwX046WGD2d
|
||||
qbH+WBseJeyo2Zo9mS9jECVv20h1Dzxl3A6tvHB+vBxHgZX9X22V0sW5p2oP29Cm
|
||||
jG0ETKRznXKCh0udMOiTfkGL4HQ5MTAlXNKaHcO5pLow8qGEhG06/s8A+2TahAve
|
||||
Gf1dbdzrj2XlaX+FgcYBgeMOLXloFghg77B1C0NIFb5dYk1nAgMBAAGjbzBtMAkG
|
||||
A1UdEwQCMAAwCwYDVR0PBAQDAgWgMBMGA1UdJQQMMAoGCCsGAQUFBwMCMB0GA1Ud
|
||||
DgQWBBS5GafUu7Y6QBp76DKG+aGP2XpBMzAfBgNVHSMEGDAWgBQVg1B+yBunkc0E
|
||||
9U2VnXYZIzcUAjANBgkqhkiG9w0BAQsFAAOCAgEABykbcO04AfW9hiSSmp+aI6iF
|
||||
1867xhTeIPgAHhDAfMgSCc2B0NFccKn+XVK8LkcEP1B8OM1g6m6JdO1eAeKZgwWY
|
||||
SMxbmT0uTe3+A7GfAHZw6XXQwB7MoMNzfvM98ishi+zWEbzL2nH3y+zgxMdTH4Ar
|
||||
t94dcjiEbASHVI1MzIWZQohkS/Nof5sSPwDU90DlsoviUY1HswBq7SR3KK+SDSn6
|
||||
h46S0R3S3Hn0u+5mxHnkAuSJ0tjEfK0DUSf5hdWOiKQusi1et2VgVyKhc0/+et8K
|
||||
m/KhzYctfAdEjFkH4j5rqanlX2D6OeAYv26B6l2QgiDF4n3ezTKEcfjUFX4C/LDg
|
||||
mxX14LoDm9wWkIp2C+WaaXaSN+bew9u8UhJqVgs7cw5yCk7l8i0XsfpvNce8Wv3V
|
||||
JCBk9hVpgpPRYNDOmcvdAUIxTqCQSqm29qMEGb+XXJFQl+ZujaEQ1T1oJMZlJ4mV
|
||||
mRn6oF5lA0dU2Pu8l7R9l0F2wnwBrc+JWKFiVi81tAPrKG/COalQ4zyno3zUiTl0
|
||||
3BJo/Ey+IS1aeWdWK0kvG+fsVytvDJCKG7VrErRg9qiZ18avPz3wGl8uGX8n0Nel
|
||||
TA32TeBE22oa1qAfyhSrtfEMpOsQxQ+yYIaFcwLQWuU2Zlz1zejXjz9iS1VTIZNy
|
||||
nWHD6N8iJHz/kQjCZuA=
|
||||
-----END CERTIFICATE-----
|
||||
39
AppServer/docker-compose.yml
Normal file
39
AppServer/docker-compose.yml
Normal file
@@ -0,0 +1,39 @@
|
||||
version: '3.0'
|
||||
|
||||
services:
|
||||
app_server:
|
||||
build: .
|
||||
depends_on:
|
||||
- pagerino_db
|
||||
networks:
|
||||
- app_net
|
||||
- pagerino_net
|
||||
restart: on-failure:3
|
||||
|
||||
pagerino_db:
|
||||
image: postgres:15
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_USER: ${DB_USER}
|
||||
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
||||
POSTGRES_DB: ${DB_NAME}
|
||||
networks:
|
||||
- app_net
|
||||
volumes:
|
||||
- dbdata:/var/lib/postgresql/data
|
||||
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
|
||||
- ./postgresql.conf:/etc/postgresql/postgresql.conf
|
||||
command: ["postgres", "-c", "config_file=/etc/postgresql/postgresql.conf"]
|
||||
# ports:
|
||||
# - "5432:5432"
|
||||
|
||||
|
||||
volumes:
|
||||
dbdata:
|
||||
|
||||
networks:
|
||||
app_net:
|
||||
driver: bridge
|
||||
pagerino_net:
|
||||
external: true
|
||||
|
||||
122
AppServer/init.sql
Executable file
122
AppServer/init.sql
Executable file
@@ -0,0 +1,122 @@
|
||||
--CREATE EXTENSION IF NOT EXISTS postgis;
|
||||
CREATE EXTENSION IF NOT EXISTS hstore;
|
||||
|
||||
CREATE DATABASE pager_data;
|
||||
CREATE USER admin WITH ENCRYPTED PASSWORD '1234';
|
||||
GRANT ALL PRIVILEGES ON DATABASE pager_data TO admin;
|
||||
|
||||
-- === Devices ===
|
||||
CREATE TABLE Devices (
|
||||
id SERIAL PRIMARY KEY,
|
||||
created_at TIMESTAMPTZ DEFAULT NOW(),
|
||||
|
||||
euid VARCHAR(16) NOT NULL UNIQUE, -- LoRaWAN Extended Unique ID (hex, 8 bytes)
|
||||
name VARCHAR(64) NOT NULL, -- ! Not Unique
|
||||
|
||||
fw_version VARCHAR(24) NOT NULL,
|
||||
|
||||
charge NUMERIC(5,2) CHECK (charge >= 0 AND charge <= 100), -- battery in %
|
||||
last_online TIMESTAMPTZ, -- ! NULL
|
||||
|
||||
-- Location fields:
|
||||
latitude DOUBLE PRECISION CHECK (latitude >= -90 AND latitude <= 90),
|
||||
longitude DOUBLE PRECISION CHECK (longitude >= -180 AND longitude <= 180),
|
||||
altitude DOUBLE PRECISION
|
||||
);
|
||||
|
||||
CREATE TABLE Messages (
|
||||
id SERIAL PRIMARY KEY,
|
||||
created_at TIMESTAMPTZ DEFAULT NOW(),
|
||||
|
||||
sender_id INT NOT NULL REFERENCES Devices(id) ON DELETE SET NULL,
|
||||
receiver_id INT REFERENCES Devices(id) ON DELETE SET NULL, -- ! NULL
|
||||
payload VARCHAR(256)
|
||||
);
|
||||
|
||||
CREATE TABLE Statuses (
|
||||
id SERIAL PRIMARY KEY,
|
||||
created_at TIMESTAMPTZ DEFAULT NOW(),
|
||||
|
||||
device_id INT NOT NULL REFERENCES Devices(id) ON DELETE CASCADE,
|
||||
payload VARCHAR(256)
|
||||
);
|
||||
|
||||
-- === Roles ===
|
||||
CREATE TABLE Roles (
|
||||
id SERIAL PRIMARY KEY,
|
||||
created_at TIMESTAMPTZ DEFAULT NOW(),
|
||||
|
||||
name VARCHAR(64) NOT NULL UNIQUE,
|
||||
description VARCHAR(128) NOT NULL DEFAULT 'Role description'
|
||||
);
|
||||
|
||||
INSERT INTO Roles (name, description) VALUES ('Admin', 'Should do everything.'); -- Admin role
|
||||
|
||||
CREATE TABLE Permissions (
|
||||
id SERIAL PRIMARY KEY,
|
||||
created_at TIMESTAMPTZ DEFAULT NOW(),
|
||||
|
||||
name VARCHAR(64) NOT NULL UNIQUE,
|
||||
description VARCHAR(128) NOT NULL DEFAULT 'Permission description'
|
||||
);
|
||||
|
||||
INSERT INTO Permissions (name, description) VALUES ('Everything', 'Can do everything.'); -- Admin permission
|
||||
|
||||
-- Join table for Roles & Permissions
|
||||
CREATE TABLE RolesPermissions (
|
||||
role_id INT NOT NULL REFERENCES Roles(id),
|
||||
permission_id INT NOT NULL REFERENCES Permissions(id)
|
||||
);
|
||||
|
||||
INSERT INTO RolesPermissions (role_id, permission_id) VALUES (1, 1); -- Tie together role & permission
|
||||
|
||||
-- === Users ===
|
||||
CREATE TABLE Users (
|
||||
id SERIAL PRIMARY KEY,
|
||||
created_at TIMESTAMPTZ DEFAULT NOW(),
|
||||
|
||||
name VARCHAR(64) UNIQUE NOT NULL,
|
||||
password VARCHAR(64) NOT NULL,
|
||||
role_id INT DEFAULT 2 REFERENCES Roles(id) ON DELETE SET DEFAULT, -- default low privilleges
|
||||
last_online TIMESTAMPTZ -- ! NULL
|
||||
);
|
||||
|
||||
INSERT INTO Users (name, password, role_id) VALUES ('Admin', 'admin', 1); -- Admin user
|
||||
|
||||
CREATE TABLE NFC_Cards (
|
||||
id SERIAL PRIMARY KEY,
|
||||
created_at TIMESTAMPTZ DEFAULT NOW(),
|
||||
|
||||
user_id INT REFERENCES Users(id) ON DELETE SET NULL, -- ! NULL
|
||||
device_id INT REFERENCES Devices(id) ON DELETE SET NULL, -- ! NULL
|
||||
uid VARCHAR(7) NOT NULL UNIQUE,
|
||||
CONSTRAINT uid_length CHECK (length(uid) = 4 OR length(uid) = 7) -- Check for valid UUID
|
||||
);
|
||||
|
||||
-- === Logs ===
|
||||
CREATE TABLE Logs (
|
||||
id SERIAL PRIMARY KEY,
|
||||
created_at TIMESTAMPTZ DEFAULT NOW(),
|
||||
|
||||
db_user TEXT DEFAULT current_user
|
||||
);
|
||||
|
||||
CREATE TABLE LogsUsers (
|
||||
log_id INT REFERENCES Logs(id) ON DELETE CASCADE,
|
||||
user_id INT REFERENCES Users(id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE TABLE LogsDevices (
|
||||
log_id INT REFERENCES Logs(id) ON DELETE CASCADE,
|
||||
device_id INT REFERENCES Devices(id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE TABLE Changes (
|
||||
id SERIAL PRIMARY KEY,
|
||||
log_id INT NOT NULL REFERENCES Logs(id) ON DELETE CASCADE,
|
||||
table_name TEXT NOT NULL,
|
||||
operation TEXT NOT NULL,
|
||||
old_value hstore, -- ! NULL
|
||||
new_value hstore, -- ! NULL
|
||||
CONSTRAINT change_diff CHECK (old_value != new_value)
|
||||
);
|
||||
3
AppServer/postgresql.conf
Executable file
3
AppServer/postgresql.conf
Executable file
@@ -0,0 +1,3 @@
|
||||
log_connections = on
|
||||
log_destination = 'stderr'
|
||||
listen_addresses='*'
|
||||
180
AppServer/src/api.go
Normal file
180
AppServer/src/api.go
Normal file
@@ -0,0 +1,180 @@
|
||||
/*
|
||||
Implements gRPC API server.
|
||||
|
||||
Author: Olek
|
||||
*/
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
api_common "server/app_comm/api/common"
|
||||
api_device "server/app_comm/api/device"
|
||||
api_user "server/app_comm/api/user"
|
||||
|
||||
"github.com/jackc/pgx/v5"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrNoIndex error = errors.New("no valid index provided for request")
|
||||
)
|
||||
|
||||
// === Device Service ===
|
||||
type DeviceServiceServer struct {
|
||||
api_device.UnimplementedDeviceServiceServer
|
||||
App *AppData
|
||||
}
|
||||
|
||||
func (s *DeviceServiceServer) GetFull(ctx context.Context, index *api_common.StrIndex) (*api_device.DeviceAllInfo, error) {
|
||||
info := api_device.DeviceAllInfo{}
|
||||
var err error
|
||||
var row pgx.Row
|
||||
var deviceId int32
|
||||
|
||||
switch index.Id.(type) {
|
||||
case *api_common.StrIndex_Num: // Indexing by DB ID
|
||||
deviceId = index.GetNum()
|
||||
|
||||
row = s.App.DBPool.QueryRow(ctx, `
|
||||
SELECT euid, name, fw_version, charge, last_online, latitude, longitude, altitude
|
||||
FROM Devices WHERE id = $1;`,
|
||||
deviceId,
|
||||
)
|
||||
err = row.Scan(
|
||||
&info.Euid,
|
||||
&info.Name,
|
||||
&info.FwVersion,
|
||||
&info.Charge,
|
||||
&info.LastOnline,
|
||||
&info.Latitude,
|
||||
&info.Longitude,
|
||||
&info.Altitude,
|
||||
)
|
||||
case *api_common.StrIndex_Name: // Indexing by EUID
|
||||
euid := index.GetName()
|
||||
info.Euid = euid
|
||||
|
||||
row = s.App.DBPool.QueryRow(ctx, `
|
||||
SELECT name, fw_version, charge, last_online, latitude, longitude, altitude, id
|
||||
FROM Devices WHERE euid = $1;`,
|
||||
euid,
|
||||
)
|
||||
err = row.Scan(
|
||||
&info.Name,
|
||||
&info.FwVersion,
|
||||
&info.Charge,
|
||||
&info.LastOnline,
|
||||
&info.Latitude,
|
||||
&info.Longitude,
|
||||
&info.Altitude,
|
||||
&deviceId,
|
||||
)
|
||||
default: // Zeroed out
|
||||
return nil, ErrNoIndex
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return &info, err
|
||||
}
|
||||
|
||||
// Fetch latest Status
|
||||
row = s.App.DBPool.QueryRow(ctx, `
|
||||
SELECT internal_status, native_status
|
||||
FROM Statuses
|
||||
WHERE device_id = $1
|
||||
ORDER BY created_at DESC LIMIT 1;`, deviceId,
|
||||
)
|
||||
var int_status int16
|
||||
var nat_status string
|
||||
err = row.Scan(&int_status, &nat_status)
|
||||
if err != nil && !errors.Is(err, pgx.ErrNoRows) {
|
||||
return &info, err
|
||||
}
|
||||
info.InternalStatus = int32(int_status)
|
||||
info.NativeStatus = nat_status
|
||||
|
||||
// Fetch paired cards
|
||||
row = s.App.DBPool.QueryRow(ctx, `
|
||||
SELECT id
|
||||
FROM NFC_Cards
|
||||
WHERE device_id = $1
|
||||
ORDER BY created_at DESC;`, deviceId,
|
||||
)
|
||||
var card_ids []int32
|
||||
err = row.Scan(&card_ids)
|
||||
if err != nil && !errors.Is(err, pgx.ErrNoRows) {
|
||||
return &info, err
|
||||
}
|
||||
info.CardIds = card_ids
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
func (s *DeviceServiceServer) GetInfo(ctx context.Context, index *api_common.StrIndex) (*api_device.DeviceBaseInfo, error) {
|
||||
var err error
|
||||
var row pgx.Row
|
||||
var deviceId int32
|
||||
info := api_device.DeviceBaseInfo{}
|
||||
|
||||
switch index.Id.(type) {
|
||||
case *api_common.StrIndex_Num:
|
||||
row = s.App.DBPool.QueryRow(ctx, "SELECT (id, name, euid, last_online) FROM Devices WHERE id = $1;", index.GetNum())
|
||||
err = row.Scan(&deviceId, &info.Name, &info.Euid, &info.LastOnline)
|
||||
case *api_common.StrIndex_Name:
|
||||
euid := index.GetName()
|
||||
info.Euid = euid
|
||||
|
||||
row = s.App.DBPool.QueryRow(ctx, "SELECT (id, name, last_online) FROM Devices WHERE euid = $1;", euid)
|
||||
err = row.Scan(&deviceId, &info.Name, &info.LastOnline)
|
||||
default:
|
||||
return nil, ErrNoIndex
|
||||
}
|
||||
|
||||
if err != nil && !errors.Is(err, pgx.ErrNoRows) {
|
||||
return &info, err
|
||||
}
|
||||
|
||||
row = s.App.DBPool.QueryRow(ctx, `
|
||||
SELECT internal_status
|
||||
FROM Statuses
|
||||
WHERE device_id = $1
|
||||
ORDER BY created_at DESC LIMIT 1;`, deviceId,
|
||||
)
|
||||
var status int16
|
||||
err = row.Scan(&status)
|
||||
if err != nil && !errors.Is(err, pgx.ErrNoRows) {
|
||||
return &info, err
|
||||
}
|
||||
|
||||
info.InternalStatus = int32(status)
|
||||
|
||||
return &info, err
|
||||
}
|
||||
|
||||
// === User Service ===
|
||||
type UserServiceServer struct {
|
||||
api_user.UnimplementedUserServiceServer
|
||||
App *AppData
|
||||
}
|
||||
|
||||
func (s *UserServiceServer) GetPassword(ctx context.Context, index *api_common.StrIndex) (*api_user.Password, error) {
|
||||
var err error
|
||||
var row pgx.Row
|
||||
info := api_user.Password{}
|
||||
|
||||
switch index.Id.(type) {
|
||||
case *api_common.StrIndex_Num:
|
||||
row = s.App.DBPool.QueryRow(ctx, "SELECT password FROM Users WHERE id = $1;", index.GetNum())
|
||||
err = row.Scan(&info.Password)
|
||||
case *api_common.StrIndex_Name:
|
||||
row = s.App.DBPool.QueryRow(ctx, "SELECT password FROM Users WHERE name = $1;", index.GetName())
|
||||
err = row.Scan(&info.Password)
|
||||
default:
|
||||
return nil, ErrNoIndex
|
||||
}
|
||||
|
||||
return &info, err
|
||||
}
|
||||
|
||||
//TODO: finish
|
||||
278
AppServer/src/app_comm/api/change/change.pb.go
Normal file
278
AppServer/src/app_comm/api/change/change.pb.go
Normal file
@@ -0,0 +1,278 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.25.0-devel
|
||||
// protoc v3.14.0
|
||||
// source: change.proto
|
||||
|
||||
package api_change
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
common "server/app_comm/api/common"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type ChageAllInfo struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
OldValue string `protobuf:"bytes,1,opt,name=old_value,json=oldValue,proto3" json:"old_value,omitempty"`
|
||||
NewValue string `protobuf:"bytes,2,opt,name=new_value,json=newValue,proto3" json:"new_value,omitempty"`
|
||||
TableName string `protobuf:"bytes,3,opt,name=table_name,json=tableName,proto3" json:"table_name,omitempty"`
|
||||
Operation string `protobuf:"bytes,4,opt,name=operation,proto3" json:"operation,omitempty"`
|
||||
LogId int32 `protobuf:"varint,5,opt,name=log_id,json=logId,proto3" json:"log_id,omitempty"`
|
||||
}
|
||||
|
||||
func (x *ChageAllInfo) Reset() {
|
||||
*x = ChageAllInfo{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_change_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ChageAllInfo) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ChageAllInfo) ProtoMessage() {}
|
||||
|
||||
func (x *ChageAllInfo) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_change_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ChageAllInfo.ProtoReflect.Descriptor instead.
|
||||
func (*ChageAllInfo) Descriptor() ([]byte, []int) {
|
||||
return file_change_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *ChageAllInfo) GetOldValue() string {
|
||||
if x != nil {
|
||||
return x.OldValue
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ChageAllInfo) GetNewValue() string {
|
||||
if x != nil {
|
||||
return x.NewValue
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ChageAllInfo) GetTableName() string {
|
||||
if x != nil {
|
||||
return x.TableName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ChageAllInfo) GetOperation() string {
|
||||
if x != nil {
|
||||
return x.Operation
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ChageAllInfo) GetLogId() int32 {
|
||||
if x != nil {
|
||||
return x.LogId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type Values struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
OldValue string `protobuf:"bytes,1,opt,name=old_value,json=oldValue,proto3" json:"old_value,omitempty"`
|
||||
NewValue string `protobuf:"bytes,2,opt,name=new_value,json=newValue,proto3" json:"new_value,omitempty"`
|
||||
}
|
||||
|
||||
func (x *Values) Reset() {
|
||||
*x = Values{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_change_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Values) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Values) ProtoMessage() {}
|
||||
|
||||
func (x *Values) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_change_proto_msgTypes[1]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Values.ProtoReflect.Descriptor instead.
|
||||
func (*Values) Descriptor() ([]byte, []int) {
|
||||
return file_change_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *Values) GetOldValue() string {
|
||||
if x != nil {
|
||||
return x.OldValue
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Values) GetNewValue() string {
|
||||
if x != nil {
|
||||
return x.NewValue
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_change_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_change_proto_rawDesc = []byte{
|
||||
0x0a, 0x0c, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f,
|
||||
0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x1a,
|
||||
0x0c, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x9c, 0x01,
|
||||
0x0a, 0x0c, 0x43, 0x68, 0x61, 0x67, 0x65, 0x41, 0x6c, 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1b,
|
||||
0x0a, 0x09, 0x6f, 0x6c, 0x64, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x08, 0x6f, 0x6c, 0x64, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x6e,
|
||||
0x65, 0x77, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,
|
||||
0x6e, 0x65, 0x77, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x74, 0x61, 0x62, 0x6c,
|
||||
0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x61,
|
||||
0x62, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6f, 0x70, 0x65, 0x72,
|
||||
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x15, 0x0a, 0x06, 0x6c, 0x6f, 0x67, 0x5f, 0x69, 0x64, 0x18,
|
||||
0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x6f, 0x67, 0x49, 0x64, 0x22, 0x42, 0x0a, 0x06,
|
||||
0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6f, 0x6c, 0x64, 0x5f, 0x76, 0x61,
|
||||
0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6f, 0x6c, 0x64, 0x56, 0x61,
|
||||
0x6c, 0x75, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x6e, 0x65, 0x77, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x65, 0x77, 0x56, 0x61, 0x6c, 0x75, 0x65,
|
||||
0x32, 0xc6, 0x01, 0x0a, 0x0d, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69,
|
||||
0x63, 0x65, 0x12, 0x3a, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x44, 0x69, 0x66, 0x66, 0x12, 0x16, 0x2e,
|
||||
0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e,
|
||||
0x49, 0x6e, 0x64, 0x65, 0x78, 0x1a, 0x17, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f,
|
||||
0x2e, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3f,
|
||||
0x0a, 0x06, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x12, 0x16, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72,
|
||||
0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x49, 0x6e, 0x64, 0x65, 0x78,
|
||||
0x1a, 0x1d, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x68, 0x61, 0x6e,
|
||||
0x67, 0x65, 0x2e, 0x43, 0x68, 0x61, 0x67, 0x65, 0x41, 0x6c, 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x12,
|
||||
0x38, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x12, 0x16, 0x2e, 0x70, 0x61, 0x67,
|
||||
0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x49, 0x6e, 0x64,
|
||||
0x65, 0x78, 0x1a, 0x15, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6f,
|
||||
0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x42, 0x27, 0x5a, 0x25, 0x73, 0x65, 0x72,
|
||||
0x76, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x70, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x2f, 0x61, 0x70, 0x69,
|
||||
0x2f, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x3b, 0x61, 0x70, 0x69, 0x5f, 0x63, 0x68, 0x61, 0x6e,
|
||||
0x67, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_change_proto_rawDescOnce sync.Once
|
||||
file_change_proto_rawDescData = file_change_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_change_proto_rawDescGZIP() []byte {
|
||||
file_change_proto_rawDescOnce.Do(func() {
|
||||
file_change_proto_rawDescData = protoimpl.X.CompressGZIP(file_change_proto_rawDescData)
|
||||
})
|
||||
return file_change_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_change_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||
var file_change_proto_goTypes = []interface{}{
|
||||
(*ChageAllInfo)(nil), // 0: pagerino.change.ChageAllInfo
|
||||
(*Values)(nil), // 1: pagerino.change.Values
|
||||
(*common.Index)(nil), // 2: pagerino.common.Index
|
||||
(*common.Meta)(nil), // 3: pagerino.common.Meta
|
||||
}
|
||||
var file_change_proto_depIdxs = []int32{
|
||||
2, // 0: pagerino.change.ChangeService.GetDiff:input_type -> pagerino.common.Index
|
||||
2, // 1: pagerino.change.ChangeService.GetAll:input_type -> pagerino.common.Index
|
||||
2, // 2: pagerino.change.ChangeService.GetMeta:input_type -> pagerino.common.Index
|
||||
1, // 3: pagerino.change.ChangeService.GetDiff:output_type -> pagerino.change.Values
|
||||
0, // 4: pagerino.change.ChangeService.GetAll:output_type -> pagerino.change.ChageAllInfo
|
||||
3, // 5: pagerino.change.ChangeService.GetMeta:output_type -> pagerino.common.Meta
|
||||
3, // [3:6] is the sub-list for method output_type
|
||||
0, // [0:3] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_change_proto_init() }
|
||||
func file_change_proto_init() {
|
||||
if File_change_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_change_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ChageAllInfo); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_change_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Values); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_change_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 2,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_change_proto_goTypes,
|
||||
DependencyIndexes: file_change_proto_depIdxs,
|
||||
MessageInfos: file_change_proto_msgTypes,
|
||||
}.Build()
|
||||
File_change_proto = out.File
|
||||
file_change_proto_rawDesc = nil
|
||||
file_change_proto_goTypes = nil
|
||||
file_change_proto_depIdxs = nil
|
||||
}
|
||||
178
AppServer/src/app_comm/api/change/change_grpc.pb.go
Normal file
178
AppServer/src/app_comm/api/change/change_grpc.pb.go
Normal file
@@ -0,0 +1,178 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
|
||||
package api_change
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
common "server/app_comm/api/common"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.32.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion7
|
||||
|
||||
// ChangeServiceClient is the client API for ChangeService service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type ChangeServiceClient interface {
|
||||
// === DB information
|
||||
GetDiff(ctx context.Context, in *common.Index, opts ...grpc.CallOption) (*Values, error)
|
||||
GetAll(ctx context.Context, in *common.Index, opts ...grpc.CallOption) (*ChageAllInfo, error)
|
||||
// Common
|
||||
GetMeta(ctx context.Context, in *common.Index, opts ...grpc.CallOption) (*common.Meta, error)
|
||||
}
|
||||
|
||||
type changeServiceClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewChangeServiceClient(cc grpc.ClientConnInterface) ChangeServiceClient {
|
||||
return &changeServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *changeServiceClient) GetDiff(ctx context.Context, in *common.Index, opts ...grpc.CallOption) (*Values, error) {
|
||||
out := new(Values)
|
||||
err := c.cc.Invoke(ctx, "/pagerino.change.ChangeService/GetDiff", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *changeServiceClient) GetAll(ctx context.Context, in *common.Index, opts ...grpc.CallOption) (*ChageAllInfo, error) {
|
||||
out := new(ChageAllInfo)
|
||||
err := c.cc.Invoke(ctx, "/pagerino.change.ChangeService/GetAll", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *changeServiceClient) GetMeta(ctx context.Context, in *common.Index, opts ...grpc.CallOption) (*common.Meta, error) {
|
||||
out := new(common.Meta)
|
||||
err := c.cc.Invoke(ctx, "/pagerino.change.ChangeService/GetMeta", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// ChangeServiceServer is the server API for ChangeService service.
|
||||
// All implementations must embed UnimplementedChangeServiceServer
|
||||
// for forward compatibility
|
||||
type ChangeServiceServer interface {
|
||||
// === DB information
|
||||
GetDiff(context.Context, *common.Index) (*Values, error)
|
||||
GetAll(context.Context, *common.Index) (*ChageAllInfo, error)
|
||||
// Common
|
||||
GetMeta(context.Context, *common.Index) (*common.Meta, error)
|
||||
mustEmbedUnimplementedChangeServiceServer()
|
||||
}
|
||||
|
||||
// UnimplementedChangeServiceServer must be embedded to have forward compatible implementations.
|
||||
type UnimplementedChangeServiceServer struct {
|
||||
}
|
||||
|
||||
func (UnimplementedChangeServiceServer) GetDiff(context.Context, *common.Index) (*Values, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetDiff not implemented")
|
||||
}
|
||||
func (UnimplementedChangeServiceServer) GetAll(context.Context, *common.Index) (*ChageAllInfo, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetAll not implemented")
|
||||
}
|
||||
func (UnimplementedChangeServiceServer) GetMeta(context.Context, *common.Index) (*common.Meta, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetMeta not implemented")
|
||||
}
|
||||
func (UnimplementedChangeServiceServer) mustEmbedUnimplementedChangeServiceServer() {}
|
||||
|
||||
// UnsafeChangeServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to ChangeServiceServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeChangeServiceServer interface {
|
||||
mustEmbedUnimplementedChangeServiceServer()
|
||||
}
|
||||
|
||||
func RegisterChangeServiceServer(s grpc.ServiceRegistrar, srv ChangeServiceServer) {
|
||||
s.RegisterService(&ChangeService_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _ChangeService_GetDiff_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(common.Index)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ChangeServiceServer).GetDiff(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pagerino.change.ChangeService/GetDiff",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ChangeServiceServer).GetDiff(ctx, req.(*common.Index))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ChangeService_GetAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(common.Index)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ChangeServiceServer).GetAll(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pagerino.change.ChangeService/GetAll",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ChangeServiceServer).GetAll(ctx, req.(*common.Index))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ChangeService_GetMeta_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(common.Index)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ChangeServiceServer).GetMeta(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pagerino.change.ChangeService/GetMeta",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ChangeServiceServer).GetMeta(ctx, req.(*common.Index))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// ChangeService_ServiceDesc is the grpc.ServiceDesc for ChangeService service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var ChangeService_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "pagerino.change.ChangeService",
|
||||
HandlerType: (*ChangeServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "GetDiff",
|
||||
Handler: _ChangeService_GetDiff_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetAll",
|
||||
Handler: _ChangeService_GetAll_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetMeta",
|
||||
Handler: _ChangeService_GetMeta_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "change.proto",
|
||||
}
|
||||
588
AppServer/src/app_comm/api/common/common.pb.go
Normal file
588
AppServer/src/app_comm/api/common/common.pb.go
Normal file
@@ -0,0 +1,588 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.25.0-devel
|
||||
// protoc v3.14.0
|
||||
// source: common.proto
|
||||
|
||||
package api_common
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// For custom logic responses
|
||||
type RequestCode int32
|
||||
|
||||
const (
|
||||
RequestCode_UNKNOWN RequestCode = 0
|
||||
RequestCode_OK RequestCode = 1
|
||||
RequestCode_UNAUTHORIZED RequestCode = 2
|
||||
RequestCode_NO_DATA RequestCode = 3
|
||||
RequestCode_INTERNAL_ERROR RequestCode = 4
|
||||
)
|
||||
|
||||
// Enum value maps for RequestCode.
|
||||
var (
|
||||
RequestCode_name = map[int32]string{
|
||||
0: "UNKNOWN",
|
||||
1: "OK",
|
||||
2: "UNAUTHORIZED",
|
||||
3: "NO_DATA",
|
||||
4: "INTERNAL_ERROR",
|
||||
}
|
||||
RequestCode_value = map[string]int32{
|
||||
"UNKNOWN": 0,
|
||||
"OK": 1,
|
||||
"UNAUTHORIZED": 2,
|
||||
"NO_DATA": 3,
|
||||
"INTERNAL_ERROR": 4,
|
||||
}
|
||||
)
|
||||
|
||||
func (x RequestCode) Enum() *RequestCode {
|
||||
p := new(RequestCode)
|
||||
*p = x
|
||||
return p
|
||||
}
|
||||
|
||||
func (x RequestCode) String() string {
|
||||
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||
}
|
||||
|
||||
func (RequestCode) Descriptor() protoreflect.EnumDescriptor {
|
||||
return file_common_proto_enumTypes[0].Descriptor()
|
||||
}
|
||||
|
||||
func (RequestCode) Type() protoreflect.EnumType {
|
||||
return &file_common_proto_enumTypes[0]
|
||||
}
|
||||
|
||||
func (x RequestCode) Number() protoreflect.EnumNumber {
|
||||
return protoreflect.EnumNumber(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use RequestCode.Descriptor instead.
|
||||
func (RequestCode) EnumDescriptor() ([]byte, []int) {
|
||||
return file_common_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
// === DB indexing
|
||||
type StrIndex struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// Types that are assignable to Id:
|
||||
// *StrIndex_Num
|
||||
// *StrIndex_Name
|
||||
Id isStrIndex_Id `protobuf_oneof:"id"`
|
||||
}
|
||||
|
||||
func (x *StrIndex) Reset() {
|
||||
*x = StrIndex{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_common_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *StrIndex) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*StrIndex) ProtoMessage() {}
|
||||
|
||||
func (x *StrIndex) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_common_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use StrIndex.ProtoReflect.Descriptor instead.
|
||||
func (*StrIndex) Descriptor() ([]byte, []int) {
|
||||
return file_common_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (m *StrIndex) GetId() isStrIndex_Id {
|
||||
if m != nil {
|
||||
return m.Id
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *StrIndex) GetNum() int32 {
|
||||
if x, ok := x.GetId().(*StrIndex_Num); ok {
|
||||
return x.Num
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *StrIndex) GetName() string {
|
||||
if x, ok := x.GetId().(*StrIndex_Name); ok {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type isStrIndex_Id interface {
|
||||
isStrIndex_Id()
|
||||
}
|
||||
|
||||
type StrIndex_Num struct {
|
||||
Num int32 `protobuf:"varint,1,opt,name=num,proto3,oneof"` // Database ID
|
||||
}
|
||||
|
||||
type StrIndex_Name struct {
|
||||
Name string `protobuf:"bytes,2,opt,name=name,proto3,oneof"` // for external fields: username, euid, name...
|
||||
}
|
||||
|
||||
func (*StrIndex_Num) isStrIndex_Id() {}
|
||||
|
||||
func (*StrIndex_Name) isStrIndex_Id() {}
|
||||
|
||||
type Index struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Num int32 `protobuf:"varint,1,opt,name=num,proto3" json:"num,omitempty"` // Database ID
|
||||
}
|
||||
|
||||
func (x *Index) Reset() {
|
||||
*x = Index{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_common_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Index) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Index) ProtoMessage() {}
|
||||
|
||||
func (x *Index) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_common_proto_msgTypes[1]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Index.ProtoReflect.Descriptor instead.
|
||||
func (*Index) Descriptor() ([]byte, []int) {
|
||||
return file_common_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *Index) GetNum() int32 {
|
||||
if x != nil {
|
||||
return x.Num
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// === DB information
|
||||
type Meta struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
CreatedAt *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
|
||||
}
|
||||
|
||||
func (x *Meta) Reset() {
|
||||
*x = Meta{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_common_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Meta) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Meta) ProtoMessage() {}
|
||||
|
||||
func (x *Meta) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_common_proto_msgTypes[2]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Meta.ProtoReflect.Descriptor instead.
|
||||
func (*Meta) Descriptor() ([]byte, []int) {
|
||||
return file_common_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *Meta) GetId() int32 {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *Meta) GetCreatedAt() *timestamppb.Timestamp {
|
||||
if x != nil {
|
||||
return x.CreatedAt
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type References struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Page int32 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` // 32 IDs per page from most recent
|
||||
RefId []int32 `protobuf:"varint,2,rep,packed,name=ref_id,json=refId,proto3" json:"ref_id,omitempty"`
|
||||
}
|
||||
|
||||
func (x *References) Reset() {
|
||||
*x = References{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_common_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *References) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*References) ProtoMessage() {}
|
||||
|
||||
func (x *References) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_common_proto_msgTypes[3]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use References.ProtoReflect.Descriptor instead.
|
||||
func (*References) Descriptor() ([]byte, []int) {
|
||||
return file_common_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *References) GetPage() int32 {
|
||||
if x != nil {
|
||||
return x.Page
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *References) GetRefId() []int32 {
|
||||
if x != nil {
|
||||
return x.RefId
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Reference struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
RefId int32 `protobuf:"varint,1,opt,name=ref_id,json=refId,proto3" json:"ref_id,omitempty"`
|
||||
}
|
||||
|
||||
func (x *Reference) Reset() {
|
||||
*x = Reference{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_common_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Reference) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Reference) ProtoMessage() {}
|
||||
|
||||
func (x *Reference) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_common_proto_msgTypes[4]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Reference.ProtoReflect.Descriptor instead.
|
||||
func (*Reference) Descriptor() ([]byte, []int) {
|
||||
return file_common_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *Reference) GetRefId() int32 {
|
||||
if x != nil {
|
||||
return x.RefId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type Activity struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
LastOnline *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=last_online,json=lastOnline,proto3" json:"last_online,omitempty"`
|
||||
}
|
||||
|
||||
func (x *Activity) Reset() {
|
||||
*x = Activity{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_common_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Activity) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Activity) ProtoMessage() {}
|
||||
|
||||
func (x *Activity) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_common_proto_msgTypes[5]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Activity.ProtoReflect.Descriptor instead.
|
||||
func (*Activity) Descriptor() ([]byte, []int) {
|
||||
return file_common_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *Activity) GetLastOnline() *timestamppb.Timestamp {
|
||||
if x != nil {
|
||||
return x.LastOnline
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_common_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_common_proto_rawDesc = []byte{
|
||||
0x0a, 0x0c, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f,
|
||||
0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x1a,
|
||||
0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
|
||||
0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x22, 0x3a, 0x0a, 0x08, 0x53, 0x74, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x12, 0x0a, 0x03,
|
||||
0x6e, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x48, 0x00, 0x52, 0x03, 0x6e, 0x75, 0x6d,
|
||||
0x12, 0x14, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00,
|
||||
0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x04, 0x0a, 0x02, 0x69, 0x64, 0x22, 0x19, 0x0a, 0x05,
|
||||
0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x05, 0x52, 0x03, 0x6e, 0x75, 0x6d, 0x22, 0x51, 0x0a, 0x04, 0x4d, 0x65, 0x74, 0x61, 0x12,
|
||||
0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12,
|
||||
0x39, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52,
|
||||
0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0x37, 0x0a, 0x0a, 0x52, 0x65,
|
||||
0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, 0x15, 0x0a, 0x06,
|
||||
0x72, 0x65, 0x66, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05, 0x52, 0x05, 0x72, 0x65,
|
||||
0x66, 0x49, 0x64, 0x22, 0x22, 0x0a, 0x09, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65,
|
||||
0x12, 0x15, 0x0a, 0x06, 0x72, 0x65, 0x66, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05,
|
||||
0x52, 0x05, 0x72, 0x65, 0x66, 0x49, 0x64, 0x22, 0x47, 0x0a, 0x08, 0x41, 0x63, 0x74, 0x69, 0x76,
|
||||
0x69, 0x74, 0x79, 0x12, 0x3b, 0x0a, 0x0b, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x6f, 0x6e, 0x6c, 0x69,
|
||||
0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
|
||||
0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73,
|
||||
0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x6c, 0x61, 0x73, 0x74, 0x4f, 0x6e, 0x6c, 0x69, 0x6e, 0x65,
|
||||
0x2a, 0x55, 0x0a, 0x0b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x12,
|
||||
0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02,
|
||||
0x4f, 0x4b, 0x10, 0x01, 0x12, 0x10, 0x0a, 0x0c, 0x55, 0x4e, 0x41, 0x55, 0x54, 0x48, 0x4f, 0x52,
|
||||
0x49, 0x5a, 0x45, 0x44, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x4e, 0x4f, 0x5f, 0x44, 0x41, 0x54,
|
||||
0x41, 0x10, 0x03, 0x12, 0x12, 0x0a, 0x0e, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x5f,
|
||||
0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x04, 0x42, 0x27, 0x5a, 0x25, 0x73, 0x65, 0x72, 0x76, 0x65,
|
||||
0x72, 0x2f, 0x61, 0x70, 0x70, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63,
|
||||
0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x3b, 0x61, 0x70, 0x69, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
|
||||
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_common_proto_rawDescOnce sync.Once
|
||||
file_common_proto_rawDescData = file_common_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_common_proto_rawDescGZIP() []byte {
|
||||
file_common_proto_rawDescOnce.Do(func() {
|
||||
file_common_proto_rawDescData = protoimpl.X.CompressGZIP(file_common_proto_rawDescData)
|
||||
})
|
||||
return file_common_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_common_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
||||
var file_common_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
|
||||
var file_common_proto_goTypes = []interface{}{
|
||||
(RequestCode)(0), // 0: pagerino.common.RequestCode
|
||||
(*StrIndex)(nil), // 1: pagerino.common.StrIndex
|
||||
(*Index)(nil), // 2: pagerino.common.Index
|
||||
(*Meta)(nil), // 3: pagerino.common.Meta
|
||||
(*References)(nil), // 4: pagerino.common.References
|
||||
(*Reference)(nil), // 5: pagerino.common.Reference
|
||||
(*Activity)(nil), // 6: pagerino.common.Activity
|
||||
(*timestamppb.Timestamp)(nil), // 7: google.protobuf.Timestamp
|
||||
}
|
||||
var file_common_proto_depIdxs = []int32{
|
||||
7, // 0: pagerino.common.Meta.created_at:type_name -> google.protobuf.Timestamp
|
||||
7, // 1: pagerino.common.Activity.last_online:type_name -> google.protobuf.Timestamp
|
||||
2, // [2:2] is the sub-list for method output_type
|
||||
2, // [2:2] is the sub-list for method input_type
|
||||
2, // [2:2] is the sub-list for extension type_name
|
||||
2, // [2:2] is the sub-list for extension extendee
|
||||
0, // [0:2] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_common_proto_init() }
|
||||
func file_common_proto_init() {
|
||||
if File_common_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_common_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*StrIndex); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_common_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Index); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_common_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Meta); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_common_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*References); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_common_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Reference); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_common_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Activity); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
file_common_proto_msgTypes[0].OneofWrappers = []interface{}{
|
||||
(*StrIndex_Num)(nil),
|
||||
(*StrIndex_Name)(nil),
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_common_proto_rawDesc,
|
||||
NumEnums: 1,
|
||||
NumMessages: 6,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_common_proto_goTypes,
|
||||
DependencyIndexes: file_common_proto_depIdxs,
|
||||
EnumInfos: file_common_proto_enumTypes,
|
||||
MessageInfos: file_common_proto_msgTypes,
|
||||
}.Build()
|
||||
File_common_proto = out.File
|
||||
file_common_proto_rawDesc = nil
|
||||
file_common_proto_goTypes = nil
|
||||
file_common_proto_depIdxs = nil
|
||||
}
|
||||
566
AppServer/src/app_comm/api/device/device.pb.go
Normal file
566
AppServer/src/app_comm/api/device/device.pb.go
Normal file
@@ -0,0 +1,566 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.25.0-devel
|
||||
// protoc v3.14.0
|
||||
// source: device.proto
|
||||
|
||||
package api_device
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
|
||||
reflect "reflect"
|
||||
common "server/app_comm/api/common"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type Charge struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Charge float32 `protobuf:"fixed32,1,opt,name=charge,proto3" json:"charge,omitempty"`
|
||||
}
|
||||
|
||||
func (x *Charge) Reset() {
|
||||
*x = Charge{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_device_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Charge) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Charge) ProtoMessage() {}
|
||||
|
||||
func (x *Charge) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_device_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Charge.ProtoReflect.Descriptor instead.
|
||||
func (*Charge) Descriptor() ([]byte, []int) {
|
||||
return file_device_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *Charge) GetCharge() float32 {
|
||||
if x != nil {
|
||||
return x.Charge
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type Location struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Latitude float64 `protobuf:"fixed64,1,opt,name=latitude,proto3" json:"latitude,omitempty"`
|
||||
Longitude float64 `protobuf:"fixed64,2,opt,name=longitude,proto3" json:"longitude,omitempty"`
|
||||
Altitude float32 `protobuf:"fixed32,3,opt,name=altitude,proto3" json:"altitude,omitempty"`
|
||||
}
|
||||
|
||||
func (x *Location) Reset() {
|
||||
*x = Location{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_device_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Location) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Location) ProtoMessage() {}
|
||||
|
||||
func (x *Location) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_device_proto_msgTypes[1]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Location.ProtoReflect.Descriptor instead.
|
||||
func (*Location) Descriptor() ([]byte, []int) {
|
||||
return file_device_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *Location) GetLatitude() float64 {
|
||||
if x != nil {
|
||||
return x.Latitude
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *Location) GetLongitude() float64 {
|
||||
if x != nil {
|
||||
return x.Longitude
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *Location) GetAltitude() float32 {
|
||||
if x != nil {
|
||||
return x.Altitude
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type DeviceBaseInfo struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Euid string `protobuf:"bytes,2,opt,name=euid,proto3" json:"euid,omitempty"`
|
||||
InternalStatus int32 `protobuf:"zigzag32,3,opt,name=internal_status,json=internalStatus,proto3" json:"internal_status,omitempty"`
|
||||
LastOnline *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=last_online,json=lastOnline,proto3" json:"last_online,omitempty"`
|
||||
}
|
||||
|
||||
func (x *DeviceBaseInfo) Reset() {
|
||||
*x = DeviceBaseInfo{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_device_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *DeviceBaseInfo) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*DeviceBaseInfo) ProtoMessage() {}
|
||||
|
||||
func (x *DeviceBaseInfo) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_device_proto_msgTypes[2]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use DeviceBaseInfo.ProtoReflect.Descriptor instead.
|
||||
func (*DeviceBaseInfo) Descriptor() ([]byte, []int) {
|
||||
return file_device_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *DeviceBaseInfo) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *DeviceBaseInfo) GetEuid() string {
|
||||
if x != nil {
|
||||
return x.Euid
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *DeviceBaseInfo) GetInternalStatus() int32 {
|
||||
if x != nil {
|
||||
return x.InternalStatus
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *DeviceBaseInfo) GetLastOnline() *timestamppb.Timestamp {
|
||||
if x != nil {
|
||||
return x.LastOnline
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type DeviceAllInfo struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Euid string `protobuf:"bytes,2,opt,name=euid,proto3" json:"euid,omitempty"`
|
||||
InternalStatus int32 `protobuf:"zigzag32,3,opt,name=internal_status,json=internalStatus,proto3" json:"internal_status,omitempty"`
|
||||
NativeStatus string `protobuf:"bytes,4,opt,name=native_status,json=nativeStatus,proto3" json:"native_status,omitempty"`
|
||||
LastOnline *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=last_online,json=lastOnline,proto3" json:"last_online,omitempty"`
|
||||
FwVersion string `protobuf:"bytes,6,opt,name=fw_version,json=fwVersion,proto3" json:"fw_version,omitempty"`
|
||||
CardIds []int32 `protobuf:"varint,7,rep,packed,name=card_ids,json=cardIds,proto3" json:"card_ids,omitempty"`
|
||||
Charge float32 `protobuf:"fixed32,8,opt,name=charge,proto3" json:"charge,omitempty"`
|
||||
Latitude float64 `protobuf:"fixed64,9,opt,name=latitude,proto3" json:"latitude,omitempty"`
|
||||
Longitude float64 `protobuf:"fixed64,10,opt,name=longitude,proto3" json:"longitude,omitempty"`
|
||||
Altitude float32 `protobuf:"fixed32,11,opt,name=altitude,proto3" json:"altitude,omitempty"`
|
||||
}
|
||||
|
||||
func (x *DeviceAllInfo) Reset() {
|
||||
*x = DeviceAllInfo{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_device_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *DeviceAllInfo) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*DeviceAllInfo) ProtoMessage() {}
|
||||
|
||||
func (x *DeviceAllInfo) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_device_proto_msgTypes[3]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use DeviceAllInfo.ProtoReflect.Descriptor instead.
|
||||
func (*DeviceAllInfo) Descriptor() ([]byte, []int) {
|
||||
return file_device_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *DeviceAllInfo) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *DeviceAllInfo) GetEuid() string {
|
||||
if x != nil {
|
||||
return x.Euid
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *DeviceAllInfo) GetInternalStatus() int32 {
|
||||
if x != nil {
|
||||
return x.InternalStatus
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *DeviceAllInfo) GetNativeStatus() string {
|
||||
if x != nil {
|
||||
return x.NativeStatus
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *DeviceAllInfo) GetLastOnline() *timestamppb.Timestamp {
|
||||
if x != nil {
|
||||
return x.LastOnline
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *DeviceAllInfo) GetFwVersion() string {
|
||||
if x != nil {
|
||||
return x.FwVersion
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *DeviceAllInfo) GetCardIds() []int32 {
|
||||
if x != nil {
|
||||
return x.CardIds
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *DeviceAllInfo) GetCharge() float32 {
|
||||
if x != nil {
|
||||
return x.Charge
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *DeviceAllInfo) GetLatitude() float64 {
|
||||
if x != nil {
|
||||
return x.Latitude
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *DeviceAllInfo) GetLongitude() float64 {
|
||||
if x != nil {
|
||||
return x.Longitude
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *DeviceAllInfo) GetAltitude() float32 {
|
||||
if x != nil {
|
||||
return x.Altitude
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
var File_device_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_device_proto_rawDesc = []byte{
|
||||
0x0a, 0x0c, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f,
|
||||
0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x1a,
|
||||
0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
|
||||
0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x1a, 0x0c, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x20,
|
||||
0x0a, 0x06, 0x43, 0x68, 0x61, 0x72, 0x67, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x68, 0x61, 0x72,
|
||||
0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x02, 0x52, 0x06, 0x63, 0x68, 0x61, 0x72, 0x67, 0x65,
|
||||
0x22, 0x60, 0x0a, 0x08, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08,
|
||||
0x6c, 0x61, 0x74, 0x69, 0x74, 0x75, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x52, 0x08,
|
||||
0x6c, 0x61, 0x74, 0x69, 0x74, 0x75, 0x64, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6c, 0x6f, 0x6e, 0x67,
|
||||
0x69, 0x74, 0x75, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x09, 0x6c, 0x6f, 0x6e,
|
||||
0x67, 0x69, 0x74, 0x75, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x6c, 0x74, 0x69, 0x74, 0x75,
|
||||
0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x02, 0x52, 0x08, 0x61, 0x6c, 0x74, 0x69, 0x74, 0x75,
|
||||
0x64, 0x65, 0x22, 0x9e, 0x01, 0x0a, 0x0e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x42, 0x61, 0x73,
|
||||
0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x65, 0x75, 0x69,
|
||||
0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x65, 0x75, 0x69, 0x64, 0x12, 0x27, 0x0a,
|
||||
0x0f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73,
|
||||
0x18, 0x03, 0x20, 0x01, 0x28, 0x11, 0x52, 0x0e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c,
|
||||
0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x3b, 0x0a, 0x0b, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x6f,
|
||||
0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f,
|
||||
0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69,
|
||||
0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x6c, 0x61, 0x73, 0x74, 0x4f, 0x6e, 0x6c,
|
||||
0x69, 0x6e, 0x65, 0x22, 0xea, 0x02, 0x0a, 0x0d, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x41, 0x6c,
|
||||
0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x65, 0x75, 0x69,
|
||||
0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x65, 0x75, 0x69, 0x64, 0x12, 0x27, 0x0a,
|
||||
0x0f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73,
|
||||
0x18, 0x03, 0x20, 0x01, 0x28, 0x11, 0x52, 0x0e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c,
|
||||
0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65,
|
||||
0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6e,
|
||||
0x61, 0x74, 0x69, 0x76, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x3b, 0x0a, 0x0b, 0x6c,
|
||||
0x61, 0x73, 0x74, 0x5f, 0x6f, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b,
|
||||
0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
|
||||
0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x6c, 0x61,
|
||||
0x73, 0x74, 0x4f, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x66, 0x77, 0x5f, 0x76,
|
||||
0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x66, 0x77,
|
||||
0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x61, 0x72, 0x64, 0x5f,
|
||||
0x69, 0x64, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x05, 0x52, 0x07, 0x63, 0x61, 0x72, 0x64, 0x49,
|
||||
0x64, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x68, 0x61, 0x72, 0x67, 0x65, 0x18, 0x08, 0x20, 0x01,
|
||||
0x28, 0x02, 0x52, 0x06, 0x63, 0x68, 0x61, 0x72, 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x61,
|
||||
0x74, 0x69, 0x74, 0x75, 0x64, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x01, 0x52, 0x08, 0x6c, 0x61,
|
||||
0x74, 0x69, 0x74, 0x75, 0x64, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6c, 0x6f, 0x6e, 0x67, 0x69, 0x74,
|
||||
0x75, 0x64, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x01, 0x52, 0x09, 0x6c, 0x6f, 0x6e, 0x67, 0x69,
|
||||
0x74, 0x75, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x6c, 0x74, 0x69, 0x74, 0x75, 0x64, 0x65,
|
||||
0x18, 0x0b, 0x20, 0x01, 0x28, 0x02, 0x52, 0x08, 0x61, 0x6c, 0x74, 0x69, 0x74, 0x75, 0x64, 0x65,
|
||||
0x32, 0x95, 0x06, 0x0a, 0x0d, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69,
|
||||
0x63, 0x65, 0x12, 0x43, 0x0a, 0x06, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x12, 0x19, 0x2e, 0x70,
|
||||
0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x53,
|
||||
0x74, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x1a, 0x1e, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69,
|
||||
0x6e, 0x6f, 0x2e, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65,
|
||||
0x41, 0x6c, 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x45, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x49, 0x6e,
|
||||
0x66, 0x6f, 0x12, 0x19, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6f,
|
||||
0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x1a, 0x1f, 0x2e,
|
||||
0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x2e,
|
||||
0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x42, 0x61, 0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x3f,
|
||||
0x0a, 0x09, 0x47, 0x65, 0x74, 0x43, 0x68, 0x61, 0x72, 0x67, 0x65, 0x12, 0x19, 0x2e, 0x70, 0x61,
|
||||
0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x74,
|
||||
0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x1a, 0x17, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e,
|
||||
0x6f, 0x2e, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x43, 0x68, 0x61, 0x72, 0x67, 0x65, 0x12,
|
||||
0x43, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19,
|
||||
0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
|
||||
0x2e, 0x53, 0x74, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x1a, 0x19, 0x2e, 0x70, 0x61, 0x67, 0x65,
|
||||
0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4c, 0x6f, 0x63, 0x61,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x12, 0x47, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x4e, 0x66, 0x63, 0x43, 0x61,
|
||||
0x72, 0x64, 0x49, 0x64, 0x73, 0x12, 0x19, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f,
|
||||
0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78,
|
||||
0x1a, 0x1b, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d,
|
||||
0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x46, 0x0a,
|
||||
0x0c, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x49, 0x64, 0x73, 0x12, 0x19, 0x2e,
|
||||
0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e,
|
||||
0x53, 0x74, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x1a, 0x1b, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72,
|
||||
0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x66, 0x65, 0x72,
|
||||
0x65, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x4b, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x53, 0x65, 0x6e, 0x74,
|
||||
0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x64, 0x73, 0x12, 0x19, 0x2e, 0x70, 0x61, 0x67,
|
||||
0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x72,
|
||||
0x49, 0x6e, 0x64, 0x65, 0x78, 0x1a, 0x1b, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f,
|
||||
0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63,
|
||||
0x65, 0x73, 0x12, 0x4f, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65,
|
||||
0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x64, 0x73, 0x12, 0x19, 0x2e, 0x70, 0x61,
|
||||
0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x74,
|
||||
0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x1a, 0x1b, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e,
|
||||
0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e,
|
||||
0x63, 0x65, 0x73, 0x12, 0x41, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x4c, 0x6f, 0x67, 0x73, 0x12, 0x19,
|
||||
0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
|
||||
0x2e, 0x53, 0x74, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x1a, 0x1b, 0x2e, 0x70, 0x61, 0x67, 0x65,
|
||||
0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x66, 0x65,
|
||||
0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x43, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x41, 0x63, 0x74,
|
||||
0x69, 0x76, 0x69, 0x74, 0x79, 0x12, 0x19, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f,
|
||||
0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78,
|
||||
0x1a, 0x19, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d,
|
||||
0x6f, 0x6e, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x12, 0x3b, 0x0a, 0x07, 0x47,
|
||||
0x65, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x12, 0x19, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e,
|
||||
0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x72, 0x49, 0x6e, 0x64, 0x65,
|
||||
0x78, 0x1a, 0x15, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6f, 0x6d,
|
||||
0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x42, 0x27, 0x5a, 0x25, 0x73, 0x65, 0x72, 0x76,
|
||||
0x65, 0x72, 0x2f, 0x61, 0x70, 0x70, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x2f, 0x61, 0x70, 0x69, 0x2f,
|
||||
0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x3b, 0x61, 0x70, 0x69, 0x5f, 0x64, 0x65, 0x76, 0x69, 0x63,
|
||||
0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_device_proto_rawDescOnce sync.Once
|
||||
file_device_proto_rawDescData = file_device_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_device_proto_rawDescGZIP() []byte {
|
||||
file_device_proto_rawDescOnce.Do(func() {
|
||||
file_device_proto_rawDescData = protoimpl.X.CompressGZIP(file_device_proto_rawDescData)
|
||||
})
|
||||
return file_device_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_device_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||||
var file_device_proto_goTypes = []interface{}{
|
||||
(*Charge)(nil), // 0: pagerino.device.Charge
|
||||
(*Location)(nil), // 1: pagerino.device.Location
|
||||
(*DeviceBaseInfo)(nil), // 2: pagerino.device.DeviceBaseInfo
|
||||
(*DeviceAllInfo)(nil), // 3: pagerino.device.DeviceAllInfo
|
||||
(*timestamppb.Timestamp)(nil), // 4: google.protobuf.Timestamp
|
||||
(*common.StrIndex)(nil), // 5: pagerino.common.StrIndex
|
||||
(*common.References)(nil), // 6: pagerino.common.References
|
||||
(*common.Activity)(nil), // 7: pagerino.common.Activity
|
||||
(*common.Meta)(nil), // 8: pagerino.common.Meta
|
||||
}
|
||||
var file_device_proto_depIdxs = []int32{
|
||||
4, // 0: pagerino.device.DeviceBaseInfo.last_online:type_name -> google.protobuf.Timestamp
|
||||
4, // 1: pagerino.device.DeviceAllInfo.last_online:type_name -> google.protobuf.Timestamp
|
||||
5, // 2: pagerino.device.DeviceService.GetAll:input_type -> pagerino.common.StrIndex
|
||||
5, // 3: pagerino.device.DeviceService.GetInfo:input_type -> pagerino.common.StrIndex
|
||||
5, // 4: pagerino.device.DeviceService.GetCharge:input_type -> pagerino.common.StrIndex
|
||||
5, // 5: pagerino.device.DeviceService.GetLocation:input_type -> pagerino.common.StrIndex
|
||||
5, // 6: pagerino.device.DeviceService.GetNfcCardIds:input_type -> pagerino.common.StrIndex
|
||||
5, // 7: pagerino.device.DeviceService.GetStatusIds:input_type -> pagerino.common.StrIndex
|
||||
5, // 8: pagerino.device.DeviceService.GetSentMessageIds:input_type -> pagerino.common.StrIndex
|
||||
5, // 9: pagerino.device.DeviceService.GetReceivedMessageIds:input_type -> pagerino.common.StrIndex
|
||||
5, // 10: pagerino.device.DeviceService.GetLogs:input_type -> pagerino.common.StrIndex
|
||||
5, // 11: pagerino.device.DeviceService.GetActivity:input_type -> pagerino.common.StrIndex
|
||||
5, // 12: pagerino.device.DeviceService.GetMeta:input_type -> pagerino.common.StrIndex
|
||||
3, // 13: pagerino.device.DeviceService.GetAll:output_type -> pagerino.device.DeviceAllInfo
|
||||
2, // 14: pagerino.device.DeviceService.GetInfo:output_type -> pagerino.device.DeviceBaseInfo
|
||||
0, // 15: pagerino.device.DeviceService.GetCharge:output_type -> pagerino.device.Charge
|
||||
1, // 16: pagerino.device.DeviceService.GetLocation:output_type -> pagerino.device.Location
|
||||
6, // 17: pagerino.device.DeviceService.GetNfcCardIds:output_type -> pagerino.common.References
|
||||
6, // 18: pagerino.device.DeviceService.GetStatusIds:output_type -> pagerino.common.References
|
||||
6, // 19: pagerino.device.DeviceService.GetSentMessageIds:output_type -> pagerino.common.References
|
||||
6, // 20: pagerino.device.DeviceService.GetReceivedMessageIds:output_type -> pagerino.common.References
|
||||
6, // 21: pagerino.device.DeviceService.GetLogs:output_type -> pagerino.common.References
|
||||
7, // 22: pagerino.device.DeviceService.GetActivity:output_type -> pagerino.common.Activity
|
||||
8, // 23: pagerino.device.DeviceService.GetMeta:output_type -> pagerino.common.Meta
|
||||
13, // [13:24] is the sub-list for method output_type
|
||||
2, // [2:13] is the sub-list for method input_type
|
||||
2, // [2:2] is the sub-list for extension type_name
|
||||
2, // [2:2] is the sub-list for extension extendee
|
||||
0, // [0:2] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_device_proto_init() }
|
||||
func file_device_proto_init() {
|
||||
if File_device_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_device_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Charge); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_device_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Location); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_device_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*DeviceBaseInfo); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_device_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*DeviceAllInfo); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_device_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 4,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_device_proto_goTypes,
|
||||
DependencyIndexes: file_device_proto_depIdxs,
|
||||
MessageInfos: file_device_proto_msgTypes,
|
||||
}.Build()
|
||||
File_device_proto = out.File
|
||||
file_device_proto_rawDesc = nil
|
||||
file_device_proto_goTypes = nil
|
||||
file_device_proto_depIdxs = nil
|
||||
}
|
||||
468
AppServer/src/app_comm/api/device/device_grpc.pb.go
Normal file
468
AppServer/src/app_comm/api/device/device_grpc.pb.go
Normal file
@@ -0,0 +1,468 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
|
||||
package api_device
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
common "server/app_comm/api/common"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.32.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion7
|
||||
|
||||
// DeviceServiceClient is the client API for DeviceService service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type DeviceServiceClient interface {
|
||||
// === DB information
|
||||
GetAll(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*DeviceAllInfo, error)
|
||||
GetInfo(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*DeviceBaseInfo, error)
|
||||
GetCharge(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*Charge, error)
|
||||
GetLocation(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*Location, error)
|
||||
// References
|
||||
GetNfcCardIds(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*common.References, error)
|
||||
GetStatusIds(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*common.References, error)
|
||||
GetSentMessageIds(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*common.References, error)
|
||||
GetReceivedMessageIds(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*common.References, error)
|
||||
GetLogs(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*common.References, error)
|
||||
// Common
|
||||
GetActivity(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*common.Activity, error)
|
||||
GetMeta(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*common.Meta, error)
|
||||
}
|
||||
|
||||
type deviceServiceClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewDeviceServiceClient(cc grpc.ClientConnInterface) DeviceServiceClient {
|
||||
return &deviceServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *deviceServiceClient) GetAll(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*DeviceAllInfo, error) {
|
||||
out := new(DeviceAllInfo)
|
||||
err := c.cc.Invoke(ctx, "/pagerino.device.DeviceService/GetAll", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *deviceServiceClient) GetInfo(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*DeviceBaseInfo, error) {
|
||||
out := new(DeviceBaseInfo)
|
||||
err := c.cc.Invoke(ctx, "/pagerino.device.DeviceService/GetInfo", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *deviceServiceClient) GetCharge(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*Charge, error) {
|
||||
out := new(Charge)
|
||||
err := c.cc.Invoke(ctx, "/pagerino.device.DeviceService/GetCharge", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *deviceServiceClient) GetLocation(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*Location, error) {
|
||||
out := new(Location)
|
||||
err := c.cc.Invoke(ctx, "/pagerino.device.DeviceService/GetLocation", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *deviceServiceClient) GetNfcCardIds(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*common.References, error) {
|
||||
out := new(common.References)
|
||||
err := c.cc.Invoke(ctx, "/pagerino.device.DeviceService/GetNfcCardIds", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *deviceServiceClient) GetStatusIds(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*common.References, error) {
|
||||
out := new(common.References)
|
||||
err := c.cc.Invoke(ctx, "/pagerino.device.DeviceService/GetStatusIds", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *deviceServiceClient) GetSentMessageIds(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*common.References, error) {
|
||||
out := new(common.References)
|
||||
err := c.cc.Invoke(ctx, "/pagerino.device.DeviceService/GetSentMessageIds", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *deviceServiceClient) GetReceivedMessageIds(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*common.References, error) {
|
||||
out := new(common.References)
|
||||
err := c.cc.Invoke(ctx, "/pagerino.device.DeviceService/GetReceivedMessageIds", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *deviceServiceClient) GetLogs(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*common.References, error) {
|
||||
out := new(common.References)
|
||||
err := c.cc.Invoke(ctx, "/pagerino.device.DeviceService/GetLogs", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *deviceServiceClient) GetActivity(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*common.Activity, error) {
|
||||
out := new(common.Activity)
|
||||
err := c.cc.Invoke(ctx, "/pagerino.device.DeviceService/GetActivity", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *deviceServiceClient) GetMeta(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*common.Meta, error) {
|
||||
out := new(common.Meta)
|
||||
err := c.cc.Invoke(ctx, "/pagerino.device.DeviceService/GetMeta", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// DeviceServiceServer is the server API for DeviceService service.
|
||||
// All implementations must embed UnimplementedDeviceServiceServer
|
||||
// for forward compatibility
|
||||
type DeviceServiceServer interface {
|
||||
// === DB information
|
||||
GetAll(context.Context, *common.StrIndex) (*DeviceAllInfo, error)
|
||||
GetInfo(context.Context, *common.StrIndex) (*DeviceBaseInfo, error)
|
||||
GetCharge(context.Context, *common.StrIndex) (*Charge, error)
|
||||
GetLocation(context.Context, *common.StrIndex) (*Location, error)
|
||||
// References
|
||||
GetNfcCardIds(context.Context, *common.StrIndex) (*common.References, error)
|
||||
GetStatusIds(context.Context, *common.StrIndex) (*common.References, error)
|
||||
GetSentMessageIds(context.Context, *common.StrIndex) (*common.References, error)
|
||||
GetReceivedMessageIds(context.Context, *common.StrIndex) (*common.References, error)
|
||||
GetLogs(context.Context, *common.StrIndex) (*common.References, error)
|
||||
// Common
|
||||
GetActivity(context.Context, *common.StrIndex) (*common.Activity, error)
|
||||
GetMeta(context.Context, *common.StrIndex) (*common.Meta, error)
|
||||
mustEmbedUnimplementedDeviceServiceServer()
|
||||
}
|
||||
|
||||
// UnimplementedDeviceServiceServer must be embedded to have forward compatible implementations.
|
||||
type UnimplementedDeviceServiceServer struct {
|
||||
}
|
||||
|
||||
func (UnimplementedDeviceServiceServer) GetAll(context.Context, *common.StrIndex) (*DeviceAllInfo, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetAll not implemented")
|
||||
}
|
||||
func (UnimplementedDeviceServiceServer) GetInfo(context.Context, *common.StrIndex) (*DeviceBaseInfo, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetInfo not implemented")
|
||||
}
|
||||
func (UnimplementedDeviceServiceServer) GetCharge(context.Context, *common.StrIndex) (*Charge, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetCharge not implemented")
|
||||
}
|
||||
func (UnimplementedDeviceServiceServer) GetLocation(context.Context, *common.StrIndex) (*Location, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetLocation not implemented")
|
||||
}
|
||||
func (UnimplementedDeviceServiceServer) GetNfcCardIds(context.Context, *common.StrIndex) (*common.References, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetNfcCardIds not implemented")
|
||||
}
|
||||
func (UnimplementedDeviceServiceServer) GetStatusIds(context.Context, *common.StrIndex) (*common.References, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetStatusIds not implemented")
|
||||
}
|
||||
func (UnimplementedDeviceServiceServer) GetSentMessageIds(context.Context, *common.StrIndex) (*common.References, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetSentMessageIds not implemented")
|
||||
}
|
||||
func (UnimplementedDeviceServiceServer) GetReceivedMessageIds(context.Context, *common.StrIndex) (*common.References, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetReceivedMessageIds not implemented")
|
||||
}
|
||||
func (UnimplementedDeviceServiceServer) GetLogs(context.Context, *common.StrIndex) (*common.References, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetLogs not implemented")
|
||||
}
|
||||
func (UnimplementedDeviceServiceServer) GetActivity(context.Context, *common.StrIndex) (*common.Activity, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetActivity not implemented")
|
||||
}
|
||||
func (UnimplementedDeviceServiceServer) GetMeta(context.Context, *common.StrIndex) (*common.Meta, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetMeta not implemented")
|
||||
}
|
||||
func (UnimplementedDeviceServiceServer) mustEmbedUnimplementedDeviceServiceServer() {}
|
||||
|
||||
// UnsafeDeviceServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to DeviceServiceServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeDeviceServiceServer interface {
|
||||
mustEmbedUnimplementedDeviceServiceServer()
|
||||
}
|
||||
|
||||
func RegisterDeviceServiceServer(s grpc.ServiceRegistrar, srv DeviceServiceServer) {
|
||||
s.RegisterService(&DeviceService_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _DeviceService_GetAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(common.StrIndex)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(DeviceServiceServer).GetAll(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pagerino.device.DeviceService/GetAll",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(DeviceServiceServer).GetAll(ctx, req.(*common.StrIndex))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _DeviceService_GetInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(common.StrIndex)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(DeviceServiceServer).GetInfo(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pagerino.device.DeviceService/GetInfo",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(DeviceServiceServer).GetInfo(ctx, req.(*common.StrIndex))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _DeviceService_GetCharge_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(common.StrIndex)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(DeviceServiceServer).GetCharge(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pagerino.device.DeviceService/GetCharge",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(DeviceServiceServer).GetCharge(ctx, req.(*common.StrIndex))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _DeviceService_GetLocation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(common.StrIndex)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(DeviceServiceServer).GetLocation(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pagerino.device.DeviceService/GetLocation",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(DeviceServiceServer).GetLocation(ctx, req.(*common.StrIndex))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _DeviceService_GetNfcCardIds_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(common.StrIndex)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(DeviceServiceServer).GetNfcCardIds(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pagerino.device.DeviceService/GetNfcCardIds",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(DeviceServiceServer).GetNfcCardIds(ctx, req.(*common.StrIndex))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _DeviceService_GetStatusIds_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(common.StrIndex)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(DeviceServiceServer).GetStatusIds(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pagerino.device.DeviceService/GetStatusIds",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(DeviceServiceServer).GetStatusIds(ctx, req.(*common.StrIndex))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _DeviceService_GetSentMessageIds_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(common.StrIndex)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(DeviceServiceServer).GetSentMessageIds(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pagerino.device.DeviceService/GetSentMessageIds",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(DeviceServiceServer).GetSentMessageIds(ctx, req.(*common.StrIndex))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _DeviceService_GetReceivedMessageIds_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(common.StrIndex)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(DeviceServiceServer).GetReceivedMessageIds(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pagerino.device.DeviceService/GetReceivedMessageIds",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(DeviceServiceServer).GetReceivedMessageIds(ctx, req.(*common.StrIndex))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _DeviceService_GetLogs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(common.StrIndex)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(DeviceServiceServer).GetLogs(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pagerino.device.DeviceService/GetLogs",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(DeviceServiceServer).GetLogs(ctx, req.(*common.StrIndex))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _DeviceService_GetActivity_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(common.StrIndex)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(DeviceServiceServer).GetActivity(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pagerino.device.DeviceService/GetActivity",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(DeviceServiceServer).GetActivity(ctx, req.(*common.StrIndex))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _DeviceService_GetMeta_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(common.StrIndex)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(DeviceServiceServer).GetMeta(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pagerino.device.DeviceService/GetMeta",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(DeviceServiceServer).GetMeta(ctx, req.(*common.StrIndex))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// DeviceService_ServiceDesc is the grpc.ServiceDesc for DeviceService service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var DeviceService_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "pagerino.device.DeviceService",
|
||||
HandlerType: (*DeviceServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "GetAll",
|
||||
Handler: _DeviceService_GetAll_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetInfo",
|
||||
Handler: _DeviceService_GetInfo_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetCharge",
|
||||
Handler: _DeviceService_GetCharge_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetLocation",
|
||||
Handler: _DeviceService_GetLocation_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetNfcCardIds",
|
||||
Handler: _DeviceService_GetNfcCardIds_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetStatusIds",
|
||||
Handler: _DeviceService_GetStatusIds_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetSentMessageIds",
|
||||
Handler: _DeviceService_GetSentMessageIds_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetReceivedMessageIds",
|
||||
Handler: _DeviceService_GetReceivedMessageIds_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetLogs",
|
||||
Handler: _DeviceService_GetLogs_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetActivity",
|
||||
Handler: _DeviceService_GetActivity_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetMeta",
|
||||
Handler: _DeviceService_GetMeta_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "device.proto",
|
||||
}
|
||||
81
AppServer/src/app_comm/api/log/log.pb.go
Normal file
81
AppServer/src/app_comm/api/log/log.pb.go
Normal file
@@ -0,0 +1,81 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.25.0-devel
|
||||
// protoc v3.14.0
|
||||
// source: log.proto
|
||||
|
||||
package api_log
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
common "server/app_comm/api/common"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
var File_log_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_log_proto_rawDesc = []byte{
|
||||
0x0a, 0x09, 0x6c, 0x6f, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x70, 0x61, 0x67,
|
||||
0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x6c, 0x6f, 0x67, 0x1a, 0x0c, 0x63, 0x6f, 0x6d, 0x6d, 0x6f,
|
||||
0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x8b, 0x01, 0x0a, 0x0a, 0x4c, 0x6f, 0x67, 0x53,
|
||||
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x43, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x43, 0x68, 0x61,
|
||||
0x6e, 0x67, 0x65, 0x49, 0x64, 0x73, 0x12, 0x16, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e,
|
||||
0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x1a, 0x1b,
|
||||
0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
|
||||
0x2e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x38, 0x0a, 0x07, 0x47,
|
||||
0x65, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x12, 0x16, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e,
|
||||
0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x1a, 0x15,
|
||||
0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
|
||||
0x2e, 0x4d, 0x65, 0x74, 0x61, 0x42, 0x21, 0x5a, 0x1f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f,
|
||||
0x61, 0x70, 0x70, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x6f, 0x67,
|
||||
0x3b, 0x61, 0x70, 0x69, 0x5f, 0x6c, 0x6f, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var file_log_proto_goTypes = []interface{}{
|
||||
(*common.Index)(nil), // 0: pagerino.common.Index
|
||||
(*common.References)(nil), // 1: pagerino.common.References
|
||||
(*common.Meta)(nil), // 2: pagerino.common.Meta
|
||||
}
|
||||
var file_log_proto_depIdxs = []int32{
|
||||
0, // 0: pagerino.log.LogService.GetChangeIds:input_type -> pagerino.common.Index
|
||||
0, // 1: pagerino.log.LogService.GetMeta:input_type -> pagerino.common.Index
|
||||
1, // 2: pagerino.log.LogService.GetChangeIds:output_type -> pagerino.common.References
|
||||
2, // 3: pagerino.log.LogService.GetMeta:output_type -> pagerino.common.Meta
|
||||
2, // [2:4] is the sub-list for method output_type
|
||||
0, // [0:2] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_log_proto_init() }
|
||||
func file_log_proto_init() {
|
||||
if File_log_proto != nil {
|
||||
return
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_log_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 0,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_log_proto_goTypes,
|
||||
DependencyIndexes: file_log_proto_depIdxs,
|
||||
}.Build()
|
||||
File_log_proto = out.File
|
||||
file_log_proto_rawDesc = nil
|
||||
file_log_proto_goTypes = nil
|
||||
file_log_proto_depIdxs = nil
|
||||
}
|
||||
144
AppServer/src/app_comm/api/log/log_grpc.pb.go
Normal file
144
AppServer/src/app_comm/api/log/log_grpc.pb.go
Normal file
@@ -0,0 +1,144 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
|
||||
package api_log
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
common "server/app_comm/api/common"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.32.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion7
|
||||
|
||||
// LogServiceClient is the client API for LogService service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type LogServiceClient interface {
|
||||
// === DB information
|
||||
// References
|
||||
GetChangeIds(ctx context.Context, in *common.Index, opts ...grpc.CallOption) (*common.References, error)
|
||||
// Common
|
||||
GetMeta(ctx context.Context, in *common.Index, opts ...grpc.CallOption) (*common.Meta, error)
|
||||
}
|
||||
|
||||
type logServiceClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewLogServiceClient(cc grpc.ClientConnInterface) LogServiceClient {
|
||||
return &logServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *logServiceClient) GetChangeIds(ctx context.Context, in *common.Index, opts ...grpc.CallOption) (*common.References, error) {
|
||||
out := new(common.References)
|
||||
err := c.cc.Invoke(ctx, "/pagerino.log.LogService/GetChangeIds", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *logServiceClient) GetMeta(ctx context.Context, in *common.Index, opts ...grpc.CallOption) (*common.Meta, error) {
|
||||
out := new(common.Meta)
|
||||
err := c.cc.Invoke(ctx, "/pagerino.log.LogService/GetMeta", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// LogServiceServer is the server API for LogService service.
|
||||
// All implementations must embed UnimplementedLogServiceServer
|
||||
// for forward compatibility
|
||||
type LogServiceServer interface {
|
||||
// === DB information
|
||||
// References
|
||||
GetChangeIds(context.Context, *common.Index) (*common.References, error)
|
||||
// Common
|
||||
GetMeta(context.Context, *common.Index) (*common.Meta, error)
|
||||
mustEmbedUnimplementedLogServiceServer()
|
||||
}
|
||||
|
||||
// UnimplementedLogServiceServer must be embedded to have forward compatible implementations.
|
||||
type UnimplementedLogServiceServer struct {
|
||||
}
|
||||
|
||||
func (UnimplementedLogServiceServer) GetChangeIds(context.Context, *common.Index) (*common.References, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetChangeIds not implemented")
|
||||
}
|
||||
func (UnimplementedLogServiceServer) GetMeta(context.Context, *common.Index) (*common.Meta, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetMeta not implemented")
|
||||
}
|
||||
func (UnimplementedLogServiceServer) mustEmbedUnimplementedLogServiceServer() {}
|
||||
|
||||
// UnsafeLogServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to LogServiceServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeLogServiceServer interface {
|
||||
mustEmbedUnimplementedLogServiceServer()
|
||||
}
|
||||
|
||||
func RegisterLogServiceServer(s grpc.ServiceRegistrar, srv LogServiceServer) {
|
||||
s.RegisterService(&LogService_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _LogService_GetChangeIds_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(common.Index)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(LogServiceServer).GetChangeIds(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pagerino.log.LogService/GetChangeIds",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(LogServiceServer).GetChangeIds(ctx, req.(*common.Index))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _LogService_GetMeta_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(common.Index)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(LogServiceServer).GetMeta(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pagerino.log.LogService/GetMeta",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(LogServiceServer).GetMeta(ctx, req.(*common.Index))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// LogService_ServiceDesc is the grpc.ServiceDesc for LogService service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var LogService_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "pagerino.log.LogService",
|
||||
HandlerType: (*LogServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "GetChangeIds",
|
||||
Handler: _LogService_GetChangeIds_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetMeta",
|
||||
Handler: _LogService_GetMeta_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "log.proto",
|
||||
}
|
||||
267
AppServer/src/app_comm/api/message/message.pb.go
Normal file
267
AppServer/src/app_comm/api/message/message.pb.go
Normal file
@@ -0,0 +1,267 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.25.0-devel
|
||||
// protoc v3.14.0
|
||||
// source: message.proto
|
||||
|
||||
package api_message
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
|
||||
reflect "reflect"
|
||||
common "server/app_comm/api/common"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type MessageBasicInfo struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
SenderId int32 `protobuf:"varint,1,opt,name=sender_id,json=senderId,proto3" json:"sender_id,omitempty"`
|
||||
ReceiverId int32 `protobuf:"varint,2,opt,name=receiver_id,json=receiverId,proto3" json:"receiver_id,omitempty"`
|
||||
Payload string `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload,omitempty"`
|
||||
CreatedAt *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
|
||||
}
|
||||
|
||||
func (x *MessageBasicInfo) Reset() {
|
||||
*x = MessageBasicInfo{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_message_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *MessageBasicInfo) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*MessageBasicInfo) ProtoMessage() {}
|
||||
|
||||
func (x *MessageBasicInfo) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_message_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use MessageBasicInfo.ProtoReflect.Descriptor instead.
|
||||
func (*MessageBasicInfo) Descriptor() ([]byte, []int) {
|
||||
return file_message_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *MessageBasicInfo) GetSenderId() int32 {
|
||||
if x != nil {
|
||||
return x.SenderId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *MessageBasicInfo) GetReceiverId() int32 {
|
||||
if x != nil {
|
||||
return x.ReceiverId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *MessageBasicInfo) GetPayload() string {
|
||||
if x != nil {
|
||||
return x.Payload
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *MessageBasicInfo) GetCreatedAt() *timestamppb.Timestamp {
|
||||
if x != nil {
|
||||
return x.CreatedAt
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Payload struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Payload string `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"`
|
||||
}
|
||||
|
||||
func (x *Payload) Reset() {
|
||||
*x = Payload{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_message_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Payload) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Payload) ProtoMessage() {}
|
||||
|
||||
func (x *Payload) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_message_proto_msgTypes[1]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Payload.ProtoReflect.Descriptor instead.
|
||||
func (*Payload) Descriptor() ([]byte, []int) {
|
||||
return file_message_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *Payload) GetPayload() string {
|
||||
if x != nil {
|
||||
return x.Payload
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_message_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_message_proto_rawDesc = []byte{
|
||||
0x0a, 0x0d, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,
|
||||
0x10, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67,
|
||||
0x65, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
|
||||
0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x1a, 0x0c, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x22, 0xa5, 0x01, 0x0a, 0x10, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x42, 0x61, 0x73, 0x69,
|
||||
0x63, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x5f,
|
||||
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72,
|
||||
0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x5f, 0x69,
|
||||
0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65,
|
||||
0x72, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x03,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x39, 0x0a,
|
||||
0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28,
|
||||
0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x63,
|
||||
0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0x23, 0x0a, 0x07, 0x50, 0x61, 0x79, 0x6c,
|
||||
0x6f, 0x61, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x32, 0xd2, 0x01,
|
||||
0x0a, 0x0e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
|
||||
0x12, 0x45, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x2e, 0x70, 0x61,
|
||||
0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x49, 0x6e,
|
||||
0x64, 0x65, 0x78, 0x1a, 0x22, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x6d,
|
||||
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x42, 0x61,
|
||||
0x73, 0x69, 0x63, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x3f, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x50, 0x61,
|
||||
0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x16, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f,
|
||||
0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x1a, 0x19, 0x2e,
|
||||
0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
|
||||
0x2e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x38, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x4d,
|
||||
0x65, 0x74, 0x61, 0x12, 0x16, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x63,
|
||||
0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x1a, 0x15, 0x2e, 0x70, 0x61,
|
||||
0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65,
|
||||
0x74, 0x61, 0x42, 0x29, 0x5a, 0x27, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x70,
|
||||
0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67,
|
||||
0x65, 0x3b, 0x61, 0x70, 0x69, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x62, 0x06, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_message_proto_rawDescOnce sync.Once
|
||||
file_message_proto_rawDescData = file_message_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_message_proto_rawDescGZIP() []byte {
|
||||
file_message_proto_rawDescOnce.Do(func() {
|
||||
file_message_proto_rawDescData = protoimpl.X.CompressGZIP(file_message_proto_rawDescData)
|
||||
})
|
||||
return file_message_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_message_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||
var file_message_proto_goTypes = []interface{}{
|
||||
(*MessageBasicInfo)(nil), // 0: pagerino.message.MessageBasicInfo
|
||||
(*Payload)(nil), // 1: pagerino.message.Payload
|
||||
(*timestamppb.Timestamp)(nil), // 2: google.protobuf.Timestamp
|
||||
(*common.Index)(nil), // 3: pagerino.common.Index
|
||||
(*common.Meta)(nil), // 4: pagerino.common.Meta
|
||||
}
|
||||
var file_message_proto_depIdxs = []int32{
|
||||
2, // 0: pagerino.message.MessageBasicInfo.created_at:type_name -> google.protobuf.Timestamp
|
||||
3, // 1: pagerino.message.MessageService.GetInfo:input_type -> pagerino.common.Index
|
||||
3, // 2: pagerino.message.MessageService.GetPayload:input_type -> pagerino.common.Index
|
||||
3, // 3: pagerino.message.MessageService.GetMeta:input_type -> pagerino.common.Index
|
||||
0, // 4: pagerino.message.MessageService.GetInfo:output_type -> pagerino.message.MessageBasicInfo
|
||||
1, // 5: pagerino.message.MessageService.GetPayload:output_type -> pagerino.message.Payload
|
||||
4, // 6: pagerino.message.MessageService.GetMeta:output_type -> pagerino.common.Meta
|
||||
4, // [4:7] is the sub-list for method output_type
|
||||
1, // [1:4] is the sub-list for method input_type
|
||||
1, // [1:1] is the sub-list for extension type_name
|
||||
1, // [1:1] is the sub-list for extension extendee
|
||||
0, // [0:1] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_message_proto_init() }
|
||||
func file_message_proto_init() {
|
||||
if File_message_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_message_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*MessageBasicInfo); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_message_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Payload); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_message_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 2,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_message_proto_goTypes,
|
||||
DependencyIndexes: file_message_proto_depIdxs,
|
||||
MessageInfos: file_message_proto_msgTypes,
|
||||
}.Build()
|
||||
File_message_proto = out.File
|
||||
file_message_proto_rawDesc = nil
|
||||
file_message_proto_goTypes = nil
|
||||
file_message_proto_depIdxs = nil
|
||||
}
|
||||
178
AppServer/src/app_comm/api/message/message_grpc.pb.go
Normal file
178
AppServer/src/app_comm/api/message/message_grpc.pb.go
Normal file
@@ -0,0 +1,178 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
|
||||
package api_message
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
common "server/app_comm/api/common"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.32.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion7
|
||||
|
||||
// MessageServiceClient is the client API for MessageService service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type MessageServiceClient interface {
|
||||
// === DB information
|
||||
GetInfo(ctx context.Context, in *common.Index, opts ...grpc.CallOption) (*MessageBasicInfo, error)
|
||||
GetPayload(ctx context.Context, in *common.Index, opts ...grpc.CallOption) (*Payload, error)
|
||||
// Common
|
||||
GetMeta(ctx context.Context, in *common.Index, opts ...grpc.CallOption) (*common.Meta, error)
|
||||
}
|
||||
|
||||
type messageServiceClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewMessageServiceClient(cc grpc.ClientConnInterface) MessageServiceClient {
|
||||
return &messageServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *messageServiceClient) GetInfo(ctx context.Context, in *common.Index, opts ...grpc.CallOption) (*MessageBasicInfo, error) {
|
||||
out := new(MessageBasicInfo)
|
||||
err := c.cc.Invoke(ctx, "/pagerino.message.MessageService/GetInfo", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *messageServiceClient) GetPayload(ctx context.Context, in *common.Index, opts ...grpc.CallOption) (*Payload, error) {
|
||||
out := new(Payload)
|
||||
err := c.cc.Invoke(ctx, "/pagerino.message.MessageService/GetPayload", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *messageServiceClient) GetMeta(ctx context.Context, in *common.Index, opts ...grpc.CallOption) (*common.Meta, error) {
|
||||
out := new(common.Meta)
|
||||
err := c.cc.Invoke(ctx, "/pagerino.message.MessageService/GetMeta", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// MessageServiceServer is the server API for MessageService service.
|
||||
// All implementations must embed UnimplementedMessageServiceServer
|
||||
// for forward compatibility
|
||||
type MessageServiceServer interface {
|
||||
// === DB information
|
||||
GetInfo(context.Context, *common.Index) (*MessageBasicInfo, error)
|
||||
GetPayload(context.Context, *common.Index) (*Payload, error)
|
||||
// Common
|
||||
GetMeta(context.Context, *common.Index) (*common.Meta, error)
|
||||
mustEmbedUnimplementedMessageServiceServer()
|
||||
}
|
||||
|
||||
// UnimplementedMessageServiceServer must be embedded to have forward compatible implementations.
|
||||
type UnimplementedMessageServiceServer struct {
|
||||
}
|
||||
|
||||
func (UnimplementedMessageServiceServer) GetInfo(context.Context, *common.Index) (*MessageBasicInfo, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetInfo not implemented")
|
||||
}
|
||||
func (UnimplementedMessageServiceServer) GetPayload(context.Context, *common.Index) (*Payload, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetPayload not implemented")
|
||||
}
|
||||
func (UnimplementedMessageServiceServer) GetMeta(context.Context, *common.Index) (*common.Meta, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetMeta not implemented")
|
||||
}
|
||||
func (UnimplementedMessageServiceServer) mustEmbedUnimplementedMessageServiceServer() {}
|
||||
|
||||
// UnsafeMessageServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to MessageServiceServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeMessageServiceServer interface {
|
||||
mustEmbedUnimplementedMessageServiceServer()
|
||||
}
|
||||
|
||||
func RegisterMessageServiceServer(s grpc.ServiceRegistrar, srv MessageServiceServer) {
|
||||
s.RegisterService(&MessageService_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _MessageService_GetInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(common.Index)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MessageServiceServer).GetInfo(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pagerino.message.MessageService/GetInfo",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MessageServiceServer).GetInfo(ctx, req.(*common.Index))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _MessageService_GetPayload_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(common.Index)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MessageServiceServer).GetPayload(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pagerino.message.MessageService/GetPayload",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MessageServiceServer).GetPayload(ctx, req.(*common.Index))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _MessageService_GetMeta_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(common.Index)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MessageServiceServer).GetMeta(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pagerino.message.MessageService/GetMeta",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MessageServiceServer).GetMeta(ctx, req.(*common.Index))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// MessageService_ServiceDesc is the grpc.ServiceDesc for MessageService service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var MessageService_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "pagerino.message.MessageService",
|
||||
HandlerType: (*MessageServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "GetInfo",
|
||||
Handler: _MessageService_GetInfo_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetPayload",
|
||||
Handler: _MessageService_GetPayload_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetMeta",
|
||||
Handler: _MessageService_GetMeta_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "message.proto",
|
||||
}
|
||||
168
AppServer/src/app_comm/api/nfccard/nfccard.pb.go
Normal file
168
AppServer/src/app_comm/api/nfccard/nfccard.pb.go
Normal file
@@ -0,0 +1,168 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.25.0-devel
|
||||
// protoc v3.14.0
|
||||
// source: nfccard.proto
|
||||
|
||||
package api_nfccard
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
common "server/app_comm/api/common"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type NfcCardBaseInfo struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid,omitempty"`
|
||||
}
|
||||
|
||||
func (x *NfcCardBaseInfo) Reset() {
|
||||
*x = NfcCardBaseInfo{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_nfccard_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *NfcCardBaseInfo) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*NfcCardBaseInfo) ProtoMessage() {}
|
||||
|
||||
func (x *NfcCardBaseInfo) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_nfccard_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use NfcCardBaseInfo.ProtoReflect.Descriptor instead.
|
||||
func (*NfcCardBaseInfo) Descriptor() ([]byte, []int) {
|
||||
return file_nfccard_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *NfcCardBaseInfo) GetUid() string {
|
||||
if x != nil {
|
||||
return x.Uid
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_nfccard_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_nfccard_proto_rawDesc = []byte{
|
||||
0x0a, 0x0d, 0x6e, 0x66, 0x63, 0x63, 0x61, 0x72, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,
|
||||
0x11, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x6e, 0x66, 0x63, 0x5f, 0x63, 0x61,
|
||||
0x72, 0x64, 0x1a, 0x0c, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x22, 0x23, 0x0a, 0x0f, 0x4e, 0x66, 0x63, 0x43, 0x61, 0x72, 0x64, 0x42, 0x61, 0x73, 0x65, 0x49,
|
||||
0x6e, 0x66, 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x03, 0x75, 0x69, 0x64, 0x32, 0xd4, 0x01, 0x0a, 0x0e, 0x4e, 0x66, 0x63, 0x43, 0x61, 0x72,
|
||||
0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x45, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x49,
|
||||
0x6e, 0x66, 0x6f, 0x12, 0x16, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x63,
|
||||
0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x1a, 0x22, 0x2e, 0x70, 0x61,
|
||||
0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x6e, 0x66, 0x63, 0x5f, 0x63, 0x61, 0x72, 0x64, 0x2e,
|
||||
0x4e, 0x66, 0x63, 0x43, 0x61, 0x72, 0x64, 0x42, 0x61, 0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12,
|
||||
0x41, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x16,
|
||||
0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
|
||||
0x2e, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x1a, 0x1a, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e,
|
||||
0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e,
|
||||
0x63, 0x65, 0x12, 0x38, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x12, 0x16, 0x2e,
|
||||
0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e,
|
||||
0x49, 0x6e, 0x64, 0x65, 0x78, 0x1a, 0x15, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f,
|
||||
0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x42, 0x29, 0x5a, 0x27,
|
||||
0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x70, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x2f,
|
||||
0x61, 0x70, 0x69, 0x2f, 0x6e, 0x66, 0x63, 0x63, 0x61, 0x72, 0x64, 0x3b, 0x61, 0x70, 0x69, 0x5f,
|
||||
0x6e, 0x66, 0x63, 0x63, 0x61, 0x72, 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_nfccard_proto_rawDescOnce sync.Once
|
||||
file_nfccard_proto_rawDescData = file_nfccard_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_nfccard_proto_rawDescGZIP() []byte {
|
||||
file_nfccard_proto_rawDescOnce.Do(func() {
|
||||
file_nfccard_proto_rawDescData = protoimpl.X.CompressGZIP(file_nfccard_proto_rawDescData)
|
||||
})
|
||||
return file_nfccard_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_nfccard_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_nfccard_proto_goTypes = []interface{}{
|
||||
(*NfcCardBaseInfo)(nil), // 0: pagerino.nfc_card.NfcCardBaseInfo
|
||||
(*common.Index)(nil), // 1: pagerino.common.Index
|
||||
(*common.Reference)(nil), // 2: pagerino.common.Reference
|
||||
(*common.Meta)(nil), // 3: pagerino.common.Meta
|
||||
}
|
||||
var file_nfccard_proto_depIdxs = []int32{
|
||||
1, // 0: pagerino.nfc_card.NfcCardService.GetInfo:input_type -> pagerino.common.Index
|
||||
1, // 1: pagerino.nfc_card.NfcCardService.GetDeviceId:input_type -> pagerino.common.Index
|
||||
1, // 2: pagerino.nfc_card.NfcCardService.GetMeta:input_type -> pagerino.common.Index
|
||||
0, // 3: pagerino.nfc_card.NfcCardService.GetInfo:output_type -> pagerino.nfc_card.NfcCardBaseInfo
|
||||
2, // 4: pagerino.nfc_card.NfcCardService.GetDeviceId:output_type -> pagerino.common.Reference
|
||||
3, // 5: pagerino.nfc_card.NfcCardService.GetMeta:output_type -> pagerino.common.Meta
|
||||
3, // [3:6] is the sub-list for method output_type
|
||||
0, // [0:3] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_nfccard_proto_init() }
|
||||
func file_nfccard_proto_init() {
|
||||
if File_nfccard_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_nfccard_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*NfcCardBaseInfo); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_nfccard_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 1,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_nfccard_proto_goTypes,
|
||||
DependencyIndexes: file_nfccard_proto_depIdxs,
|
||||
MessageInfos: file_nfccard_proto_msgTypes,
|
||||
}.Build()
|
||||
File_nfccard_proto = out.File
|
||||
file_nfccard_proto_rawDesc = nil
|
||||
file_nfccard_proto_goTypes = nil
|
||||
file_nfccard_proto_depIdxs = nil
|
||||
}
|
||||
180
AppServer/src/app_comm/api/nfccard/nfccard_grpc.pb.go
Normal file
180
AppServer/src/app_comm/api/nfccard/nfccard_grpc.pb.go
Normal file
@@ -0,0 +1,180 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
|
||||
package api_nfccard
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
common "server/app_comm/api/common"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.32.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion7
|
||||
|
||||
// NfcCardServiceClient is the client API for NfcCardService service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type NfcCardServiceClient interface {
|
||||
// === DB information
|
||||
GetInfo(ctx context.Context, in *common.Index, opts ...grpc.CallOption) (*NfcCardBaseInfo, error)
|
||||
// References
|
||||
GetDeviceId(ctx context.Context, in *common.Index, opts ...grpc.CallOption) (*common.Reference, error)
|
||||
// Common
|
||||
GetMeta(ctx context.Context, in *common.Index, opts ...grpc.CallOption) (*common.Meta, error)
|
||||
}
|
||||
|
||||
type nfcCardServiceClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewNfcCardServiceClient(cc grpc.ClientConnInterface) NfcCardServiceClient {
|
||||
return &nfcCardServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *nfcCardServiceClient) GetInfo(ctx context.Context, in *common.Index, opts ...grpc.CallOption) (*NfcCardBaseInfo, error) {
|
||||
out := new(NfcCardBaseInfo)
|
||||
err := c.cc.Invoke(ctx, "/pagerino.nfc_card.NfcCardService/GetInfo", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *nfcCardServiceClient) GetDeviceId(ctx context.Context, in *common.Index, opts ...grpc.CallOption) (*common.Reference, error) {
|
||||
out := new(common.Reference)
|
||||
err := c.cc.Invoke(ctx, "/pagerino.nfc_card.NfcCardService/GetDeviceId", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *nfcCardServiceClient) GetMeta(ctx context.Context, in *common.Index, opts ...grpc.CallOption) (*common.Meta, error) {
|
||||
out := new(common.Meta)
|
||||
err := c.cc.Invoke(ctx, "/pagerino.nfc_card.NfcCardService/GetMeta", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// NfcCardServiceServer is the server API for NfcCardService service.
|
||||
// All implementations must embed UnimplementedNfcCardServiceServer
|
||||
// for forward compatibility
|
||||
type NfcCardServiceServer interface {
|
||||
// === DB information
|
||||
GetInfo(context.Context, *common.Index) (*NfcCardBaseInfo, error)
|
||||
// References
|
||||
GetDeviceId(context.Context, *common.Index) (*common.Reference, error)
|
||||
// Common
|
||||
GetMeta(context.Context, *common.Index) (*common.Meta, error)
|
||||
mustEmbedUnimplementedNfcCardServiceServer()
|
||||
}
|
||||
|
||||
// UnimplementedNfcCardServiceServer must be embedded to have forward compatible implementations.
|
||||
type UnimplementedNfcCardServiceServer struct {
|
||||
}
|
||||
|
||||
func (UnimplementedNfcCardServiceServer) GetInfo(context.Context, *common.Index) (*NfcCardBaseInfo, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetInfo not implemented")
|
||||
}
|
||||
func (UnimplementedNfcCardServiceServer) GetDeviceId(context.Context, *common.Index) (*common.Reference, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetDeviceId not implemented")
|
||||
}
|
||||
func (UnimplementedNfcCardServiceServer) GetMeta(context.Context, *common.Index) (*common.Meta, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetMeta not implemented")
|
||||
}
|
||||
func (UnimplementedNfcCardServiceServer) mustEmbedUnimplementedNfcCardServiceServer() {}
|
||||
|
||||
// UnsafeNfcCardServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to NfcCardServiceServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeNfcCardServiceServer interface {
|
||||
mustEmbedUnimplementedNfcCardServiceServer()
|
||||
}
|
||||
|
||||
func RegisterNfcCardServiceServer(s grpc.ServiceRegistrar, srv NfcCardServiceServer) {
|
||||
s.RegisterService(&NfcCardService_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _NfcCardService_GetInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(common.Index)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(NfcCardServiceServer).GetInfo(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pagerino.nfc_card.NfcCardService/GetInfo",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(NfcCardServiceServer).GetInfo(ctx, req.(*common.Index))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _NfcCardService_GetDeviceId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(common.Index)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(NfcCardServiceServer).GetDeviceId(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pagerino.nfc_card.NfcCardService/GetDeviceId",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(NfcCardServiceServer).GetDeviceId(ctx, req.(*common.Index))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _NfcCardService_GetMeta_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(common.Index)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(NfcCardServiceServer).GetMeta(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pagerino.nfc_card.NfcCardService/GetMeta",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(NfcCardServiceServer).GetMeta(ctx, req.(*common.Index))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// NfcCardService_ServiceDesc is the grpc.ServiceDesc for NfcCardService service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var NfcCardService_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "pagerino.nfc_card.NfcCardService",
|
||||
HandlerType: (*NfcCardServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "GetInfo",
|
||||
Handler: _NfcCardService_GetInfo_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetDeviceId",
|
||||
Handler: _NfcCardService_GetDeviceId_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetMeta",
|
||||
Handler: _NfcCardService_GetMeta_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "nfccard.proto",
|
||||
}
|
||||
181
AppServer/src/app_comm/api/permission/permission.pb.go
Normal file
181
AppServer/src/app_comm/api/permission/permission.pb.go
Normal file
@@ -0,0 +1,181 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.25.0-devel
|
||||
// protoc v3.14.0
|
||||
// source: permission.proto
|
||||
|
||||
package api_permission
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
common "server/app_comm/api/common"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type PermissionBasicInfo struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
|
||||
}
|
||||
|
||||
func (x *PermissionBasicInfo) Reset() {
|
||||
*x = PermissionBasicInfo{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_permission_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *PermissionBasicInfo) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*PermissionBasicInfo) ProtoMessage() {}
|
||||
|
||||
func (x *PermissionBasicInfo) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_permission_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use PermissionBasicInfo.ProtoReflect.Descriptor instead.
|
||||
func (*PermissionBasicInfo) Descriptor() ([]byte, []int) {
|
||||
return file_permission_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *PermissionBasicInfo) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *PermissionBasicInfo) GetDescription() string {
|
||||
if x != nil {
|
||||
return x.Description
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_permission_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_permission_proto_rawDesc = []byte{
|
||||
0x0a, 0x10, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x12, 0x13, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x65, 0x72,
|
||||
0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x1a, 0x0c, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x4b, 0x0a, 0x13, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73,
|
||||
0x69, 0x6f, 0x6e, 0x42, 0x61, 0x73, 0x69, 0x63, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04,
|
||||
0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65,
|
||||
0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x32, 0xe6, 0x01, 0x0a, 0x11, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f,
|
||||
0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x4e, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x49,
|
||||
0x6e, 0x66, 0x6f, 0x12, 0x19, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x63,
|
||||
0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x1a, 0x28,
|
||||
0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73,
|
||||
0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x42,
|
||||
0x61, 0x73, 0x69, 0x63, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x44, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x52,
|
||||
0x6f, 0x6c, 0x65, 0x49, 0x64, 0x73, 0x12, 0x19, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e,
|
||||
0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x72, 0x49, 0x6e, 0x64, 0x65,
|
||||
0x78, 0x1a, 0x1b, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6f, 0x6d,
|
||||
0x6d, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x3b,
|
||||
0x0a, 0x07, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x12, 0x19, 0x2e, 0x70, 0x61, 0x67, 0x65,
|
||||
0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x72, 0x49,
|
||||
0x6e, 0x64, 0x65, 0x78, 0x1a, 0x15, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e,
|
||||
0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x42, 0x2f, 0x5a, 0x2d, 0x73,
|
||||
0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x70, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x2f, 0x61,
|
||||
0x70, 0x69, 0x2f, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x3b, 0x61, 0x70,
|
||||
0x69, 0x5f, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_permission_proto_rawDescOnce sync.Once
|
||||
file_permission_proto_rawDescData = file_permission_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_permission_proto_rawDescGZIP() []byte {
|
||||
file_permission_proto_rawDescOnce.Do(func() {
|
||||
file_permission_proto_rawDescData = protoimpl.X.CompressGZIP(file_permission_proto_rawDescData)
|
||||
})
|
||||
return file_permission_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_permission_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_permission_proto_goTypes = []interface{}{
|
||||
(*PermissionBasicInfo)(nil), // 0: pagerino.permission.PermissionBasicInfo
|
||||
(*common.StrIndex)(nil), // 1: pagerino.common.StrIndex
|
||||
(*common.References)(nil), // 2: pagerino.common.References
|
||||
(*common.Meta)(nil), // 3: pagerino.common.Meta
|
||||
}
|
||||
var file_permission_proto_depIdxs = []int32{
|
||||
1, // 0: pagerino.permission.PermissionService.GetInfo:input_type -> pagerino.common.StrIndex
|
||||
1, // 1: pagerino.permission.PermissionService.GetRoleIds:input_type -> pagerino.common.StrIndex
|
||||
1, // 2: pagerino.permission.PermissionService.GetMeta:input_type -> pagerino.common.StrIndex
|
||||
0, // 3: pagerino.permission.PermissionService.GetInfo:output_type -> pagerino.permission.PermissionBasicInfo
|
||||
2, // 4: pagerino.permission.PermissionService.GetRoleIds:output_type -> pagerino.common.References
|
||||
3, // 5: pagerino.permission.PermissionService.GetMeta:output_type -> pagerino.common.Meta
|
||||
3, // [3:6] is the sub-list for method output_type
|
||||
0, // [0:3] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_permission_proto_init() }
|
||||
func file_permission_proto_init() {
|
||||
if File_permission_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_permission_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*PermissionBasicInfo); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_permission_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 1,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_permission_proto_goTypes,
|
||||
DependencyIndexes: file_permission_proto_depIdxs,
|
||||
MessageInfos: file_permission_proto_msgTypes,
|
||||
}.Build()
|
||||
File_permission_proto = out.File
|
||||
file_permission_proto_rawDesc = nil
|
||||
file_permission_proto_goTypes = nil
|
||||
file_permission_proto_depIdxs = nil
|
||||
}
|
||||
180
AppServer/src/app_comm/api/permission/permission_grpc.pb.go
Normal file
180
AppServer/src/app_comm/api/permission/permission_grpc.pb.go
Normal file
@@ -0,0 +1,180 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
|
||||
package api_permission
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
common "server/app_comm/api/common"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.32.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion7
|
||||
|
||||
// PermissionServiceClient is the client API for PermissionService service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type PermissionServiceClient interface {
|
||||
// === DB information
|
||||
GetInfo(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*PermissionBasicInfo, error)
|
||||
// References
|
||||
GetRoleIds(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*common.References, error)
|
||||
// Common
|
||||
GetMeta(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*common.Meta, error)
|
||||
}
|
||||
|
||||
type permissionServiceClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewPermissionServiceClient(cc grpc.ClientConnInterface) PermissionServiceClient {
|
||||
return &permissionServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *permissionServiceClient) GetInfo(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*PermissionBasicInfo, error) {
|
||||
out := new(PermissionBasicInfo)
|
||||
err := c.cc.Invoke(ctx, "/pagerino.permission.PermissionService/GetInfo", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *permissionServiceClient) GetRoleIds(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*common.References, error) {
|
||||
out := new(common.References)
|
||||
err := c.cc.Invoke(ctx, "/pagerino.permission.PermissionService/GetRoleIds", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *permissionServiceClient) GetMeta(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*common.Meta, error) {
|
||||
out := new(common.Meta)
|
||||
err := c.cc.Invoke(ctx, "/pagerino.permission.PermissionService/GetMeta", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// PermissionServiceServer is the server API for PermissionService service.
|
||||
// All implementations must embed UnimplementedPermissionServiceServer
|
||||
// for forward compatibility
|
||||
type PermissionServiceServer interface {
|
||||
// === DB information
|
||||
GetInfo(context.Context, *common.StrIndex) (*PermissionBasicInfo, error)
|
||||
// References
|
||||
GetRoleIds(context.Context, *common.StrIndex) (*common.References, error)
|
||||
// Common
|
||||
GetMeta(context.Context, *common.StrIndex) (*common.Meta, error)
|
||||
mustEmbedUnimplementedPermissionServiceServer()
|
||||
}
|
||||
|
||||
// UnimplementedPermissionServiceServer must be embedded to have forward compatible implementations.
|
||||
type UnimplementedPermissionServiceServer struct {
|
||||
}
|
||||
|
||||
func (UnimplementedPermissionServiceServer) GetInfo(context.Context, *common.StrIndex) (*PermissionBasicInfo, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetInfo not implemented")
|
||||
}
|
||||
func (UnimplementedPermissionServiceServer) GetRoleIds(context.Context, *common.StrIndex) (*common.References, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetRoleIds not implemented")
|
||||
}
|
||||
func (UnimplementedPermissionServiceServer) GetMeta(context.Context, *common.StrIndex) (*common.Meta, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetMeta not implemented")
|
||||
}
|
||||
func (UnimplementedPermissionServiceServer) mustEmbedUnimplementedPermissionServiceServer() {}
|
||||
|
||||
// UnsafePermissionServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to PermissionServiceServer will
|
||||
// result in compilation errors.
|
||||
type UnsafePermissionServiceServer interface {
|
||||
mustEmbedUnimplementedPermissionServiceServer()
|
||||
}
|
||||
|
||||
func RegisterPermissionServiceServer(s grpc.ServiceRegistrar, srv PermissionServiceServer) {
|
||||
s.RegisterService(&PermissionService_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _PermissionService_GetInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(common.StrIndex)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(PermissionServiceServer).GetInfo(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pagerino.permission.PermissionService/GetInfo",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(PermissionServiceServer).GetInfo(ctx, req.(*common.StrIndex))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _PermissionService_GetRoleIds_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(common.StrIndex)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(PermissionServiceServer).GetRoleIds(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pagerino.permission.PermissionService/GetRoleIds",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(PermissionServiceServer).GetRoleIds(ctx, req.(*common.StrIndex))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _PermissionService_GetMeta_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(common.StrIndex)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(PermissionServiceServer).GetMeta(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pagerino.permission.PermissionService/GetMeta",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(PermissionServiceServer).GetMeta(ctx, req.(*common.StrIndex))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// PermissionService_ServiceDesc is the grpc.ServiceDesc for PermissionService service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var PermissionService_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "pagerino.permission.PermissionService",
|
||||
HandlerType: (*PermissionServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "GetInfo",
|
||||
Handler: _PermissionService_GetInfo_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetRoleIds",
|
||||
Handler: _PermissionService_GetRoleIds_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetMeta",
|
||||
Handler: _PermissionService_GetMeta_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "permission.proto",
|
||||
}
|
||||
184
AppServer/src/app_comm/api/role/role.pb.go
Normal file
184
AppServer/src/app_comm/api/role/role.pb.go
Normal file
@@ -0,0 +1,184 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.25.0-devel
|
||||
// protoc v3.14.0
|
||||
// source: role.proto
|
||||
|
||||
package api_role
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
common "server/app_comm/api/common"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type RoleBasicInfo struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
|
||||
}
|
||||
|
||||
func (x *RoleBasicInfo) Reset() {
|
||||
*x = RoleBasicInfo{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_role_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *RoleBasicInfo) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*RoleBasicInfo) ProtoMessage() {}
|
||||
|
||||
func (x *RoleBasicInfo) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_role_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use RoleBasicInfo.ProtoReflect.Descriptor instead.
|
||||
func (*RoleBasicInfo) Descriptor() ([]byte, []int) {
|
||||
return file_role_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *RoleBasicInfo) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *RoleBasicInfo) GetDescription() string {
|
||||
if x != nil {
|
||||
return x.Description
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_role_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_role_proto_rawDesc = []byte{
|
||||
0x0a, 0x0a, 0x72, 0x6f, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x70, 0x61,
|
||||
0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x72, 0x6f, 0x6c, 0x65, 0x1a, 0x0c, 0x63, 0x6f, 0x6d,
|
||||
0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x45, 0x0a, 0x0d, 0x52, 0x6f, 0x6c,
|
||||
0x65, 0x42, 0x61, 0x73, 0x69, 0x63, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61,
|
||||
0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20,
|
||||
0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x32, 0xa0, 0x02, 0x0a, 0x0b, 0x52, 0x6f, 0x6c, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
|
||||
0x12, 0x42, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x19, 0x2e, 0x70, 0x61,
|
||||
0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x74,
|
||||
0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x1a, 0x1c, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e,
|
||||
0x6f, 0x2e, 0x72, 0x6f, 0x6c, 0x65, 0x2e, 0x52, 0x6f, 0x6c, 0x65, 0x42, 0x61, 0x73, 0x69, 0x63,
|
||||
0x49, 0x6e, 0x66, 0x6f, 0x12, 0x4a, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x50, 0x65, 0x72, 0x6d, 0x69,
|
||||
0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x73, 0x12, 0x19, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72,
|
||||
0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x72, 0x49, 0x6e,
|
||||
0x64, 0x65, 0x78, 0x1a, 0x1b, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x63,
|
||||
0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73,
|
||||
0x12, 0x44, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x73, 0x12, 0x19,
|
||||
0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
|
||||
0x2e, 0x53, 0x74, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x1a, 0x1b, 0x2e, 0x70, 0x61, 0x67, 0x65,
|
||||
0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x66, 0x65,
|
||||
0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x3b, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x74,
|
||||
0x61, 0x12, 0x19, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6f, 0x6d,
|
||||
0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x1a, 0x15, 0x2e, 0x70,
|
||||
0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d,
|
||||
0x65, 0x74, 0x61, 0x42, 0x23, 0x5a, 0x21, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x61, 0x70,
|
||||
0x70, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x6f, 0x6c, 0x65, 0x3b,
|
||||
0x61, 0x70, 0x69, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_role_proto_rawDescOnce sync.Once
|
||||
file_role_proto_rawDescData = file_role_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_role_proto_rawDescGZIP() []byte {
|
||||
file_role_proto_rawDescOnce.Do(func() {
|
||||
file_role_proto_rawDescData = protoimpl.X.CompressGZIP(file_role_proto_rawDescData)
|
||||
})
|
||||
return file_role_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_role_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_role_proto_goTypes = []interface{}{
|
||||
(*RoleBasicInfo)(nil), // 0: pagerino.role.RoleBasicInfo
|
||||
(*common.StrIndex)(nil), // 1: pagerino.common.StrIndex
|
||||
(*common.References)(nil), // 2: pagerino.common.References
|
||||
(*common.Meta)(nil), // 3: pagerino.common.Meta
|
||||
}
|
||||
var file_role_proto_depIdxs = []int32{
|
||||
1, // 0: pagerino.role.RoleService.GetInfo:input_type -> pagerino.common.StrIndex
|
||||
1, // 1: pagerino.role.RoleService.GetPermissionIds:input_type -> pagerino.common.StrIndex
|
||||
1, // 2: pagerino.role.RoleService.GetUserIds:input_type -> pagerino.common.StrIndex
|
||||
1, // 3: pagerino.role.RoleService.GetMeta:input_type -> pagerino.common.StrIndex
|
||||
0, // 4: pagerino.role.RoleService.GetInfo:output_type -> pagerino.role.RoleBasicInfo
|
||||
2, // 5: pagerino.role.RoleService.GetPermissionIds:output_type -> pagerino.common.References
|
||||
2, // 6: pagerino.role.RoleService.GetUserIds:output_type -> pagerino.common.References
|
||||
3, // 7: pagerino.role.RoleService.GetMeta:output_type -> pagerino.common.Meta
|
||||
4, // [4:8] is the sub-list for method output_type
|
||||
0, // [0:4] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_role_proto_init() }
|
||||
func file_role_proto_init() {
|
||||
if File_role_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_role_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*RoleBasicInfo); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_role_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 1,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_role_proto_goTypes,
|
||||
DependencyIndexes: file_role_proto_depIdxs,
|
||||
MessageInfos: file_role_proto_msgTypes,
|
||||
}.Build()
|
||||
File_role_proto = out.File
|
||||
file_role_proto_rawDesc = nil
|
||||
file_role_proto_goTypes = nil
|
||||
file_role_proto_depIdxs = nil
|
||||
}
|
||||
216
AppServer/src/app_comm/api/role/role_grpc.pb.go
Normal file
216
AppServer/src/app_comm/api/role/role_grpc.pb.go
Normal file
@@ -0,0 +1,216 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
|
||||
package api_role
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
common "server/app_comm/api/common"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.32.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion7
|
||||
|
||||
// RoleServiceClient is the client API for RoleService service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type RoleServiceClient interface {
|
||||
// === DB information
|
||||
GetInfo(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*RoleBasicInfo, error)
|
||||
// References
|
||||
GetPermissionIds(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*common.References, error)
|
||||
GetUserIds(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*common.References, error)
|
||||
// Common
|
||||
GetMeta(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*common.Meta, error)
|
||||
}
|
||||
|
||||
type roleServiceClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewRoleServiceClient(cc grpc.ClientConnInterface) RoleServiceClient {
|
||||
return &roleServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *roleServiceClient) GetInfo(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*RoleBasicInfo, error) {
|
||||
out := new(RoleBasicInfo)
|
||||
err := c.cc.Invoke(ctx, "/pagerino.role.RoleService/GetInfo", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *roleServiceClient) GetPermissionIds(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*common.References, error) {
|
||||
out := new(common.References)
|
||||
err := c.cc.Invoke(ctx, "/pagerino.role.RoleService/GetPermissionIds", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *roleServiceClient) GetUserIds(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*common.References, error) {
|
||||
out := new(common.References)
|
||||
err := c.cc.Invoke(ctx, "/pagerino.role.RoleService/GetUserIds", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *roleServiceClient) GetMeta(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*common.Meta, error) {
|
||||
out := new(common.Meta)
|
||||
err := c.cc.Invoke(ctx, "/pagerino.role.RoleService/GetMeta", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// RoleServiceServer is the server API for RoleService service.
|
||||
// All implementations must embed UnimplementedRoleServiceServer
|
||||
// for forward compatibility
|
||||
type RoleServiceServer interface {
|
||||
// === DB information
|
||||
GetInfo(context.Context, *common.StrIndex) (*RoleBasicInfo, error)
|
||||
// References
|
||||
GetPermissionIds(context.Context, *common.StrIndex) (*common.References, error)
|
||||
GetUserIds(context.Context, *common.StrIndex) (*common.References, error)
|
||||
// Common
|
||||
GetMeta(context.Context, *common.StrIndex) (*common.Meta, error)
|
||||
mustEmbedUnimplementedRoleServiceServer()
|
||||
}
|
||||
|
||||
// UnimplementedRoleServiceServer must be embedded to have forward compatible implementations.
|
||||
type UnimplementedRoleServiceServer struct {
|
||||
}
|
||||
|
||||
func (UnimplementedRoleServiceServer) GetInfo(context.Context, *common.StrIndex) (*RoleBasicInfo, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetInfo not implemented")
|
||||
}
|
||||
func (UnimplementedRoleServiceServer) GetPermissionIds(context.Context, *common.StrIndex) (*common.References, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetPermissionIds not implemented")
|
||||
}
|
||||
func (UnimplementedRoleServiceServer) GetUserIds(context.Context, *common.StrIndex) (*common.References, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetUserIds not implemented")
|
||||
}
|
||||
func (UnimplementedRoleServiceServer) GetMeta(context.Context, *common.StrIndex) (*common.Meta, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetMeta not implemented")
|
||||
}
|
||||
func (UnimplementedRoleServiceServer) mustEmbedUnimplementedRoleServiceServer() {}
|
||||
|
||||
// UnsafeRoleServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to RoleServiceServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeRoleServiceServer interface {
|
||||
mustEmbedUnimplementedRoleServiceServer()
|
||||
}
|
||||
|
||||
func RegisterRoleServiceServer(s grpc.ServiceRegistrar, srv RoleServiceServer) {
|
||||
s.RegisterService(&RoleService_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _RoleService_GetInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(common.StrIndex)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(RoleServiceServer).GetInfo(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pagerino.role.RoleService/GetInfo",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(RoleServiceServer).GetInfo(ctx, req.(*common.StrIndex))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _RoleService_GetPermissionIds_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(common.StrIndex)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(RoleServiceServer).GetPermissionIds(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pagerino.role.RoleService/GetPermissionIds",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(RoleServiceServer).GetPermissionIds(ctx, req.(*common.StrIndex))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _RoleService_GetUserIds_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(common.StrIndex)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(RoleServiceServer).GetUserIds(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pagerino.role.RoleService/GetUserIds",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(RoleServiceServer).GetUserIds(ctx, req.(*common.StrIndex))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _RoleService_GetMeta_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(common.StrIndex)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(RoleServiceServer).GetMeta(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pagerino.role.RoleService/GetMeta",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(RoleServiceServer).GetMeta(ctx, req.(*common.StrIndex))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// RoleService_ServiceDesc is the grpc.ServiceDesc for RoleService service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var RoleService_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "pagerino.role.RoleService",
|
||||
HandlerType: (*RoleServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "GetInfo",
|
||||
Handler: _RoleService_GetInfo_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetPermissionIds",
|
||||
Handler: _RoleService_GetPermissionIds_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetUserIds",
|
||||
Handler: _RoleService_GetUserIds_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetMeta",
|
||||
Handler: _RoleService_GetMeta_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "role.proto",
|
||||
}
|
||||
180
AppServer/src/app_comm/api/status/status.pb.go
Normal file
180
AppServer/src/app_comm/api/status/status.pb.go
Normal file
@@ -0,0 +1,180 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.25.0-devel
|
||||
// protoc v3.14.0
|
||||
// source: status.proto
|
||||
|
||||
package api_status
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
common "server/app_comm/api/common"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type StatusBasicInfo struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
InternalStatus int32 `protobuf:"zigzag32,1,opt,name=internal_status,json=internalStatus,proto3" json:"internal_status,omitempty"`
|
||||
NativeStatus string `protobuf:"bytes,2,opt,name=native_status,json=nativeStatus,proto3" json:"native_status,omitempty"`
|
||||
}
|
||||
|
||||
func (x *StatusBasicInfo) Reset() {
|
||||
*x = StatusBasicInfo{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_status_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *StatusBasicInfo) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*StatusBasicInfo) ProtoMessage() {}
|
||||
|
||||
func (x *StatusBasicInfo) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_status_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use StatusBasicInfo.ProtoReflect.Descriptor instead.
|
||||
func (*StatusBasicInfo) Descriptor() ([]byte, []int) {
|
||||
return file_status_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *StatusBasicInfo) GetInternalStatus() int32 {
|
||||
if x != nil {
|
||||
return x.InternalStatus
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *StatusBasicInfo) GetNativeStatus() string {
|
||||
if x != nil {
|
||||
return x.NativeStatus
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_status_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_status_proto_rawDesc = []byte{
|
||||
0x0a, 0x0c, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f,
|
||||
0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x1a,
|
||||
0x0c, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x5f, 0x0a,
|
||||
0x0f, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x61, 0x73, 0x69, 0x63, 0x49, 0x6e, 0x66, 0x6f,
|
||||
0x12, 0x27, 0x0a, 0x0f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x61,
|
||||
0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x11, 0x52, 0x0e, 0x69, 0x6e, 0x74, 0x65, 0x72,
|
||||
0x6e, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x6e, 0x61, 0x74,
|
||||
0x69, 0x76, 0x65, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x0c, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x32, 0xda,
|
||||
0x01, 0x0a, 0x0d, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
|
||||
0x12, 0x46, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x19, 0x2e, 0x70, 0x61,
|
||||
0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x74,
|
||||
0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x1a, 0x20, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e,
|
||||
0x6f, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x42,
|
||||
0x61, 0x73, 0x69, 0x63, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x44, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x44,
|
||||
0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x19, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69,
|
||||
0x6e, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x72, 0x49, 0x6e, 0x64,
|
||||
0x65, 0x78, 0x1a, 0x1a, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6f,
|
||||
0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x3b,
|
||||
0x0a, 0x07, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x12, 0x19, 0x2e, 0x70, 0x61, 0x67, 0x65,
|
||||
0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x72, 0x49,
|
||||
0x6e, 0x64, 0x65, 0x78, 0x1a, 0x15, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e,
|
||||
0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x42, 0x27, 0x5a, 0x25, 0x73,
|
||||
0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x70, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x2f, 0x61,
|
||||
0x70, 0x69, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x3b, 0x61, 0x70, 0x69, 0x5f, 0x73, 0x74,
|
||||
0x61, 0x74, 0x75, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_status_proto_rawDescOnce sync.Once
|
||||
file_status_proto_rawDescData = file_status_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_status_proto_rawDescGZIP() []byte {
|
||||
file_status_proto_rawDescOnce.Do(func() {
|
||||
file_status_proto_rawDescData = protoimpl.X.CompressGZIP(file_status_proto_rawDescData)
|
||||
})
|
||||
return file_status_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_status_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_status_proto_goTypes = []interface{}{
|
||||
(*StatusBasicInfo)(nil), // 0: pagerino.status.StatusBasicInfo
|
||||
(*common.StrIndex)(nil), // 1: pagerino.common.StrIndex
|
||||
(*common.Reference)(nil), // 2: pagerino.common.Reference
|
||||
(*common.Meta)(nil), // 3: pagerino.common.Meta
|
||||
}
|
||||
var file_status_proto_depIdxs = []int32{
|
||||
1, // 0: pagerino.status.StatusService.GetInfo:input_type -> pagerino.common.StrIndex
|
||||
1, // 1: pagerino.status.StatusService.GetDeviceId:input_type -> pagerino.common.StrIndex
|
||||
1, // 2: pagerino.status.StatusService.GetMeta:input_type -> pagerino.common.StrIndex
|
||||
0, // 3: pagerino.status.StatusService.GetInfo:output_type -> pagerino.status.StatusBasicInfo
|
||||
2, // 4: pagerino.status.StatusService.GetDeviceId:output_type -> pagerino.common.Reference
|
||||
3, // 5: pagerino.status.StatusService.GetMeta:output_type -> pagerino.common.Meta
|
||||
3, // [3:6] is the sub-list for method output_type
|
||||
0, // [0:3] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_status_proto_init() }
|
||||
func file_status_proto_init() {
|
||||
if File_status_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_status_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*StatusBasicInfo); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_status_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 1,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_status_proto_goTypes,
|
||||
DependencyIndexes: file_status_proto_depIdxs,
|
||||
MessageInfos: file_status_proto_msgTypes,
|
||||
}.Build()
|
||||
File_status_proto = out.File
|
||||
file_status_proto_rawDesc = nil
|
||||
file_status_proto_goTypes = nil
|
||||
file_status_proto_depIdxs = nil
|
||||
}
|
||||
180
AppServer/src/app_comm/api/status/status_grpc.pb.go
Normal file
180
AppServer/src/app_comm/api/status/status_grpc.pb.go
Normal file
@@ -0,0 +1,180 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
|
||||
package api_status
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
common "server/app_comm/api/common"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.32.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion7
|
||||
|
||||
// StatusServiceClient is the client API for StatusService service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type StatusServiceClient interface {
|
||||
// === DB information
|
||||
GetInfo(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*StatusBasicInfo, error)
|
||||
// References
|
||||
GetDeviceId(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*common.Reference, error)
|
||||
// Common
|
||||
GetMeta(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*common.Meta, error)
|
||||
}
|
||||
|
||||
type statusServiceClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewStatusServiceClient(cc grpc.ClientConnInterface) StatusServiceClient {
|
||||
return &statusServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *statusServiceClient) GetInfo(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*StatusBasicInfo, error) {
|
||||
out := new(StatusBasicInfo)
|
||||
err := c.cc.Invoke(ctx, "/pagerino.status.StatusService/GetInfo", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *statusServiceClient) GetDeviceId(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*common.Reference, error) {
|
||||
out := new(common.Reference)
|
||||
err := c.cc.Invoke(ctx, "/pagerino.status.StatusService/GetDeviceId", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *statusServiceClient) GetMeta(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*common.Meta, error) {
|
||||
out := new(common.Meta)
|
||||
err := c.cc.Invoke(ctx, "/pagerino.status.StatusService/GetMeta", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// StatusServiceServer is the server API for StatusService service.
|
||||
// All implementations must embed UnimplementedStatusServiceServer
|
||||
// for forward compatibility
|
||||
type StatusServiceServer interface {
|
||||
// === DB information
|
||||
GetInfo(context.Context, *common.StrIndex) (*StatusBasicInfo, error)
|
||||
// References
|
||||
GetDeviceId(context.Context, *common.StrIndex) (*common.Reference, error)
|
||||
// Common
|
||||
GetMeta(context.Context, *common.StrIndex) (*common.Meta, error)
|
||||
mustEmbedUnimplementedStatusServiceServer()
|
||||
}
|
||||
|
||||
// UnimplementedStatusServiceServer must be embedded to have forward compatible implementations.
|
||||
type UnimplementedStatusServiceServer struct {
|
||||
}
|
||||
|
||||
func (UnimplementedStatusServiceServer) GetInfo(context.Context, *common.StrIndex) (*StatusBasicInfo, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetInfo not implemented")
|
||||
}
|
||||
func (UnimplementedStatusServiceServer) GetDeviceId(context.Context, *common.StrIndex) (*common.Reference, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetDeviceId not implemented")
|
||||
}
|
||||
func (UnimplementedStatusServiceServer) GetMeta(context.Context, *common.StrIndex) (*common.Meta, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetMeta not implemented")
|
||||
}
|
||||
func (UnimplementedStatusServiceServer) mustEmbedUnimplementedStatusServiceServer() {}
|
||||
|
||||
// UnsafeStatusServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to StatusServiceServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeStatusServiceServer interface {
|
||||
mustEmbedUnimplementedStatusServiceServer()
|
||||
}
|
||||
|
||||
func RegisterStatusServiceServer(s grpc.ServiceRegistrar, srv StatusServiceServer) {
|
||||
s.RegisterService(&StatusService_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _StatusService_GetInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(common.StrIndex)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(StatusServiceServer).GetInfo(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pagerino.status.StatusService/GetInfo",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(StatusServiceServer).GetInfo(ctx, req.(*common.StrIndex))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _StatusService_GetDeviceId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(common.StrIndex)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(StatusServiceServer).GetDeviceId(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pagerino.status.StatusService/GetDeviceId",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(StatusServiceServer).GetDeviceId(ctx, req.(*common.StrIndex))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _StatusService_GetMeta_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(common.StrIndex)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(StatusServiceServer).GetMeta(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pagerino.status.StatusService/GetMeta",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(StatusServiceServer).GetMeta(ctx, req.(*common.StrIndex))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// StatusService_ServiceDesc is the grpc.ServiceDesc for StatusService service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var StatusService_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "pagerino.status.StatusService",
|
||||
HandlerType: (*StatusServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "GetInfo",
|
||||
Handler: _StatusService_GetInfo_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetDeviceId",
|
||||
Handler: _StatusService_GetDeviceId_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetMeta",
|
||||
Handler: _StatusService_GetMeta_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "status.proto",
|
||||
}
|
||||
384
AppServer/src/app_comm/api/user/user.pb.go
Normal file
384
AppServer/src/app_comm/api/user/user.pb.go
Normal file
@@ -0,0 +1,384 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.25.0-devel
|
||||
// protoc v3.14.0
|
||||
// source: user.proto
|
||||
|
||||
package api_user
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
|
||||
reflect "reflect"
|
||||
common "server/app_comm/api/common"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type Password struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Password string `protobuf:"bytes,1,opt,name=password,proto3" json:"password,omitempty"`
|
||||
}
|
||||
|
||||
func (x *Password) Reset() {
|
||||
*x = Password{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_user_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Password) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Password) ProtoMessage() {}
|
||||
|
||||
func (x *Password) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_user_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Password.ProtoReflect.Descriptor instead.
|
||||
func (*Password) Descriptor() ([]byte, []int) {
|
||||
return file_user_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *Password) GetPassword() string {
|
||||
if x != nil {
|
||||
return x.Password
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type UserAllInfo struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
|
||||
RoleId int32 `protobuf:"varint,3,opt,name=role_id,json=roleId,proto3" json:"role_id,omitempty"`
|
||||
LastOnline *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=last_online,json=lastOnline,proto3" json:"last_online,omitempty"`
|
||||
}
|
||||
|
||||
func (x *UserAllInfo) Reset() {
|
||||
*x = UserAllInfo{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_user_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *UserAllInfo) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*UserAllInfo) ProtoMessage() {}
|
||||
|
||||
func (x *UserAllInfo) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_user_proto_msgTypes[1]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use UserAllInfo.ProtoReflect.Descriptor instead.
|
||||
func (*UserAllInfo) Descriptor() ([]byte, []int) {
|
||||
return file_user_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *UserAllInfo) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *UserAllInfo) GetPassword() string {
|
||||
if x != nil {
|
||||
return x.Password
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *UserAllInfo) GetRoleId() int32 {
|
||||
if x != nil {
|
||||
return x.RoleId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *UserAllInfo) GetLastOnline() *timestamppb.Timestamp {
|
||||
if x != nil {
|
||||
return x.LastOnline
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type UserBaseInfo struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
RoleId int32 `protobuf:"varint,2,opt,name=role_id,json=roleId,proto3" json:"role_id,omitempty"`
|
||||
LastOnline *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=last_online,json=lastOnline,proto3" json:"last_online,omitempty"`
|
||||
}
|
||||
|
||||
func (x *UserBaseInfo) Reset() {
|
||||
*x = UserBaseInfo{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_user_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *UserBaseInfo) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*UserBaseInfo) ProtoMessage() {}
|
||||
|
||||
func (x *UserBaseInfo) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_user_proto_msgTypes[2]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use UserBaseInfo.ProtoReflect.Descriptor instead.
|
||||
func (*UserBaseInfo) Descriptor() ([]byte, []int) {
|
||||
return file_user_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *UserBaseInfo) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *UserBaseInfo) GetRoleId() int32 {
|
||||
if x != nil {
|
||||
return x.RoleId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *UserBaseInfo) GetLastOnline() *timestamppb.Timestamp {
|
||||
if x != nil {
|
||||
return x.LastOnline
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_user_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_user_proto_rawDesc = []byte{
|
||||
0x0a, 0x0a, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x70, 0x61,
|
||||
0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x1a, 0x1f, 0x67, 0x6f, 0x6f,
|
||||
0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d,
|
||||
0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0c, 0x63, 0x6f,
|
||||
0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x26, 0x0a, 0x08, 0x50, 0x61,
|
||||
0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f,
|
||||
0x72, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f,
|
||||
0x72, 0x64, 0x22, 0x93, 0x01, 0x0a, 0x0b, 0x55, 0x73, 0x65, 0x72, 0x41, 0x6c, 0x6c, 0x49, 0x6e,
|
||||
0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f,
|
||||
0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f,
|
||||
0x72, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20,
|
||||
0x01, 0x28, 0x05, 0x52, 0x06, 0x72, 0x6f, 0x6c, 0x65, 0x49, 0x64, 0x12, 0x3b, 0x0a, 0x0b, 0x6c,
|
||||
0x61, 0x73, 0x74, 0x5f, 0x6f, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b,
|
||||
0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
|
||||
0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x6c, 0x61,
|
||||
0x73, 0x74, 0x4f, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x22, 0x78, 0x0a, 0x0c, 0x55, 0x73, 0x65, 0x72,
|
||||
0x42, 0x61, 0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x17, 0x0a, 0x07,
|
||||
0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x72,
|
||||
0x6f, 0x6c, 0x65, 0x49, 0x64, 0x12, 0x3b, 0x0a, 0x0b, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x6f, 0x6e,
|
||||
0x6c, 0x69, 0x6e, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f,
|
||||
0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d,
|
||||
0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x6c, 0x61, 0x73, 0x74, 0x4f, 0x6e, 0x6c, 0x69,
|
||||
0x6e, 0x65, 0x32, 0xa5, 0x04, 0x0a, 0x0b, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69,
|
||||
0x63, 0x65, 0x12, 0x3f, 0x0a, 0x06, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x12, 0x19, 0x2e, 0x70,
|
||||
0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x53,
|
||||
0x74, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x1a, 0x1a, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69,
|
||||
0x6e, 0x6f, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x41, 0x6c, 0x6c, 0x49,
|
||||
0x6e, 0x66, 0x6f, 0x12, 0x41, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x19,
|
||||
0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
|
||||
0x2e, 0x53, 0x74, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x1a, 0x1b, 0x2e, 0x70, 0x61, 0x67, 0x65,
|
||||
0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x42, 0x61,
|
||||
0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x41, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x50, 0x61, 0x73,
|
||||
0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x19, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f,
|
||||
0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78,
|
||||
0x1a, 0x17, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x75, 0x73, 0x65, 0x72,
|
||||
0x2e, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x42, 0x0a, 0x09, 0x47, 0x65, 0x74,
|
||||
0x52, 0x6f, 0x6c, 0x65, 0x49, 0x64, 0x12, 0x19, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e,
|
||||
0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x72, 0x49, 0x6e, 0x64, 0x65,
|
||||
0x78, 0x1a, 0x1a, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6f, 0x6d,
|
||||
0x6d, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x46, 0x0a,
|
||||
0x0c, 0x47, 0x65, 0x74, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x73, 0x12, 0x19, 0x2e,
|
||||
0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e,
|
||||
0x53, 0x74, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x1a, 0x1b, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72,
|
||||
0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x66, 0x65, 0x72,
|
||||
0x65, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x41, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x4c, 0x6f, 0x67, 0x73,
|
||||
0x12, 0x19, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d,
|
||||
0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x1a, 0x1b, 0x2e, 0x70, 0x61,
|
||||
0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x52, 0x65,
|
||||
0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x43, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x41,
|
||||
0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x12, 0x19, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69,
|
||||
0x6e, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x72, 0x49, 0x6e, 0x64,
|
||||
0x65, 0x78, 0x1a, 0x19, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6f,
|
||||
0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x12, 0x3b, 0x0a,
|
||||
0x07, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x12, 0x19, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72,
|
||||
0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x72, 0x49, 0x6e,
|
||||
0x64, 0x65, 0x78, 0x1a, 0x15, 0x2e, 0x70, 0x61, 0x67, 0x65, 0x72, 0x69, 0x6e, 0x6f, 0x2e, 0x63,
|
||||
0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x42, 0x23, 0x5a, 0x21, 0x73, 0x65,
|
||||
0x72, 0x76, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x70, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x2f, 0x61, 0x70,
|
||||
0x69, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x3b, 0x61, 0x70, 0x69, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x62,
|
||||
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_user_proto_rawDescOnce sync.Once
|
||||
file_user_proto_rawDescData = file_user_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_user_proto_rawDescGZIP() []byte {
|
||||
file_user_proto_rawDescOnce.Do(func() {
|
||||
file_user_proto_rawDescData = protoimpl.X.CompressGZIP(file_user_proto_rawDescData)
|
||||
})
|
||||
return file_user_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_user_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
|
||||
var file_user_proto_goTypes = []interface{}{
|
||||
(*Password)(nil), // 0: pagerino.user.Password
|
||||
(*UserAllInfo)(nil), // 1: pagerino.user.UserAllInfo
|
||||
(*UserBaseInfo)(nil), // 2: pagerino.user.UserBaseInfo
|
||||
(*timestamppb.Timestamp)(nil), // 3: google.protobuf.Timestamp
|
||||
(*common.StrIndex)(nil), // 4: pagerino.common.StrIndex
|
||||
(*common.Reference)(nil), // 5: pagerino.common.Reference
|
||||
(*common.References)(nil), // 6: pagerino.common.References
|
||||
(*common.Activity)(nil), // 7: pagerino.common.Activity
|
||||
(*common.Meta)(nil), // 8: pagerino.common.Meta
|
||||
}
|
||||
var file_user_proto_depIdxs = []int32{
|
||||
3, // 0: pagerino.user.UserAllInfo.last_online:type_name -> google.protobuf.Timestamp
|
||||
3, // 1: pagerino.user.UserBaseInfo.last_online:type_name -> google.protobuf.Timestamp
|
||||
4, // 2: pagerino.user.UserService.GetAll:input_type -> pagerino.common.StrIndex
|
||||
4, // 3: pagerino.user.UserService.GetInfo:input_type -> pagerino.common.StrIndex
|
||||
4, // 4: pagerino.user.UserService.GetPassword:input_type -> pagerino.common.StrIndex
|
||||
4, // 5: pagerino.user.UserService.GetRoleId:input_type -> pagerino.common.StrIndex
|
||||
4, // 6: pagerino.user.UserService.GetDeviceIds:input_type -> pagerino.common.StrIndex
|
||||
4, // 7: pagerino.user.UserService.GetLogs:input_type -> pagerino.common.StrIndex
|
||||
4, // 8: pagerino.user.UserService.GetActivity:input_type -> pagerino.common.StrIndex
|
||||
4, // 9: pagerino.user.UserService.GetMeta:input_type -> pagerino.common.StrIndex
|
||||
1, // 10: pagerino.user.UserService.GetAll:output_type -> pagerino.user.UserAllInfo
|
||||
2, // 11: pagerino.user.UserService.GetInfo:output_type -> pagerino.user.UserBaseInfo
|
||||
0, // 12: pagerino.user.UserService.GetPassword:output_type -> pagerino.user.Password
|
||||
5, // 13: pagerino.user.UserService.GetRoleId:output_type -> pagerino.common.Reference
|
||||
6, // 14: pagerino.user.UserService.GetDeviceIds:output_type -> pagerino.common.References
|
||||
6, // 15: pagerino.user.UserService.GetLogs:output_type -> pagerino.common.References
|
||||
7, // 16: pagerino.user.UserService.GetActivity:output_type -> pagerino.common.Activity
|
||||
8, // 17: pagerino.user.UserService.GetMeta:output_type -> pagerino.common.Meta
|
||||
10, // [10:18] is the sub-list for method output_type
|
||||
2, // [2:10] is the sub-list for method input_type
|
||||
2, // [2:2] is the sub-list for extension type_name
|
||||
2, // [2:2] is the sub-list for extension extendee
|
||||
0, // [0:2] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_user_proto_init() }
|
||||
func file_user_proto_init() {
|
||||
if File_user_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_user_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Password); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_user_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*UserAllInfo); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_user_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*UserBaseInfo); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_user_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 3,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_user_proto_goTypes,
|
||||
DependencyIndexes: file_user_proto_depIdxs,
|
||||
MessageInfos: file_user_proto_msgTypes,
|
||||
}.Build()
|
||||
File_user_proto = out.File
|
||||
file_user_proto_rawDesc = nil
|
||||
file_user_proto_goTypes = nil
|
||||
file_user_proto_depIdxs = nil
|
||||
}
|
||||
360
AppServer/src/app_comm/api/user/user_grpc.pb.go
Normal file
360
AppServer/src/app_comm/api/user/user_grpc.pb.go
Normal file
@@ -0,0 +1,360 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
|
||||
package api_user
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
common "server/app_comm/api/common"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.32.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion7
|
||||
|
||||
// UserServiceClient is the client API for UserService service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type UserServiceClient interface {
|
||||
// === DB information
|
||||
GetAll(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*UserAllInfo, error)
|
||||
GetInfo(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*UserBaseInfo, error)
|
||||
GetPassword(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*Password, error)
|
||||
// References
|
||||
GetRoleId(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*common.Reference, error)
|
||||
GetDeviceIds(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*common.References, error)
|
||||
GetLogs(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*common.References, error)
|
||||
// Common
|
||||
GetActivity(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*common.Activity, error)
|
||||
GetMeta(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*common.Meta, error)
|
||||
}
|
||||
|
||||
type userServiceClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewUserServiceClient(cc grpc.ClientConnInterface) UserServiceClient {
|
||||
return &userServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *userServiceClient) GetAll(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*UserAllInfo, error) {
|
||||
out := new(UserAllInfo)
|
||||
err := c.cc.Invoke(ctx, "/pagerino.user.UserService/GetAll", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *userServiceClient) GetInfo(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*UserBaseInfo, error) {
|
||||
out := new(UserBaseInfo)
|
||||
err := c.cc.Invoke(ctx, "/pagerino.user.UserService/GetInfo", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *userServiceClient) GetPassword(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*Password, error) {
|
||||
out := new(Password)
|
||||
err := c.cc.Invoke(ctx, "/pagerino.user.UserService/GetPassword", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *userServiceClient) GetRoleId(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*common.Reference, error) {
|
||||
out := new(common.Reference)
|
||||
err := c.cc.Invoke(ctx, "/pagerino.user.UserService/GetRoleId", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *userServiceClient) GetDeviceIds(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*common.References, error) {
|
||||
out := new(common.References)
|
||||
err := c.cc.Invoke(ctx, "/pagerino.user.UserService/GetDeviceIds", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *userServiceClient) GetLogs(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*common.References, error) {
|
||||
out := new(common.References)
|
||||
err := c.cc.Invoke(ctx, "/pagerino.user.UserService/GetLogs", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *userServiceClient) GetActivity(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*common.Activity, error) {
|
||||
out := new(common.Activity)
|
||||
err := c.cc.Invoke(ctx, "/pagerino.user.UserService/GetActivity", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *userServiceClient) GetMeta(ctx context.Context, in *common.StrIndex, opts ...grpc.CallOption) (*common.Meta, error) {
|
||||
out := new(common.Meta)
|
||||
err := c.cc.Invoke(ctx, "/pagerino.user.UserService/GetMeta", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// UserServiceServer is the server API for UserService service.
|
||||
// All implementations must embed UnimplementedUserServiceServer
|
||||
// for forward compatibility
|
||||
type UserServiceServer interface {
|
||||
// === DB information
|
||||
GetAll(context.Context, *common.StrIndex) (*UserAllInfo, error)
|
||||
GetInfo(context.Context, *common.StrIndex) (*UserBaseInfo, error)
|
||||
GetPassword(context.Context, *common.StrIndex) (*Password, error)
|
||||
// References
|
||||
GetRoleId(context.Context, *common.StrIndex) (*common.Reference, error)
|
||||
GetDeviceIds(context.Context, *common.StrIndex) (*common.References, error)
|
||||
GetLogs(context.Context, *common.StrIndex) (*common.References, error)
|
||||
// Common
|
||||
GetActivity(context.Context, *common.StrIndex) (*common.Activity, error)
|
||||
GetMeta(context.Context, *common.StrIndex) (*common.Meta, error)
|
||||
mustEmbedUnimplementedUserServiceServer()
|
||||
}
|
||||
|
||||
// UnimplementedUserServiceServer must be embedded to have forward compatible implementations.
|
||||
type UnimplementedUserServiceServer struct {
|
||||
}
|
||||
|
||||
func (UnimplementedUserServiceServer) GetAll(context.Context, *common.StrIndex) (*UserAllInfo, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetAll not implemented")
|
||||
}
|
||||
func (UnimplementedUserServiceServer) GetInfo(context.Context, *common.StrIndex) (*UserBaseInfo, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetInfo not implemented")
|
||||
}
|
||||
func (UnimplementedUserServiceServer) GetPassword(context.Context, *common.StrIndex) (*Password, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetPassword not implemented")
|
||||
}
|
||||
func (UnimplementedUserServiceServer) GetRoleId(context.Context, *common.StrIndex) (*common.Reference, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetRoleId not implemented")
|
||||
}
|
||||
func (UnimplementedUserServiceServer) GetDeviceIds(context.Context, *common.StrIndex) (*common.References, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetDeviceIds not implemented")
|
||||
}
|
||||
func (UnimplementedUserServiceServer) GetLogs(context.Context, *common.StrIndex) (*common.References, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetLogs not implemented")
|
||||
}
|
||||
func (UnimplementedUserServiceServer) GetActivity(context.Context, *common.StrIndex) (*common.Activity, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetActivity not implemented")
|
||||
}
|
||||
func (UnimplementedUserServiceServer) GetMeta(context.Context, *common.StrIndex) (*common.Meta, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetMeta not implemented")
|
||||
}
|
||||
func (UnimplementedUserServiceServer) mustEmbedUnimplementedUserServiceServer() {}
|
||||
|
||||
// UnsafeUserServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to UserServiceServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeUserServiceServer interface {
|
||||
mustEmbedUnimplementedUserServiceServer()
|
||||
}
|
||||
|
||||
func RegisterUserServiceServer(s grpc.ServiceRegistrar, srv UserServiceServer) {
|
||||
s.RegisterService(&UserService_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _UserService_GetAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(common.StrIndex)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(UserServiceServer).GetAll(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pagerino.user.UserService/GetAll",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(UserServiceServer).GetAll(ctx, req.(*common.StrIndex))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _UserService_GetInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(common.StrIndex)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(UserServiceServer).GetInfo(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pagerino.user.UserService/GetInfo",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(UserServiceServer).GetInfo(ctx, req.(*common.StrIndex))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _UserService_GetPassword_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(common.StrIndex)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(UserServiceServer).GetPassword(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pagerino.user.UserService/GetPassword",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(UserServiceServer).GetPassword(ctx, req.(*common.StrIndex))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _UserService_GetRoleId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(common.StrIndex)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(UserServiceServer).GetRoleId(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pagerino.user.UserService/GetRoleId",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(UserServiceServer).GetRoleId(ctx, req.(*common.StrIndex))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _UserService_GetDeviceIds_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(common.StrIndex)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(UserServiceServer).GetDeviceIds(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pagerino.user.UserService/GetDeviceIds",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(UserServiceServer).GetDeviceIds(ctx, req.(*common.StrIndex))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _UserService_GetLogs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(common.StrIndex)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(UserServiceServer).GetLogs(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pagerino.user.UserService/GetLogs",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(UserServiceServer).GetLogs(ctx, req.(*common.StrIndex))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _UserService_GetActivity_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(common.StrIndex)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(UserServiceServer).GetActivity(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pagerino.user.UserService/GetActivity",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(UserServiceServer).GetActivity(ctx, req.(*common.StrIndex))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _UserService_GetMeta_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(common.StrIndex)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(UserServiceServer).GetMeta(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pagerino.user.UserService/GetMeta",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(UserServiceServer).GetMeta(ctx, req.(*common.StrIndex))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// UserService_ServiceDesc is the grpc.ServiceDesc for UserService service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var UserService_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "pagerino.user.UserService",
|
||||
HandlerType: (*UserServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "GetAll",
|
||||
Handler: _UserService_GetAll_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetInfo",
|
||||
Handler: _UserService_GetInfo_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetPassword",
|
||||
Handler: _UserService_GetPassword_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetRoleId",
|
||||
Handler: _UserService_GetRoleId_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetDeviceIds",
|
||||
Handler: _UserService_GetDeviceIds_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetLogs",
|
||||
Handler: _UserService_GetLogs_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetActivity",
|
||||
Handler: _UserService_GetActivity_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetMeta",
|
||||
Handler: _UserService_GetMeta_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "user.proto",
|
||||
}
|
||||
30
AppServer/src/app_comm/proto/change.proto
Normal file
30
AppServer/src/app_comm/proto/change.proto
Normal file
@@ -0,0 +1,30 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package pagerino.change;
|
||||
option go_package = "server/app_comm/api/change;api_change";
|
||||
|
||||
import "common.proto";
|
||||
|
||||
|
||||
message ChageAllInfo {
|
||||
string old_value = 1;
|
||||
string new_value = 2;
|
||||
string table_name = 3;
|
||||
string operation = 4;
|
||||
int32 log_id = 5;
|
||||
}
|
||||
|
||||
message Values {
|
||||
string old_value = 1;
|
||||
string new_value = 2;
|
||||
}
|
||||
|
||||
|
||||
service ChangeService {
|
||||
// === DB information
|
||||
rpc GetDiff(common.Index) returns (Values);
|
||||
rpc GetAll(common.Index) returns (ChageAllInfo);
|
||||
|
||||
// Common
|
||||
rpc GetMeta(common.Index) returns (common.Meta);
|
||||
}
|
||||
47
AppServer/src/app_comm/proto/common.proto
Normal file
47
AppServer/src/app_comm/proto/common.proto
Normal file
@@ -0,0 +1,47 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package pagerino.common;
|
||||
option go_package = "server/app_comm/api/common;api_common";
|
||||
|
||||
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
// For custom logic responses
|
||||
enum RequestCode {
|
||||
UNKNOWN = 0;
|
||||
OK = 1;
|
||||
UNAUTHORIZED = 2;
|
||||
NO_DATA = 3;
|
||||
INTERNAL_ERROR = 4;
|
||||
}
|
||||
|
||||
// === DB indexing
|
||||
message StrIndex {
|
||||
oneof id {
|
||||
int32 num = 1; // Database ID
|
||||
string name = 2; // for external fields: username, euid, name...
|
||||
}
|
||||
}
|
||||
|
||||
message Index {
|
||||
int32 num = 1; // Database ID
|
||||
}
|
||||
|
||||
// === DB information
|
||||
message Meta {
|
||||
int32 id = 1;
|
||||
google.protobuf.Timestamp created_at = 2;
|
||||
}
|
||||
|
||||
message References {
|
||||
int32 page = 1; // 32 IDs per page from most recent
|
||||
repeated int32 ref_id = 2;
|
||||
}
|
||||
|
||||
message Reference {
|
||||
int32 ref_id = 1;
|
||||
}
|
||||
|
||||
message Activity {
|
||||
google.protobuf.Timestamp last_online = 1;
|
||||
}
|
||||
65
AppServer/src/app_comm/proto/device.proto
Normal file
65
AppServer/src/app_comm/proto/device.proto
Normal file
@@ -0,0 +1,65 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package pagerino.device;
|
||||
option go_package = "server/app_comm/api/device;api_device";
|
||||
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "common.proto";
|
||||
|
||||
|
||||
message Charge {
|
||||
float charge = 1;
|
||||
}
|
||||
|
||||
message Location {
|
||||
double latitude = 1;
|
||||
double longitude = 2;
|
||||
float altitude = 3;
|
||||
}
|
||||
|
||||
message DeviceBaseInfo {
|
||||
string name = 1;
|
||||
string euid = 2;
|
||||
sint32 internal_status = 3;
|
||||
google.protobuf.Timestamp last_online = 4;
|
||||
}
|
||||
|
||||
message DeviceAllInfo { // Meta not included!
|
||||
string name = 1;
|
||||
string euid = 2;
|
||||
|
||||
sint32 internal_status = 3;
|
||||
string native_status = 4;
|
||||
|
||||
google.protobuf.Timestamp last_online = 5;
|
||||
string fw_version = 6;
|
||||
|
||||
repeated int32 card_ids = 7;
|
||||
|
||||
float charge = 8;
|
||||
|
||||
double latitude = 9;
|
||||
double longitude = 10;
|
||||
float altitude = 11;
|
||||
}
|
||||
|
||||
|
||||
service DeviceService {
|
||||
// === DB information
|
||||
rpc GetAll(common.StrIndex) returns (DeviceAllInfo);
|
||||
rpc GetInfo(common.StrIndex) returns (DeviceBaseInfo);
|
||||
rpc GetCharge(common.StrIndex) returns (Charge);
|
||||
rpc GetLocation(common.StrIndex) returns (Location);
|
||||
|
||||
// References
|
||||
rpc GetNfcCardIds(common.StrIndex) returns (common.References);
|
||||
rpc GetStatusIds(common.StrIndex) returns (common.References);
|
||||
rpc GetSentMessageIds(common.StrIndex) returns (common.References);
|
||||
rpc GetReceivedMessageIds(common.StrIndex) returns (common.References);
|
||||
rpc GetLogs(common.StrIndex) returns (common.References);
|
||||
|
||||
// Common
|
||||
rpc GetActivity(common.StrIndex) returns (common.Activity);
|
||||
rpc GetMeta(common.StrIndex) returns (common.Meta);
|
||||
}
|
||||
|
||||
16
AppServer/src/app_comm/proto/log.proto
Normal file
16
AppServer/src/app_comm/proto/log.proto
Normal file
@@ -0,0 +1,16 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package pagerino.log;
|
||||
option go_package = "server/app_comm/api/log;api_log";
|
||||
|
||||
import "common.proto";
|
||||
|
||||
|
||||
service LogService {
|
||||
// === DB information
|
||||
// References
|
||||
rpc GetChangeIds(common.Index) returns (common.References);
|
||||
|
||||
// Common
|
||||
rpc GetMeta(common.Index) returns (common.Meta);
|
||||
}
|
||||
29
AppServer/src/app_comm/proto/message.proto
Normal file
29
AppServer/src/app_comm/proto/message.proto
Normal file
@@ -0,0 +1,29 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package pagerino.message;
|
||||
option go_package = "server/app_comm/api/message;api_message";
|
||||
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "common.proto";
|
||||
|
||||
|
||||
message MessageBasicInfo {
|
||||
int32 sender_id = 1;
|
||||
int32 receiver_id = 2;
|
||||
string payload = 3;
|
||||
google.protobuf.Timestamp created_at = 4;
|
||||
}
|
||||
|
||||
message Payload {
|
||||
string payload = 1;
|
||||
}
|
||||
|
||||
|
||||
service MessageService {
|
||||
// === DB information
|
||||
rpc GetInfo(common.Index) returns (MessageBasicInfo);
|
||||
rpc GetPayload(common.Index) returns (Payload);
|
||||
|
||||
// Common
|
||||
rpc GetMeta(common.Index) returns (common.Meta);
|
||||
}
|
||||
24
AppServer/src/app_comm/proto/nfccard.proto
Normal file
24
AppServer/src/app_comm/proto/nfccard.proto
Normal file
@@ -0,0 +1,24 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package pagerino.nfc_card;
|
||||
option go_package = "server/app_comm/api/nfccard;api_nfccard";
|
||||
|
||||
|
||||
import "common.proto";
|
||||
|
||||
|
||||
message NfcCardBaseInfo {
|
||||
string uid = 1;
|
||||
}
|
||||
|
||||
|
||||
service NfcCardService {
|
||||
// === DB information
|
||||
rpc GetInfo(common.Index) returns (NfcCardBaseInfo);
|
||||
|
||||
// References
|
||||
rpc GetDeviceId(common.Index) returns (common.Reference);
|
||||
|
||||
// Common
|
||||
rpc GetMeta(common.Index) returns (common.Meta);
|
||||
}
|
||||
24
AppServer/src/app_comm/proto/permission.proto
Normal file
24
AppServer/src/app_comm/proto/permission.proto
Normal file
@@ -0,0 +1,24 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package pagerino.permission;
|
||||
option go_package = "server/app_comm/api/permission;api_permission";
|
||||
|
||||
import "common.proto";
|
||||
|
||||
|
||||
message PermissionBasicInfo {
|
||||
string name = 1;
|
||||
string description = 2;
|
||||
}
|
||||
|
||||
|
||||
service PermissionService {
|
||||
// === DB information
|
||||
rpc GetInfo(common.StrIndex) returns (PermissionBasicInfo);
|
||||
|
||||
// References
|
||||
rpc GetRoleIds(common.StrIndex) returns (common.References);
|
||||
|
||||
// Common
|
||||
rpc GetMeta(common.StrIndex) returns (common.Meta);
|
||||
}
|
||||
25
AppServer/src/app_comm/proto/role.proto
Normal file
25
AppServer/src/app_comm/proto/role.proto
Normal file
@@ -0,0 +1,25 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package pagerino.role;
|
||||
option go_package = "server/app_comm/api/role;api_role";
|
||||
|
||||
import "common.proto";
|
||||
|
||||
|
||||
message RoleBasicInfo {
|
||||
string name = 1;
|
||||
string description = 2;
|
||||
}
|
||||
|
||||
|
||||
service RoleService {
|
||||
// === DB information
|
||||
rpc GetInfo(common.StrIndex) returns (RoleBasicInfo);
|
||||
|
||||
// References
|
||||
rpc GetPermissionIds(common.StrIndex) returns (common.References);
|
||||
rpc GetUserIds(common.StrIndex) returns (common.References);
|
||||
|
||||
// Common
|
||||
rpc GetMeta(common.StrIndex) returns (common.Meta);
|
||||
}
|
||||
26
AppServer/src/app_comm/proto/status.proto
Normal file
26
AppServer/src/app_comm/proto/status.proto
Normal file
@@ -0,0 +1,26 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package pagerino.status;
|
||||
option go_package = "server/app_comm/api/status;api_status";
|
||||
|
||||
|
||||
import "common.proto";
|
||||
|
||||
|
||||
message StatusBasicInfo {
|
||||
sint32 internal_status = 1;
|
||||
string native_status = 2;
|
||||
}
|
||||
|
||||
|
||||
// When getting Status, string index is for Device!
|
||||
service StatusService {
|
||||
// === DB information
|
||||
rpc GetInfo(common.StrIndex) returns (StatusBasicInfo);
|
||||
|
||||
// References
|
||||
rpc GetDeviceId(common.StrIndex) returns (common.Reference);
|
||||
|
||||
// Common
|
||||
rpc GetMeta(common.StrIndex) returns (common.Meta);
|
||||
}
|
||||
43
AppServer/src/app_comm/proto/user.proto
Normal file
43
AppServer/src/app_comm/proto/user.proto
Normal file
@@ -0,0 +1,43 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package pagerino.user;
|
||||
option go_package = "server/app_comm/api/user;api_user";
|
||||
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "common.proto";
|
||||
|
||||
|
||||
message Password {
|
||||
string password = 1;
|
||||
}
|
||||
|
||||
message UserAllInfo { // Meta not included!
|
||||
string name = 1;
|
||||
string password = 2;
|
||||
|
||||
int32 role_id = 3;
|
||||
google.protobuf.Timestamp last_online = 4;
|
||||
}
|
||||
|
||||
message UserBaseInfo {
|
||||
string name = 1;
|
||||
int32 role_id = 2;
|
||||
google.protobuf.Timestamp last_online = 3;
|
||||
}
|
||||
|
||||
|
||||
service UserService {
|
||||
// === DB information
|
||||
rpc GetAll(common.StrIndex) returns (UserAllInfo);
|
||||
rpc GetInfo(common.StrIndex) returns (UserBaseInfo);
|
||||
rpc GetPassword(common.StrIndex) returns (Password);
|
||||
|
||||
// References
|
||||
rpc GetRoleId(common.StrIndex) returns (common.Reference);
|
||||
rpc GetDeviceIds(common.StrIndex) returns (common.References);
|
||||
rpc GetLogs(common.StrIndex) returns (common.References);
|
||||
|
||||
// Common
|
||||
rpc GetActivity(common.StrIndex) returns (common.Activity);
|
||||
rpc GetMeta(common.StrIndex) returns (common.Meta);
|
||||
}
|
||||
28
AppServer/src/go.mod
Executable file
28
AppServer/src/go.mod
Executable file
@@ -0,0 +1,28 @@
|
||||
module server
|
||||
|
||||
go 1.24.5
|
||||
|
||||
require (
|
||||
github.com/eclipse/paho.mqtt.golang v1.5.0 // direct
|
||||
github.com/jackc/pgx/v5 v5.7.5 // direct
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/chirpstack/chirpstack/api/go/v4 v4.14.1
|
||||
golang.org/x/crypto v0.39.0
|
||||
google.golang.org/grpc v1.75.0
|
||||
google.golang.org/protobuf v1.36.8
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/gorilla/websocket v1.5.3 // indirect
|
||||
github.com/jackc/pgpassfile v1.0.0 // indirect
|
||||
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
|
||||
github.com/jackc/puddle/v2 v2.2.2 // indirect
|
||||
golang.org/x/net v0.41.0 // indirect
|
||||
golang.org/x/sync v0.16.0 // indirect
|
||||
golang.org/x/sys v0.33.0 // indirect
|
||||
golang.org/x/text v0.26.0 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20250826171959-ef028d996bc1 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250818200422-3122310a409c // indirect
|
||||
)
|
||||
70
AppServer/src/go.sum
Executable file
70
AppServer/src/go.sum
Executable file
@@ -0,0 +1,70 @@
|
||||
github.com/chirpstack/chirpstack/api/go/v4 v4.14.1 h1:w961GhhQArXqWxLcudZ4wI6AzcCkpHgPfuf03f3DtiM=
|
||||
github.com/chirpstack/chirpstack/api/go/v4 v4.14.1/go.mod h1:EqvcS3qE73PunKGKkwxQ69pBx+xPcGAwVE6FFYSIzhk=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/eclipse/paho.mqtt.golang v1.5.0 h1:EH+bUVJNgttidWFkLLVKaQPGmkTUfQQqjOsyvMGvD6o=
|
||||
github.com/eclipse/paho.mqtt.golang v1.5.0/go.mod h1:du/2qNQVqJf/Sqs4MEL77kR8QTqANF7XU7Fk0aOTAgk=
|
||||
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
|
||||
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
|
||||
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
|
||||
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
||||
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
||||
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
||||
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
|
||||
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
|
||||
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
|
||||
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo=
|
||||
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
|
||||
github.com/jackc/pgx/v5 v5.7.5 h1:JHGfMnQY+IEtGM63d+NGMjoRpysB2JBwDr5fsngwmJs=
|
||||
github.com/jackc/pgx/v5 v5.7.5/go.mod h1:aruU7o91Tc2q2cFp5h4uP3f6ztExVpyVv88Xl/8Vl8M=
|
||||
github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo=
|
||||
github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
|
||||
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
|
||||
go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ=
|
||||
go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I=
|
||||
go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE=
|
||||
go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E=
|
||||
go.opentelemetry.io/otel/sdk v1.37.0 h1:ItB0QUqnjesGRvNcmAcU0LyvkVyGJ2xftD29bWdDvKI=
|
||||
go.opentelemetry.io/otel/sdk v1.37.0/go.mod h1:VredYzxUvuo2q3WRcDnKDjbdvmO0sCzOvVAiY+yUkAg=
|
||||
go.opentelemetry.io/otel/sdk/metric v1.37.0 h1:90lI228XrB9jCMuSdA0673aubgRobVZFhbjxHHspCPc=
|
||||
go.opentelemetry.io/otel/sdk/metric v1.37.0/go.mod h1:cNen4ZWfiD37l5NhS+Keb5RXVWZWpRE+9WyVCpbo5ps=
|
||||
go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4=
|
||||
go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0=
|
||||
golang.org/x/crypto v0.39.0 h1:SHs+kF4LP+f+p14esP5jAoDpHU8Gu/v9lFRK6IT5imM=
|
||||
golang.org/x/crypto v0.39.0/go.mod h1:L+Xg3Wf6HoL4Bn4238Z6ft6KfEpN0tJGo53AAPC632U=
|
||||
golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw=
|
||||
golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA=
|
||||
golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw=
|
||||
golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
||||
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
|
||||
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||
golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M=
|
||||
golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA=
|
||||
gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk=
|
||||
gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20250826171959-ef028d996bc1 h1:APHvLLYBhtZvsbnpkfknDZ7NyH4z5+ub/I0u8L3Oz6g=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20250826171959-ef028d996bc1/go.mod h1:xUjFWUnWDpZ/C0Gu0qloASKFb6f8/QXiiXhSPFsD668=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250818200422-3122310a409c h1:qXWI/sQtv5UKboZ/zUk7h+mrf/lXORyI+n9DKDAusdg=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250818200422-3122310a409c/go.mod h1:gw1tLEfykwDz2ET4a12jcXt4couGAm7IwsVaTy0Sflo=
|
||||
google.golang.org/grpc v1.75.0 h1:+TW+dqTd2Biwe6KKfhE5JpiYIBWq865PhKGSXiivqt4=
|
||||
google.golang.org/grpc v1.75.0/go.mod h1:JtPAzKiq4v1xcAB2hydNlWI2RnF85XXcV0mhKXr2ecQ=
|
||||
google.golang.org/protobuf v1.36.8 h1:xHScyCOEuuwZEc6UtSOvPbAT4zRh0xcNRYekJwfqyMc=
|
||||
google.golang.org/protobuf v1.36.8/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
439
AppServer/src/main.go
Executable file
439
AppServer/src/main.go
Executable file
@@ -0,0 +1,439 @@
|
||||
/*
|
||||
Basic functionality to receive uplink messages from TTN,
|
||||
process them and send appropriate responses to devices.
|
||||
|
||||
Author: Olek
|
||||
*/
|
||||
package main
|
||||
|
||||
// go mod vendor -> for static libraries
|
||||
// go mod tidy -> to download to /go/pkg/mod
|
||||
// or just use docker
|
||||
import (
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"crypto/x509"
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"log"
|
||||
"net"
|
||||
"os"
|
||||
"os/signal"
|
||||
"strconv"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
api_user "server/app_comm/api/user"
|
||||
serder "server/serder"
|
||||
|
||||
chirp_api "github.com/chirpstack/chirpstack/api/go/v4/api"
|
||||
|
||||
mqtt "github.com/eclipse/paho.mqtt.golang"
|
||||
"github.com/jackc/pgx/v5"
|
||||
"github.com/jackc/pgx/v5/pgxpool"
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials/insecure"
|
||||
)
|
||||
|
||||
const (
|
||||
MAX_CHAR_LEN = 64 // Limits fields like: names, passwords...
|
||||
MAX_PING_RETRIES = 6
|
||||
)
|
||||
|
||||
// FPort signifies meaning of each port's message
|
||||
const (
|
||||
FNotif uint8 = iota + 1 // Basic notfication message
|
||||
FTask // Assigned task message
|
||||
FAuth // Authorization message: system, device, NFC, NFC Reader...
|
||||
FWarn // Warning message: emergency, help request...
|
||||
)
|
||||
|
||||
// Internal Pagerino status table
|
||||
type Status uint16
|
||||
|
||||
const (
|
||||
StatUnknown Status = iota
|
||||
StatOperational
|
||||
StatIssue // Cannot operate until fixed, small issue
|
||||
StatTempUnavailable // Cannot operate for a period of time regardless of any action
|
||||
StatRepair // Explicitly repaired and unavailable
|
||||
StatOffline // Not powered on or not disconnected from system
|
||||
StatFatal // Cannot operate until professionally repaired or replaced
|
||||
StatMAX // Maximum value, no other meaning
|
||||
)
|
||||
|
||||
// AppData holds data and connections needed througout the program
|
||||
type AppData struct {
|
||||
ExitSig chan os.Signal // Use on fatal error to graciously exit, otherwise potential leaks
|
||||
DBPool *pgxpool.Pool // Execute queries on internal DB on this pool
|
||||
APIServer *grpc.Server // Provide API for apps
|
||||
MQTTClient mqtt.Client // Get Uplinks and downlinks
|
||||
ChirpGateClient chirp_api.GatewayServiceClient // Check gateway stats and manage them
|
||||
Timeout time.Duration // General connection/request timeout
|
||||
}
|
||||
|
||||
// Uplink reflects Chirpstack's uplink format
|
||||
type Uplink struct {
|
||||
ApplicationID string `json:"applicationID"`
|
||||
DevEUI string `json:"devEUI"`
|
||||
FCnt uint32 `json:"fCnt"`
|
||||
FPort uint8 `json:"fPort"`
|
||||
Data string `json:"data"` // Base64 payload
|
||||
RxInfo []struct {
|
||||
GatewayID string `json:"gatewayID"`
|
||||
Time string `json:"time"`
|
||||
RSSI int32 `json:"rssi"`
|
||||
SNR float64 `json:"snr"`
|
||||
} `json:"rxInfo"`
|
||||
DecodedPayload map[string]any `json:"decodedPayload,omitempty"`
|
||||
}
|
||||
|
||||
// Downlink reflects Chirpstack's downlink format
|
||||
type Downlink struct {
|
||||
Confirmed bool `json:"confirmed"` // false for no Ack
|
||||
FPort uint8 `json:"fPort"` // refer to FPort enum
|
||||
Data string `json:"data"` // Base64 payload
|
||||
}
|
||||
|
||||
// Common errors
|
||||
var (
|
||||
ErrNotFound error = errors.New("query returned empty")
|
||||
ErrTooLong error = errors.New("given parameter(s) is too long")
|
||||
ErrTimedOut error = errors.New("operation did not complete before timeout")
|
||||
ErrModify error = errors.New("database data manipulation error")
|
||||
)
|
||||
|
||||
type RPCCredentials struct {
|
||||
Token string
|
||||
}
|
||||
|
||||
func (cred *RPCCredentials) GetRequestMetadata(ctx context.Context, url ...string) (map[string]string, error) {
|
||||
return map[string]string{
|
||||
"authorization": "Bearer " + cred.Token,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// TODO: Change to true if want certs
|
||||
func (cred *RPCCredentials) RequireTransportSecurity() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// Get non-empty config value, otherwise terminate program
|
||||
func FindEnv(name string) string {
|
||||
val := os.Getenv(name)
|
||||
if val == "" {
|
||||
log.Fatalln("Missing or empty configuration value for: " + name)
|
||||
}
|
||||
|
||||
return val
|
||||
}
|
||||
|
||||
// MakeTLSConfig loads client certificates for TLS and SSL
|
||||
func MakeTLSConfig() (*tls.Config, error) {
|
||||
// Load CA certificate
|
||||
caCert, err := os.ReadFile("./certs/ca.pem")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
caCertPool := x509.NewCertPool()
|
||||
caCertPool.AppendCertsFromPEM(caCert)
|
||||
|
||||
// Load client certificate
|
||||
cert, err := tls.LoadX509KeyPair("./certs/client.pem", "./certs/client.key")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &tls.Config{
|
||||
RootCAs: caCertPool,
|
||||
Certificates: []tls.Certificate{cert},
|
||||
MinVersion: tls.VersionTLS12,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// VerifyCredentials returns no error if password matches in DB
|
||||
func VerifyCredentials(username string, password string, data *AppData) error {
|
||||
if len(username) > MAX_CHAR_LEN || len(password) > MAX_CHAR_LEN {
|
||||
return ErrTooLong
|
||||
}
|
||||
|
||||
hash, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
ctx, close_ctx := context.WithTimeout(context.Background(), data.Timeout)
|
||||
defer close_ctx()
|
||||
|
||||
row := data.DBPool.QueryRow(ctx, "SELECT password FROM User WHERE name = $1;")
|
||||
|
||||
var pass string
|
||||
if err = row.Scan(&pass); err != nil {
|
||||
if errors.Is(err, pgx.ErrNoRows) {
|
||||
return fmt.Errorf("%w for: User.name", ErrNotFound)
|
||||
} else {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
err = bcrypt.CompareHashAndPassword(hash, []byte(pass))
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// SendDownlink sends downlink message to MQTT broker
|
||||
func SendDownlink(data *AppData, topic string, msg *Downlink) error {
|
||||
jsonData, _ := json.Marshal(msg)
|
||||
publish_token := data.MQTTClient.Publish(topic, 0, false, jsonData)
|
||||
if ok := publish_token.WaitTimeout(data.Timeout); !ok {
|
||||
return fmt.Errorf("%w for: Downlink", ErrTimedOut)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// makeMQTTHandler returns a callback function that hanldes uplink messages
|
||||
// from MQTT broker.
|
||||
//
|
||||
// Does most of the application logic.
|
||||
func makeMQTTHandler(data *AppData) mqtt.MessageHandler {
|
||||
return func(client mqtt.Client, msg mqtt.Message) {
|
||||
var uplink Uplink
|
||||
// Parse
|
||||
err := json.Unmarshal(msg.Payload(), &uplink)
|
||||
if err != nil {
|
||||
log.Println("Failed to parse uplink message: " + err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Decode to original + saves space
|
||||
decoded, err := base64.StdEncoding.DecodeString(uplink.Data)
|
||||
if err != nil {
|
||||
log.Println("Failed to decode uplink payload: " + err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Print
|
||||
log.Println("Uplink from DeviceEUI [" + uplink.DevEUI + "]")
|
||||
|
||||
switch uplink.FPort {
|
||||
case FNotif:
|
||||
log.Println("Uplink is responding to a normal message or notification")
|
||||
case FTask:
|
||||
log.Println("Uplink is responding to a task")
|
||||
case FAuth:
|
||||
log.Println("Uplink is responding to an authentication message")
|
||||
case FWarn:
|
||||
log.Println("Uplink is responding to a warning")
|
||||
default:
|
||||
log.Println("Uplink is responding in an unrecognized channel")
|
||||
}
|
||||
|
||||
// Query timeout
|
||||
ctx, close := context.WithTimeout(context.Background(), data.Timeout)
|
||||
defer close()
|
||||
|
||||
// Get device IDs
|
||||
row := data.DBPool.QueryRow(ctx,
|
||||
"SELECT id FROM Devices WHERE euid = '$1'",
|
||||
uplink.DevEUI,
|
||||
)
|
||||
|
||||
var dev_id int32
|
||||
if err = row.Scan(&dev_id); err != nil {
|
||||
log.Println(ErrNotFound.Error() + ": Device.euid = " + uplink.DevEUI)
|
||||
return
|
||||
}
|
||||
|
||||
// Add Message to DB
|
||||
_, err = data.DBPool.Exec(ctx,
|
||||
"INSERT INTO Messages (sender_id, receiver_id, payload) VALUES ($1, $2, $3)",
|
||||
dev_id, nil, decoded,
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
log.Println(ErrModify.Error() + ": Message")
|
||||
return
|
||||
}
|
||||
|
||||
// Get decoded custom payload
|
||||
pager_msg, err := serder.Deserialize(decoded)
|
||||
if err != nil {
|
||||
log.Println(err.Error() + ": deserialization")
|
||||
return
|
||||
}
|
||||
|
||||
log.Println("Received Pagerino payload for AppID[", pager_msg.AppID, "]:")
|
||||
for _, field := range pager_msg.Fields {
|
||||
log.Println(field)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
// = Quit signal
|
||||
quit_signal := make(chan os.Signal, 1)
|
||||
signal.Notify(quit_signal, syscall.SIGINT, syscall.SIGTERM)
|
||||
|
||||
Data := AppData{
|
||||
ExitSig: quit_signal,
|
||||
}
|
||||
|
||||
// === Logger settings
|
||||
log.SetFlags(log.Ldate | log.Ltime | log.Lmsgprefix | log.Lshortfile)
|
||||
log.SetPrefix(FindEnv("LOG_PREFIX") + " ")
|
||||
|
||||
tmout, err := time.ParseDuration(FindEnv("TIMEOUT"))
|
||||
if err != nil {
|
||||
log.Println(`Format misconfiguration for TIMEOUT:
|
||||
Expected: [number]{h|m|s|ms|us|ns}...`)
|
||||
return
|
||||
}
|
||||
Data.Timeout = tmout
|
||||
|
||||
// === PostgreSQL database
|
||||
ctx_tmout, cancel_ctx := context.WithTimeout(context.Background(), Data.Timeout)
|
||||
defer cancel_ctx()
|
||||
|
||||
db_pool, err := pgxpool.New(ctx_tmout,
|
||||
"postgres://"+FindEnv("DB_USER")+":"+FindEnv("DB_PASSWORD")+"@"+
|
||||
FindEnv("DB_HOST")+":5432/"+FindEnv("DB_NAME"),
|
||||
)
|
||||
if err != nil {
|
||||
log.Println("DB connection pool creation failed: " + err.Error())
|
||||
return
|
||||
}
|
||||
defer db_pool.Close()
|
||||
log.Println("Created database connection.")
|
||||
|
||||
Data.DBPool = db_pool
|
||||
|
||||
// Check responsiveness
|
||||
failed := true
|
||||
for count := 0; count < MAX_PING_RETRIES; count++ {
|
||||
if err = db_pool.Ping(ctx_tmout); err != nil {
|
||||
time.Sleep(200 * time.Millisecond)
|
||||
} else {
|
||||
failed = false
|
||||
break
|
||||
}
|
||||
}
|
||||
if failed {
|
||||
log.Println("Database is not responding: " + err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// === MQTT broker
|
||||
tls_config, err := MakeTLSConfig()
|
||||
if err != nil {
|
||||
log.Println("Error creating TLS configuration: " + err.Error())
|
||||
return
|
||||
}
|
||||
opts := mqtt.NewClientOptions().
|
||||
AddBroker(FindEnv("MQTT_ADDRESS")).
|
||||
SetClientID(FindEnv("MQTT_CLIENT_ID")).
|
||||
SetTLSConfig(tls_config).
|
||||
SetKeepAlive(30 * time.Second)
|
||||
|
||||
client := mqtt.NewClient(opts)
|
||||
connect_token := client.Connect()
|
||||
if err := connect_token.Error(); err != nil {
|
||||
log.Println("Failed to connect to MQTT broker: " + err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
if ok := connect_token.WaitTimeout(Data.Timeout); !ok {
|
||||
|
||||
log.Println("Connection to MQTT broker timed out")
|
||||
return
|
||||
}
|
||||
|
||||
log.Println("Created MQTT broker connection.")
|
||||
defer client.Disconnect(150)
|
||||
|
||||
Data.MQTTClient = client
|
||||
|
||||
// === API Server
|
||||
api_port := FindEnv("SERVER_API_PORT")
|
||||
net_listen, err := net.Listen("tcp", ":"+api_port)
|
||||
if err != nil {
|
||||
log.Println("Failed to listen on port " + api_port + ": " + err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
grpc_server := grpc.NewServer()
|
||||
// User service
|
||||
api_user.RegisterUserServiceServer(
|
||||
grpc_server,
|
||||
&UserServiceServer{App: &Data},
|
||||
)
|
||||
Data.APIServer = grpc_server
|
||||
|
||||
// Serve gRPC
|
||||
go func() {
|
||||
if err := grpc_server.Serve(net_listen); err != nil {
|
||||
log.Println("Failed to serve gRPC API")
|
||||
return
|
||||
}
|
||||
}()
|
||||
log.Println("gRPC API serving on port: " + api_port)
|
||||
|
||||
// === Chirpstack's gRPC API
|
||||
dialOpts := []grpc.DialOption{
|
||||
//grpc.WithBlock(),
|
||||
grpc.WithPerRPCCredentials(&RPCCredentials{FindEnv("CHIRP_API_KEY")}),
|
||||
grpc.WithTransportCredentials(insecure.NewCredentials()), // remove this when using TLS
|
||||
}
|
||||
|
||||
grpc_conn, err := grpc.Dial("chirpstack:8080", dialOpts...)
|
||||
if err != nil {
|
||||
log.Println("Failed to create a gRPC connection to Chirpstack's API: " + err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
Data.ChirpGateClient = chirp_api.NewGatewayServiceClient(grpc_conn)
|
||||
defer grpc_conn.Close()
|
||||
|
||||
log.Println("Created Chirpstack's API connection.")
|
||||
|
||||
// Test gRPC connection
|
||||
ctx_tmout, cancel_ctx = context.WithTimeout(context.Background(), Data.Timeout)
|
||||
defer cancel_ctx()
|
||||
|
||||
resp, err := Data.ChirpGateClient.List(ctx_tmout, &chirp_api.ListGatewaysRequest{
|
||||
Limit: 10,
|
||||
Offset: 0,
|
||||
OrderByDesc: true,
|
||||
})
|
||||
if err != nil {
|
||||
log.Println("Failed to test Chirpstack's API connection: "+err.Error(), resp)
|
||||
return
|
||||
}
|
||||
|
||||
log.Println("Found the following gateways (first 10):")
|
||||
for idx, gate := range resp.Result {
|
||||
log.Println(strconv.FormatInt(int64(idx), 10) + ": App[" +
|
||||
gate.TenantId + "] GateID[" + gate.GatewayId + "] Name[" +
|
||||
gate.Name + "]")
|
||||
}
|
||||
log.Println("[END]")
|
||||
|
||||
// === Listen for Uplinks
|
||||
// Subscribe to topics
|
||||
topic := "application/" + FindEnv("APP_ID") + "/device/+/event/up"
|
||||
qos, err := strconv.Atoi(FindEnv("MQTT_QOS"))
|
||||
if err != nil {
|
||||
log.Println("Format misconfiguration for MQTT_QOS: " + err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
client.Subscribe(topic, byte(qos), makeMQTTHandler(&Data))
|
||||
log.Println("Subscribed to uplink data on: " + topic + ".")
|
||||
|
||||
// === Shutdown
|
||||
<-Data.ExitSig // Continue here on force quit
|
||||
log.Println("The server is shutting down.")
|
||||
}
|
||||
312
AppServer/src/serder/serder.go
Normal file
312
AppServer/src/serder/serder.go
Normal file
@@ -0,0 +1,312 @@
|
||||
/*
|
||||
Serialize and deserialize data with custom
|
||||
Pagerino message templates.
|
||||
|
||||
Author: Olek
|
||||
*/
|
||||
package serder
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"fmt"
|
||||
"math"
|
||||
)
|
||||
|
||||
const (
|
||||
NFC_LENGTH = 7
|
||||
)
|
||||
|
||||
var (
|
||||
ErrTooShort error = errors.New("insufficient bytes in message")
|
||||
ErrNoType error = errors.New("encountered unknown data type")
|
||||
ErrNoLength error = errors.New("data type has no defined length")
|
||||
ErrUndefined error = errors.New("encountered unexpected symbol, behaviour undefined")
|
||||
ErrInvalidData error = errors.New("invalid underlying data provided")
|
||||
ErrTooLong error = errors.New("data provided is too long")
|
||||
)
|
||||
|
||||
type Reaction uint8
|
||||
|
||||
const (
|
||||
React_OK Reaction = iota
|
||||
React_IN
|
||||
React_OUT
|
||||
)
|
||||
|
||||
const (
|
||||
DT_NULL byte = iota
|
||||
DT_Char // byte
|
||||
DT_Array // array
|
||||
DT_Location // Location
|
||||
DT_Temperature // float
|
||||
DT_Charge // float
|
||||
DT_Authorization // UID
|
||||
DT_Reaction // byte
|
||||
DT_NFCPair // UID
|
||||
DT_NFCUnpair // None
|
||||
)
|
||||
|
||||
var DataSizeMap = map[byte]int{
|
||||
DT_NULL: 0,
|
||||
DT_Array: 2, // type + length
|
||||
DT_Char: 1,
|
||||
DT_Location: 20,
|
||||
DT_Temperature: 4,
|
||||
DT_Charge: 4,
|
||||
DT_Authorization: 7,
|
||||
DT_Reaction: 1,
|
||||
DT_NFCPair: 7,
|
||||
DT_NFCUnpair: 0,
|
||||
}
|
||||
|
||||
type Location struct {
|
||||
Latitude float64
|
||||
Longitude float64
|
||||
Altitude float32
|
||||
}
|
||||
|
||||
type Field struct {
|
||||
DType byte
|
||||
Value any
|
||||
}
|
||||
|
||||
type PagerMessage struct {
|
||||
AppID uint16
|
||||
Fields []Field
|
||||
}
|
||||
|
||||
// readArray reads a subset of bytes marked with DT_Array.
|
||||
// This data is copied, it is not parsed.
|
||||
func readArray(data []byte, offset int, dest *[]byte) (int, error) {
|
||||
if offset+2 >= len(data) {
|
||||
return offset, ErrTooShort
|
||||
}
|
||||
|
||||
dtype := data[offset]
|
||||
offset++
|
||||
|
||||
length := int(data[offset])
|
||||
offset++
|
||||
|
||||
size, found := DataSizeMap[dtype]
|
||||
if !found {
|
||||
return offset, ErrNoLength
|
||||
}
|
||||
|
||||
if size*length+offset >= len(data) {
|
||||
return len(data), ErrTooShort
|
||||
}
|
||||
|
||||
// Untyped!
|
||||
*dest = append(*dest, data[offset:offset+length*size]...)
|
||||
return offset + length*size, nil
|
||||
}
|
||||
|
||||
// readField returns single Field struct reflecting the next data segment
|
||||
func readField(data []byte, offset int) (Field, int, error) {
|
||||
pair := Field{}
|
||||
if offset >= len(data) {
|
||||
return pair, offset, ErrTooShort
|
||||
}
|
||||
|
||||
// Get type
|
||||
pair.DType = data[offset]
|
||||
offset++
|
||||
|
||||
size, found := DataSizeMap[pair.DType]
|
||||
if !found {
|
||||
return pair, offset, ErrNoLength
|
||||
}
|
||||
|
||||
if size != 0 {
|
||||
if offset+size >= len(data) {
|
||||
return pair, offset, ErrTooShort
|
||||
}
|
||||
|
||||
switch pair.DType {
|
||||
case DT_Char, DT_Reaction:
|
||||
pair.Value = data[offset]
|
||||
offset++
|
||||
|
||||
case DT_Array:
|
||||
sub_pair := Field{DType: data[offset]}
|
||||
val, ok := sub_pair.Value.([]byte)
|
||||
if !ok {
|
||||
return pair, offset, ErrInvalidData
|
||||
}
|
||||
|
||||
offset, err := readArray(data, offset, &val)
|
||||
if err != nil {
|
||||
return pair, offset, err
|
||||
}
|
||||
|
||||
pair.Value = sub_pair
|
||||
|
||||
case DT_Charge, DT_Temperature:
|
||||
pair.Value = math.Float32frombits(binary.LittleEndian.Uint32(data[offset:]))
|
||||
offset += 4
|
||||
|
||||
case DT_Authorization, DT_NFCPair:
|
||||
pair.Value = data[offset : offset+NFC_LENGTH]
|
||||
offset += NFC_LENGTH
|
||||
|
||||
case DT_Location:
|
||||
val := Location{Latitude: math.Float64frombits(binary.LittleEndian.Uint64(data[offset:]))}
|
||||
offset += 8
|
||||
val.Longitude = math.Float64frombits(binary.LittleEndian.Uint64(data[offset:]))
|
||||
offset += 8
|
||||
val.Altitude = math.Float32frombits(binary.LittleEndian.Uint32(data[offset:]))
|
||||
offset += 4
|
||||
|
||||
pair.Value = val
|
||||
|
||||
default:
|
||||
return pair, offset, ErrNoType
|
||||
}
|
||||
}
|
||||
|
||||
return pair, offset, nil
|
||||
}
|
||||
|
||||
// writeField encodes a field into buffer
|
||||
func writeField(field *Field, buf []byte) ([]byte, error) {
|
||||
buf = append(buf, field.DType)
|
||||
|
||||
switch field.DType {
|
||||
case DT_Array:
|
||||
sub_pair, ok := field.Value.(Field)
|
||||
if !ok {
|
||||
return buf, ErrInvalidData
|
||||
}
|
||||
buf = append(buf, sub_pair.DType)
|
||||
|
||||
size, ok := DataSizeMap[sub_pair.DType]
|
||||
if !ok {
|
||||
return buf, ErrNoLength
|
||||
}
|
||||
|
||||
val, ok := sub_pair.Value.([]byte)
|
||||
if !ok {
|
||||
return buf, ErrInvalidData
|
||||
}
|
||||
|
||||
length := len(val) / size
|
||||
if length > 255 {
|
||||
return buf, ErrTooLong
|
||||
}
|
||||
|
||||
buf = append(buf, byte(length))
|
||||
buf = append(buf, val...)
|
||||
case DT_Char, DT_Reaction:
|
||||
val, ok := field.Value.(byte)
|
||||
if !ok {
|
||||
return buf, ErrInvalidData
|
||||
}
|
||||
|
||||
buf = append(buf, val)
|
||||
|
||||
case DT_Authorization, DT_NFCPair:
|
||||
val, ok := field.Value.([7]byte)
|
||||
if !ok {
|
||||
return buf, ErrInvalidData
|
||||
}
|
||||
|
||||
buf = append(buf, val[:]...)
|
||||
|
||||
case DT_Charge, DT_Temperature:
|
||||
val, ok := field.Value.(float32)
|
||||
if !ok {
|
||||
return buf, ErrInvalidData
|
||||
}
|
||||
|
||||
buf = binary.LittleEndian.AppendUint32(buf, math.Float32bits(val))
|
||||
|
||||
case DT_Location:
|
||||
val, ok := field.Value.(Location)
|
||||
if !ok {
|
||||
return buf, ErrInvalidData
|
||||
}
|
||||
|
||||
buf = binary.LittleEndian.AppendUint64(buf, math.Float64bits(val.Latitude))
|
||||
buf = binary.LittleEndian.AppendUint64(buf, math.Float64bits(val.Longitude))
|
||||
buf = binary.LittleEndian.AppendUint32(buf, math.Float32bits(val.Altitude))
|
||||
|
||||
case DT_NULL, DT_NFCUnpair:
|
||||
|
||||
default:
|
||||
return buf, ErrNoType
|
||||
}
|
||||
|
||||
return buf, nil
|
||||
}
|
||||
|
||||
// SplitByLimit splits encoded message into parts
|
||||
// with maximum length derived from data rate.
|
||||
//
|
||||
// These messages are not decodable on the server, as
|
||||
// data is fractured. (TODO)
|
||||
func SplitByLimit(buf []byte, data_rate int) ([][]byte, error) {
|
||||
var limit int
|
||||
if data_rate >= 0 && data_rate <= 3 {
|
||||
limit = 51
|
||||
} else if data_rate == 4 {
|
||||
limit = 115
|
||||
} else if data_rate >= 5 && data_rate <= 7 {
|
||||
limit = 222
|
||||
} else {
|
||||
return nil, ErrUndefined
|
||||
}
|
||||
|
||||
length := len(buf)
|
||||
count := length / limit
|
||||
if length%limit != 0 {
|
||||
count++
|
||||
}
|
||||
|
||||
output := make([][]byte, 0, count)
|
||||
offset := 0
|
||||
for ; offset+limit < length; offset += limit {
|
||||
output = append(output, buf[offset:offset+limit])
|
||||
}
|
||||
output = append(output, buf[offset:length])
|
||||
|
||||
return output, nil
|
||||
}
|
||||
|
||||
// Deserialize deserializes bytes into a structured message
|
||||
func Deserialize(input []byte) (*PagerMessage, error) {
|
||||
output := PagerMessage{}
|
||||
|
||||
length := len(input)
|
||||
if length < 2 {
|
||||
return &output, fmt.Errorf("%w while reading AppID", ErrTooShort)
|
||||
}
|
||||
offset := 0
|
||||
output.AppID = binary.LittleEndian.Uint16(input[offset:])
|
||||
offset += 2
|
||||
|
||||
var err error
|
||||
var field Field
|
||||
for ; err == nil && offset < length; field, offset, err = readField(input, offset) {
|
||||
output.Fields = append(output.Fields, field)
|
||||
}
|
||||
|
||||
return &output, err
|
||||
}
|
||||
|
||||
// Serialize serializes a message into bytes.
|
||||
//
|
||||
// Resulting array length is not limited, to get
|
||||
// split messages for downlink use "SplitByLimit()"
|
||||
func Serialize(msg *PagerMessage) ([]byte, error) {
|
||||
buf := make([]byte, 0, 2+len(msg.Fields)*2) // May overalloc!
|
||||
buf = binary.LittleEndian.AppendUint16(buf, msg.AppID)
|
||||
|
||||
var err error
|
||||
for idx := 0; idx < len(msg.Fields) && err == nil; idx++ {
|
||||
buf, err = writeField(&msg.Fields[idx], buf)
|
||||
}
|
||||
|
||||
return buf, err
|
||||
}
|
||||
BIN
AppServer/tarball.tar.gz
Normal file
BIN
AppServer/tarball.tar.gz
Normal file
Binary file not shown.
Reference in New Issue
Block a user