command.h
Go to the documentation of this file.
1 /*
2 This is free and unencumbered software released into the public domain.
3 
4 Anyone is free to copy, modify, publish, use, compile, sell, or
5 distribute this software, either in source code form or as a compiled
6 binary, for any purpose, commercial or non-commercial, and by any
7 means.
8 
9 In jurisdictions that recognize copyright laws, the author or authors
10 of this software dedicate any and all copyright interest in the
11 software to the public domain. We make this dedication for the benefit
12 of the public at large and to the detriment of our heirs and
13 successors. We intend this dedication to be an overt act of
14 relinquishment in perpetuity of all present and future rights to this
15 software under copyright law.
16 
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 OTHER DEALINGS IN THE SOFTWARE.
24 
25 For more information, please refer to <http://unlicense.org/>
26 */
27 
28 /*
29 This version is for pigpio version 57+
30 */
31 
32 #ifndef COMMAND_H
33 #define COMMAND_H
34 
35 #include <stdio.h>
36 #include <string.h>
37 
38 #include "pigpio.h"
39 
40 #define CMD_MAX_PARAM 512
41 #define CMD_MAX_EXTENSION (1<<16)
42 
43 #define CMD_UNKNOWN_CMD -1
44 #define CMD_BAD_PARAMETER -2
45 #define CMD_EXT_TOO_SMALL -3
46 
47 #define CMD_P_ARR 10
48 #define CMD_V_ARR 10
49 
50 #define CMD_NUMERIC 1
51 #define CMD_VAR 2
52 #define CMD_PAR 3
53 
54 typedef struct
55 {
56  uint32_t cmd;
57  uint32_t p1;
58  uint32_t p2;
59  union
60  {
61  uint32_t p3;
62  uint32_t ext_len;
63  uint32_t res;
64  };
65 } cmdCmd_t;
66 
67 typedef struct
68 {
69  int eaten;
70  int8_t opt[4];
72 
73 typedef struct
74 {
75  int cmd; /* command number */
76  char *name; /* command name */
77  int vt; /* command verification type */
78  int rv; /* command return value type */
79 } cmdInfo_t;
80 
81 typedef struct
82 {
83  uint32_t tag;
84  int step;
85 } cmdTagStep_t;
86 
87 typedef struct
88 {
89  uint32_t p[5];
90  int8_t opt[4];
91 } cmdInstr_t;
92 
93 typedef struct
94 {
95  /*
96  +-----------+---------+---------+----------------+
97  | PARAMS... | VARS... | CMDS... | STRING AREA... |
98  +-----------+---------+---------+----------------+
99  */
100  int *par;
101  int *var;
103  int instrs;
104  char *str_area;
107 } cmdScript_t;
108 
109 extern cmdInfo_t cmdInfo[];
110 
111 extern char *cmdUsage;
112 
113 int cmdParse(char *buf, uint32_t *p, unsigned ext_len, char *ext, cmdCtlParse_t *ctl);
114 
115 int cmdParseScript(char *script, cmdScript_t *s, int diags);
116 
117 char *cmdErrStr(int error);
118 
119 char *cmdStr(void);
120 
121 #endif
122 
s
Definition: DHT22.py:257
int rv
Definition: command.h:78
int vt
Definition: command.h:77
int * par
Definition: command.h:100
uint32_t p3
Definition: command.h:61
void error(const char *msg)
int str_area_len
Definition: command.h:105
uint32_t ext_len
Definition: command.h:62
uint32_t p1
Definition: command.h:57
char * cmdStr(void)
Definition: command.c:624
char * str_area
Definition: command.h:104
char * cmdUsage
Definition: command.c:264
int * var
Definition: command.h:101
int instrs
Definition: command.h:103
int cmdParse(char *buf, uint32_t *p, unsigned ext_len, char *ext, cmdCtlParse_t *ctl)
Definition: command.c:629
uint32_t res
Definition: command.h:63
int step
Definition: command.h:84
char * cmdErrStr(int error)
Definition: command.c:1248
int cmd
Definition: command.h:75
int cmdParseScript(char *script, cmdScript_t *s, int diags)
Definition: command.c:1259
cmdInstr_t * instr
Definition: command.h:102
cmdInfo_t cmdInfo[]
Definition: command.c:41
char * name
Definition: command.h:76
uint32_t tag
Definition: command.h:83
int str_area_pos
Definition: command.h:106
uint32_t p2
Definition: command.h:58
uint32_t cmd
Definition: command.h:56


cob_hand_bridge
Author(s): Mathias Lüdtke
autogenerated on Tue Oct 20 2020 03:35:57