123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- // Copyright 2019 getensh.com. All rights reserved.
- // Use of this source code is governed by getensh.com.
- package impl
- import (
- "context"
- "property-mqtt/impl/v1/face"
- "property-mqtt/pb"
- pb_v1 "property-mqtt/pb/v1"
- "git.getensh.com/common/gopkgs/tasker/rpctasker"
- "google.golang.org/grpc"
- )
- // 具体实现
- type Rcvr struct {
- }
- func Register(s *grpc.Server) {
- pb.RegisterMqttServer(s, &Rcvr{})
- }
- //
- func (c *Rcvr) FaceWhiteAdd(ctx context.Context, req *pb_v1.FaceWhiteAddRequest) (reply *pb_v1.FaceWhiteAddReply, err error) {
- t1 := func() error {
- reply, err = face.FaceWhiteAdd(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
- func (c *Rcvr) FaceWhiteDel(ctx context.Context, req *pb_v1.FaceWhiteDelRequest) (reply *pb_v1.FaceWhiteDelReply, err error) {
- t1 := func() error {
- reply, err = face.FaceWhiteDel(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
- func (c *Rcvr) FaceOpen(ctx context.Context, req *pb_v1.FaceOpenRequest) (reply *pb_v1.FaceOpenReply, err error) {
- t1 := func() error {
- reply, err = face.FaceOpen(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
- func (c *Rcvr) FaceReboot(ctx context.Context, req *pb_v1.FaceRebootRequest) (reply *pb_v1.FaceRebootReply, err error) {
- t1 := func() error {
- reply, err = face.FaceReboot(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
- func (c *Rcvr) NewMqttDevice(ctx context.Context, req *pb_v1.NewMqttDeviceRequest) (reply *pb_v1.NewMqttDeviceReply, err error) {
- t1 := func() error {
- reply, err = face.NewMqttDevice(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
|