/[PAMELA software]/yodaUtility/YMcmd.cpp
ViewVC logotype

Contents of /yodaUtility/YMcmd.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Sun Apr 30 11:08:14 2006 UTC (18 years, 7 months ago) by kusanagi
Branch: MAIN
Initial revision

1 #include <YMcmd.h>
2 #include <sstream>
3
4 //using namespace std;
5
6
7 const char* ElseItem::toXML(char* tab = "") {
8 std::stringstream oss;
9 oss.str("");
10 oss << tab << "<Else>\n";
11 oss << tab << "</Else>\n";
12 return oss.str().c_str();
13 }
14
15
16
17
18 const char* DownLinkItem::toXML(char* tab = ""){
19 stringstream oss;
20 oss.str("");
21 return oss.str().c_str();
22 }
23
24
25
26
27
28 void TimeSyncItem::fill(TArrayC* data){
29 newTime = (((unsigned int)data->At(0)<<24)&0xFF000000) + (((unsigned int)data->At(1)<<16)&0x00FF0000) + (((unsigned int)data->At(2)<<8)&0x0000FF00) + (((unsigned int)data->At(3))&0x000000FF);
30 }
31
32 const char* TimeSyncItem::toXML(char* tab = ""){
33 stringstream oss;
34 oss.str("");
35 oss << tab << "<param name = 'newTime'>" << newTime << "</param>\n";
36 return oss.str().c_str();
37 }
38
39
40
41
42
43 void SelectOpModeItem::fill(TArrayC* data){
44 /*for (int i = 0; i<data->GetSize(); i++){
45 printf("array[%i]: %x", i, data->At(i));
46 }*/
47 mode = data->At(1)&0xFF;
48 paramNumber = (((unsigned int)data->At(2)<<8)&0x00000100) + (((unsigned int)data->At(3))&0x000000FF);
49 }
50
51 const char* SelectOpModeItem::toXML(char* tab = ""){
52 stringstream oss;
53 oss.str("");
54 oss << tab << "<param name = 'mode'>" << hex << mode << dec << "</param>\n";
55 oss << tab << "<param name = 'paramNumber'>" << paramNumber << "</param>\n";
56 return oss.str().c_str();
57 }
58
59
60
61
62
63 void BiteItem::fill(TArrayC* data){
64 fillerWord = (((unsigned int)data->At(0)<<8)&0x0000FF00) + (((unsigned int)data->At(1))&0x000000FF);
65 }
66
67 const char* BiteItem::toXML(char* tab = ""){
68 stringstream oss;
69 oss.str("");
70 oss << tab << "<param name = 'fillerWord'>" << fillerWord << "</param>\n";
71 return oss.str().c_str();
72 }
73
74
75 const char* McmdScan::extract(TArrayC *data, int id, char* tabs){
76 switch(id){
77 case 0xE0:
78 mcmdItem = new TimeSyncItem();
79 break;
80 case 0x33:
81 mcmdItem = new SelectOpModeItem();
82 break;
83 default:
84 mcmdItem = new ElseItem();
85 break;
86 }
87 mcmdItem->fill(data);
88 return mcmdItem->toXML(tabs);
89 }
90

  ViewVC Help
Powered by ViewVC 1.1.23