Rev 434 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 434 | Rev 436 | ||
---|---|---|---|
Line 130... | Line 130... | ||
130 | if(doc->file != NULL) // could the file be opened? |
130 | if(doc->file != NULL) // could the file be opened? |
131 | { |
131 | { |
132 | retvalue = 1; // the document could be created on the drive. |
132 | retvalue = 1; // the document could be created on the drive. |
133 | doc->state = KML_DOC_OPENED; // change document state to opened. At next a placemark has to be opened. |
133 | doc->state = KML_DOC_OPENED; // change document state to opened. At next a placemark has to be opened. |
134 | str = KML_DOCUMENT_HEADER; // write the KML-header to the document. |
134 | str = KML_DOCUMENT_HEADER; // write the KML-header to the document. |
135 | for(i= 0; i < sizeof(KML_DOCUMENT_HEADER); i++) |
135 | for(i= 0; i < sizeof(KML_DOCUMENT_HEADER)-1; i++) |
136 | { |
136 | { |
137 | c = (int8_t)pgm_read_byte(str++); // get byte from flash |
137 | c = (int8_t)pgm_read_byte(str++); // get byte from flash |
138 | fputc_(c, doc->file); // and write that to sd-card |
138 | fputc_(c, doc->file); // and write that to sd-card |
139 | } |
139 | } |
140 | } |
140 | } |
Line 174... | Line 174... | ||
174 | 174 | ||
175 | case KML_DOC_OPENED: // close the file on the memorycard |
175 | case KML_DOC_OPENED: // close the file on the memorycard |
176 | if(doc->file != NULL) |
176 | if(doc->file != NULL) |
177 | { |
177 | { |
178 | str = KML_DOCUMENT_FOOTER; // write the KML- footer to the document. |
178 | str = KML_DOCUMENT_FOOTER; // write the KML- footer to the document. |
179 | for(i= 0; i < sizeof(KML_DOCUMENT_FOOTER); i++) |
179 | for(i= 0; i < sizeof(KML_DOCUMENT_FOOTER)-1; i++) |
180 | { |
180 | { |
181 | c = (int8_t)pgm_read_byte(str++); // get byte from flash |
181 | c = (int8_t)pgm_read_byte(str++); // get byte from flash |
182 | fputc_(c, doc->file); // and write that to sd-card |
182 | fputc_(c, doc->file); // and write that to sd-card |
183 | } |
183 | } |
Line 217... | Line 217... | ||
217 | if(doc->file != NULL) |
217 | if(doc->file != NULL) |
218 | { |
218 | { |
219 | doc->state = KML_DOC_PLACEMARK_OPENED; |
219 | doc->state = KML_DOC_PLACEMARK_OPENED; |
220 | retvalue = 1; |
220 | retvalue = 1; |
221 | str = KML_PLACEMARK_HEADER; |
221 | str = KML_PLACEMARK_HEADER; |
222 | for(i= 0; i < sizeof(KML_PLACEMARK_HEADER); i++) |
222 | for(i= 0; i < sizeof(KML_PLACEMARK_HEADER)-1; i++) |
223 | { |
223 | { |
224 | c = (int8_t)pgm_read_byte(str++); // get byte from flash |
224 | c = (int8_t)pgm_read_byte(str++); // get byte from flash |
225 | fputc_(c, doc->file); // and write that to sd-card |
225 | fputc_(c, doc->file); // and write that to sd-card |
226 | } |
226 | } |
227 | } |
227 | } |
Line 250... | Line 250... | ||
250 | { |
250 | { |
251 | if(doc->file != NULL) |
251 | if(doc->file != NULL) |
252 | { |
252 | { |
253 | doc->state = KML_DOC_OPENED; |
253 | doc->state = KML_DOC_OPENED; |
254 | str = KML_PLACEMARK_FOOTER; |
254 | str = KML_PLACEMARK_FOOTER; |
255 | for(i= 0; i < sizeof(KML_PLACEMARK_FOOTER); i++) |
255 | for(i= 0; i < sizeof(KML_PLACEMARK_FOOTER)-1; i++) |
256 | { |
256 | { |
257 | c = (int8_t)pgm_read_byte(str++); // get byte from flash |
257 | c = (int8_t)pgm_read_byte(str++); // get byte from flash |
258 | fputc_(c, doc->file); // and write that to sd-card |
258 | fputc_(c, doc->file); // and write that to sd-card |
259 | } |
259 | } |
260 | retvalue = 1; |
260 | retvalue = 1; |
Line 284... | Line 284... | ||
284 | { |
284 | { |
285 | if(doc->file != NULL) |
285 | if(doc->file != NULL) |
286 | { |
286 | { |
287 | doc->state = KML_DOC_LINESTRING_OPENED; |
287 | doc->state = KML_DOC_LINESTRING_OPENED; |
288 | str = KML_LINESTRING_HEADER; |
288 | str = KML_LINESTRING_HEADER; |
289 | for(i= 0; i < sizeof(KML_LINESTRING_HEADER); i++) |
289 | for(i= 0; i < sizeof(KML_LINESTRING_HEADER)-1; i++) |
290 | { |
290 | { |
291 | c = (int8_t)pgm_read_byte(str++); // get byte from flash |
291 | c = (int8_t)pgm_read_byte(str++); // get byte from flash |
292 | fputc_(c, doc->file); // and write that to sd-card |
292 | fputc_(c, doc->file); // and write that to sd-card |
293 | } |
293 | } |
294 | retvalue = 1; |
294 | retvalue = 1; |
Line 318... | Line 318... | ||
318 | { |
318 | { |
319 | if(doc->file != NULL) |
319 | if(doc->file != NULL) |
320 | { |
320 | { |
321 | doc->state = KML_DOC_PLACEMARK_OPENED; |
321 | doc->state = KML_DOC_PLACEMARK_OPENED; |
322 | str = KML_LINESTRING_FOOTER; |
322 | str = KML_LINESTRING_FOOTER; |
323 | for(i= 0; i < sizeof(KML_LINESTRING_FOOTER); i++) |
323 | for(i= 0; i < sizeof(KML_LINESTRING_FOOTER)-1; i++) |
324 | { |
324 | { |
325 | c = (int8_t)pgm_read_byte(str++); // get byte from flash |
325 | c = (int8_t)pgm_read_byte(str++); // get byte from flash |
326 | fputc_(c, doc->file); // and write that to sd-card |
326 | fputc_(c, doc->file); // and write that to sd-card |
327 | } |
327 | } |
328 | retvalue = 1; |
328 | retvalue = 1; |