summaryrefslogtreecommitdiff
path: root/zttool.c
diff options
context:
space:
mode:
authormarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2003-06-03 02:56:23 +0000
committermarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2003-06-03 02:56:23 +0000
commitde7e3a24c5252a74c860f70439817d80d6d06d9c (patch)
treedf97b276bd482d572dfb94d23c0c085f8af984ac /zttool.c
parent5a47da7fbad1bd29daa638c0d65a93d79d7c7d91 (diff)
Add offset field, make zttool send loopup/loopdown
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@185 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'zttool.c')
-rwxr-xr-xzttool.c45
1 files changed, 43 insertions, 2 deletions
diff --git a/zttool.c b/zttool.c
index 7c75a12..5d306f2 100755
--- a/zttool.c
+++ b/zttool.c
@@ -285,11 +285,45 @@ static void show_bits(int span, newtComponent bitbox, newtComponent inuse, newtC
}
+static void do_loop(int span, int looped)
+{
+ newtComponent form;
+ newtComponent label;
+ char s1[256];
+ struct zt_maintinfo m;
+ int res;
+ struct newtExitStruct es;
+
+ newtOpenWindow(30,12,20,4, s[span].desc);
+
+ form = newtForm(NULL, NULL, 0);
+ m.spanno = span;
+ if (looped) {
+ snprintf(s1, sizeof(s1), "Looping UP span %d...\n", span);
+ m.command = ZT_MAINT_LOOPUP;
+ } else {
+ snprintf(s1, sizeof(s1), "Looping DOWN span %d...\n", span);
+ m.command = ZT_MAINT_LOOPDOWN;
+ }
+
+ label = newtLabel(8,9,s1);
+ newtFormAddComponent(form, label);
+ newtPushHelpLine("Please wait...");
+
+ newtFormSetTimer(form, 200);
+ newtFormRun(form, &es);
+ res = ioctl(ctl, ZT_MAINT, &m);
+ newtFormDestroy(form);
+ newtPopWindow();
+ newtPopHelpLine();
+}
+
static newtComponent spans;
static void show_span(int span)
{
newtComponent form;
newtComponent back;
+ newtComponent loop;
newtComponent label;
newtComponent bitbox;
newtComponent inuse;
@@ -302,6 +336,7 @@ static void show_span(int span)
char s1[] = " 1111111111222222222333";
char s2[] = "1234567890123456789012345789012";
int max;
+ int looped = 0;
struct newtExitStruct es;
void *ss;
@@ -319,10 +354,11 @@ static void show_span(int span)
newtOpenWindow(10,2,60,20, s[span].desc);
newtPushHelpLine(info2);
- back = newtButton(48,12,"Back");
+ back = newtButton(48,8,"Back");
+ loop = newtButton(48,14,"Loop");
form = newtForm(NULL, NULL, 0);
- newtFormAddComponents(form, back, NULL);
+ newtFormAddComponents(form, back, loop, NULL);
max = s[span].totalchans;
if (max > 32)
@@ -413,6 +449,11 @@ static void show_span(int span)
} while(es.reason == NEWT_EXIT_TIMER);
switch(es.reason) {
case NEWT_EXIT_COMPONENT:
+ if (es.u.co == loop) {
+ looped = !looped;
+ do_loop(span, looped);
+ newtFormSetTimer(form, 200);
+ }
if (es.u.co == back) {
goto out;
}