68 return EFalse; |
68 return EFalse; |
69 } |
69 } |
70 Val(iSmrRomHeader.iImageVersion,aValues.at(0).c_str()); |
70 Val(iSmrRomHeader.iImageVersion,aValues.at(0).c_str()); |
71 return ETrue; |
71 return ETrue; |
72 } |
72 } |
73 TBool CSmrImage::SetHcrData(const StringVector& aValues) |
73 TBool CSmrImage::SetSmrData(const StringVector& aValues) |
74 { |
74 { |
75 |
75 |
76 if(aValues.size() == 0) |
76 if(aValues.size() == 0) |
77 { |
77 { |
78 Print(EError, "keyword hcrdata has not been set!"); |
78 Print(EError, "keyword smrdata has not been set!"); |
79 return EFalse; |
79 return EFalse; |
80 } |
80 } |
81 if(aValues.size() > 1) |
81 if(aValues.size() > 1) |
82 { |
82 { |
83 Print(EError, "Keyword hcrdata has been set more than one time!"); |
83 Print(EError, "Keyword smrdata has been set more than one time!"); |
84 return EFalse; |
84 return EFalse; |
85 } |
85 } |
86 iHcrData = aValues.at(0); |
86 iSmrData = aValues.at(0); |
87 |
87 |
88 ifstream is(iHcrData.c_str(), ios_base::binary ); |
88 ifstream is(iSmrData.c_str(), ios_base::binary ); |
89 if(!is) |
89 if(!is) |
90 { |
90 { |
91 Print(EError, "HCR data file: %s dose not exist!", iHcrData.c_str()); |
91 Print(EError, "SMR data file: %s dose not exist!", iSmrData.c_str()); |
92 return EFalse; |
|
93 } |
|
94 TUint32 magicWord = 0; |
|
95 is.read(reinterpret_cast<char*>(&magicWord),sizeof(TUint32)); |
|
96 if(0x66524348 != magicWord){ |
|
97 Print(EError, "HCR data file: %s is an invalid HCR data file!", iHcrData.c_str()); |
|
98 return EFalse; |
92 return EFalse; |
99 } |
93 } |
100 is.close(); |
94 is.close(); |
101 return ETrue; |
95 return ETrue; |
102 } |
96 } |
138 TInt result = KErrGeneral; |
132 TInt result = KErrGeneral; |
139 if(! SetImageName(iObeyFile->getValues("imagename"))) |
133 if(! SetImageName(iObeyFile->getValues("imagename"))) |
140 return result; |
134 return result; |
141 if(! SetFormatVersion(iObeyFile->getValues("formatversion"))) |
135 if(! SetFormatVersion(iObeyFile->getValues("formatversion"))) |
142 return result; |
136 return result; |
143 if(! SetHcrData(iObeyFile->getValues("hcrdata"))) |
137 if(! SetSmrData(iObeyFile->getValues("smrdata"))) |
144 return result; |
138 return result; |
145 if(! SetPayloadUID(iObeyFile->getValues("payloaduid"))) |
139 if(! SetPayloadUID(iObeyFile->getValues("payloaduid"))) |
146 return result; |
140 return result; |
147 if(! SetPayloadFlags(iObeyFile->getValues("payloadflags"))) |
141 if(! SetPayloadFlags(iObeyFile->getValues("payloadflags"))) |
148 return result; |
142 return result; |
151 } |
145 } |
152 TInt CSmrImage::CreateImage() |
146 TInt CSmrImage::CreateImage() |
153 { |
147 { |
154 TInt imageSize = 0; |
148 TInt imageSize = 0; |
155 ifstream is; |
149 ifstream is; |
156 is.open(iHcrData.c_str(), ios_base::binary); |
150 is.open(iSmrData.c_str(), ios_base::binary); |
157 if(!is) |
151 if(!is) |
158 { |
152 { |
159 Print(EError, "Open HCR data file: %s error!\n", iHcrData.c_str()); |
153 Print(EError, "Open SMR data file: %s error!\n", iSmrData.c_str()); |
160 return KErrGeneral; |
154 return KErrGeneral; |
161 } |
155 } |
162 is.seekg(0, ios_base::end); |
156 is.seekg(0, ios_base::end); |
163 TInt fsize = is.tellg(); |
157 TInt fsize = is.tellg(); |
164 imageSize = sizeof(SSmrRomHeader) + fsize; |
158 imageSize = sizeof(SSmrRomHeader) + fsize; |